MainFrm.pas 675 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960
  1. unit MainFrm;
  2. interface
  3. uses
  4. SingleBorderHintWindow, HardwareID, WinSvc, HttpApp, RealICQSkinFrm, MyUtils,
  5. GIFImage, MMSystem, RealICQUtils, RealICQDBHistory, Windows, Messages,
  6. SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus,
  7. ComCtrls, ExtCtrls, ImgList, Buttons, ToolWin, StdCtrls, OleCtrls, SHDocVw,
  8. MSHTML, XMLDoc, XMLIntf, StrUtils, ActiveX, ShellAPI, ActnMan, ActnList,
  9. XPStyleActnCtrls, ActnCtrls, ActnMenus, ActnColorMaps, RealICQNavigater,
  10. RealICQContacterListView, RealICQContacterTreeView, RealICQUIColor,
  11. RealICQPageControl, RealICQColors, MD5, WNDES, FileCtrl, StdActns,
  12. RealICQClient, StdStyleActnCtrls, ExtDlgs, RealICQButton, ActnPopup,
  13. CustomizeDlg, MyInputBoxFrm, RealICQSpeedButton, AppEvnts, xFonts, jpeg,
  14. DateUtils, IniFiles, RealICQMultiLanguage, Math, Types,
  15. RealICQNetWorkDiskClient, Tabs, RealICQSingleImageButton,
  16. RealICQNoBorderPageControl, ResponsionStreamTransmitter,
  17. NetWorkFileTransmitter, TransmitDirection, DESUnit, BitmapButton, Registry,
  18. PsAPI, TLHelp32, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  19. IdHTTP, QueryIpWry, RealICQHoverImage, XXTEA, AddUserFrm, AddGroupFrm,
  20. AddrBookUserFrm, ImportGuideFrm, DownloadFileFromWeb, MessageBoxFrm, aeslib,
  21. pngimage, SuperObject, EncdDecd, IdMultiPartFormData, cefvcl, RealICQModel,
  22. IdScheduler, IdSchedulerOfThread, IdSchedulerOfThreadPool;
  23. const
  24. BaseURL = '/Login.aspx?LoginName=%s&Password=%s&URL=%s';
  25. LoginURL = '';
  26. InBoxURL = ''; //'/widgets/home';
  27. ReadMessageURL = '/Messages/Default.aspx?url=';
  28. GetWeatherMessage = WM_APP + 157;
  29. DefaultUpdateLogPostUrl = 'http://360.myreda.com/Insert.aspx';
  30. MainTabImageDir = 'Images\TabImage\';
  31. SMSURL = '/Messages/SMSManage.aspx';
  32. MiniPageURL = '/Messages/MiniPage.aspx?LoginName=%s';
  33. AddRemarkURL = '/Messages/Default.aspx?url=SMSManage.aspx?url=EditMemorandum.aspx?Contents=%s';
  34. SNSHomePage = '/SNS/Login.aspx?LoginName=%s&Password=%s&DestUser=%s';
  35. ShowSNS = False;
  36. TeamSharePic: string = 'Images\Share.png';
  37. LoginingGif: string = 'Images\Logining.gif';
  38. DefaultIcon: string = 'Images\Small\DefaultIcon.ico';
  39. TeamIcon: string = 'Images\Small\Team.ico';
  40. SystemMessageIcon: string = 'Images\Small\SystemMessage.ico';
  41. SMSMessageIcon: string = 'Images\Small\SMS.ico';
  42. SNSIcon: string = 'Images\Small\SNS.ico';
  43. CancelIcon: string = 'Images\Cancel.ico';
  44. UpBMP: string = 'Images\Upload.png';
  45. DownBMP: string = 'Images\Download.png';
  46. SimpleMessagePicture: string = 'Images\SysMsg\SimpleMessage.bmp';
  47. SystemMessagePicture: string = 'Images\SysMsg\SystemMessage.bmp';
  48. TeamPicture: string = 'Images\Small\Team.bmp';
  49. SearchPicture: string = 'Images\Search.bmp';
  50. Action_Paste_GIF: string = 'Images\action_paste.png';
  51. WorldCamPicture: string = 'Images\worldCam.jpg';
  52. //VideoBorderBig: String = 'Images\VideoBorderBig.bmp';
  53. //VideoBorderMiddle: String = 'Images\VideoBorderMiddle.bmp';
  54. //VideoBorderSmall: String = 'Images\VideoBorderSmall.bmp';
  55. DefaultPictureSecurity: string = 'Images\Small\Security.bmp';
  56. DefaultPicture: string = 'Images\Small\DefaultHeadImage_96.png';
  57. DefaultPictureBig44: string = 'Images\Small\DefaultHeadImage_44.png';
  58. DefaultPictureBig: string = 'Images\Small\DefaultHeadImage_48.png';
  59. DefaultPictureMiddle: string = 'Images\Small\DefaultHeadImage_24.png';
  60. DefaultPictureSmall: string = 'Images\Small\DefaultHeadImage_16.png';
  61. DefaultPictureBigOffline: string = 'Images\Small\DefaultHeadImageOffline_48.png';
  62. DefaultPictureMiddleOffline: string = 'Images\Small\DefaultHeadImageOffline_24.png';
  63. DefaultPictureSmallOffline: string = 'Images\Small\DefaultHeadImageOffline_16.png';
  64. LeavePicture: string = 'Images\Small\Leave.bmp';
  65. CameraIcon: string = 'Images\Small\Camera.ico';
  66. CameraIconBitmap: string = 'Images\Small\Camera.bmp';
  67. SelectedItemBackgroud: string = 'Images\Small\ItemBack.bmp';
  68. AddFriendIcon: string = 'Images\Small\AddFriend.ico';
  69. TelephoneIcon: string = 'Images\Small\Telephone.ico';
  70. MobilePhoneIcon: string = 'Images\Small\MobilePhone.ico';
  71. EmailIcon: string = 'Images\Small\Email.ico';
  72. SMSIcon: string = 'Images\Small\SMS.ico';
  73. SMSBMP: string = 'Images\Small\SMS.bmp';
  74. SMSSendOK: string = 'Images\SMSSendOK.ico';
  75. SMSSending: string = 'Images\SMSSending.gif';
  76. SMSSendError: string = 'Images\SMSSendError.ico';
  77. BranchExpandedPicture: string = 'Images\OpenFolder.ico';
  78. BranchCollapsedPicture: string = 'Images\CloseFolder.ico';
  79. BranchCollapsedBMP: string = 'Images\CloseFolder.png';
  80. BranchClosedButtonPicture: string = 'Images\ClosedButton.bmp';
  81. BranchOpenedButtonPicture: string = 'Images\OpenedButton.bmp';
  82. GroupOpenedButtonPicture: string = 'Images\FriendOpenedButton.bmp';
  83. GroupClosedButtonPicture: string = 'Images\FriendClosedButton.bmp';
  84. ScrollBarBottomButtonPicture: string = 'Images\VScrollBar\ScrollBarBottomButton.bmp';
  85. ScrollBarBottomButtonDownPicture: string = 'Images\VScrollBar\ScrollBarBottomButtonDown.bmp';
  86. ScrollBarBottomButtonHoverPicture: string = 'Images\VScrollBar\ScrollBarBottomButtonHover.bmp';
  87. ScrollBarTopButtonPicture: string = 'Images\VScrollBar\ScrollBarTopButton.bmp';
  88. ScrollBarTopButtonDownPicture: string = 'Images\VScrollBar\ScrollBarTopButtonDown.bmp';
  89. ScrollBarTopButtonHoverPicture: string = 'Images\VScrollBar\ScrollBarTopButtonHover.bmp';
  90. ScrollBarTrackButtonBottomPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottom.bmp';
  91. ScrollBarTrackButtonBottomDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottomDown.bmp';
  92. ScrollBarTrackButtonBottomHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottomHover.bmp';
  93. ScrollBarTrackButtonMiddlePicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddle.bmp';
  94. ScrollBarTrackButtonMiddleDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddleDown.bmp';
  95. ScrollBarTrackButtonMiddleHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddleHover.bmp';
  96. ScrollBarTrackButtonTopPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTop.bmp';
  97. ScrollBarTrackButtonTopDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTopDown.bmp';
  98. ScrollBarTrackButtonTopHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTopHover.bmp';
  99. ScrollBackgroundPicture: string = 'Images\VScrollBar\ScrollBackground.bmp';
  100. ScrollBarButtonPicture: string = 'Images\VScrollBar\MiddleButton.bmp';
  101. ConfigXMLFilePath: string = 'XML\';
  102. UpdateLogXMLFile: string = 'Online.xml';
  103. GroupConfigXMLFile: string = 'GroupConfig.XML';
  104. StyleConfigXMLFile: string = 'StyleConfig.XML';
  105. DefaultConfigXMLFile: string = 'DefaultConfig.XML';
  106. InputConfigXMLFile: string = 'InputConfig.XML';
  107. HintAndSoundConfigXMLFile: string = 'HintAndSoundConfig.XML';
  108. ReceiveFileConfigXMLFile: string = 'ReceiveFileConfig.XML';
  109. SystemMessagesCounterXMLFile: string = 'SystemMessagesCounter.XML';
  110. SafeConfigXMLFile: string = 'SafeConfig.XML';
  111. AutoUpdateConfigXMLFile: string = 'AutoUpdateConfig.XML';
  112. WindowColorsXMLFile: string = 'WindowColors.XML';
  113. BackGroundImagesXMLFile: string = 'BackGroundImages.XML';
  114. HotKeyConfigXMLFile: string = 'HotKeyConfig.XML';
  115. WebPanelsXMLFile: string = 'WebPanels.XML';
  116. OfflineAutoResponseConfigXMLFile: string = 'OfflineAutoResponseConfig.XML';
  117. AddrBookConfig: string = 'AddrBookConfig.XML';
  118. SysMsgInterfaceConfig: string = 'SysMsgInterfaceConfig.XML';
  119. MessageHistoryDBFile: string = 'binary\History.dat';
  120. PersonalMessageHistoryDBFile: string = 'MessageHistory.DAT';
  121. FaceSmallBMP: string = '_SmallBMP';
  122. FacePreviewBMP: string = '_PreviewBMP';
  123. FaceSmallSize: Integer = 28;
  124. FacePreviewSize: Integer = 92;
  125. ShakeWindowSound: string = 'Sound\nudge.wav';
  126. //未读消息类型,未读消息集合(StringList)中的字符串值为以下常量的值时,表示为特殊的系统消息
  127. TeamMessageID: string = '_____________________________________TeamMessage_';
  128. SystemMessageID: string = '___________________________________SystemMessage_';
  129. SMSMessageID: string = '______________________________________SMSMessage_';
  130. AVSetExeFile: string = 'AVSet.EXE';
  131. HelpCHMFile: string = 'HELP.CHM';
  132. SystemFaceGroup: string = '默认表情';
  133. NOFaceCategory: string = '未分组表情';
  134. type
  135. TInvokeDLLForm = function(App: TApplication; hWnd: THandle; pCall: Pointer; AReceiver: PChar; AColor: TColor): TForm; stdcall;
  136. TWebPanel = class;
  137. TSystemMessageType = (smSimple = 1, smSystemMessage = 2);
  138. TRecvFileSafeLevel = (fsHigh = 0, fsMiddle = 1, fsLow = 2);
  139. THidePosition = (hpNone = 0, hpLeft = 1, hpTop = 2, hpRight = 3);
  140. //定义保存通讯录组和用户的数据结构
  141. TManageGroupMessage = class
  142. private
  143. MessageId: string;
  144. FGroupID: string;
  145. FParentID: string;
  146. FGroupName: string;
  147. end;
  148. TManageGroupMemberMessage = class
  149. private
  150. MessageId: string;
  151. FId: string;
  152. FDisplayName: string;
  153. FNickName: string;
  154. FMobile: string;
  155. FTel: string;
  156. FEmail: string;
  157. FRemark: string;
  158. FGroupId: string;
  159. end;
  160. TServerInfo = class
  161. private
  162. ServerId, ServerName: string;
  163. end;
  164. //检测指定的进程是否运行
  165. TCheckRunProcessThread = class(TThread)
  166. private
  167. ProgramName: string;
  168. ProcessPath: string;
  169. protected
  170. function GetProcessPath(ProcessID: DWORD): string;
  171. function FindProcess(AFileName: string): boolean;
  172. procedure Execute; override;
  173. public
  174. constructor Create(AProgramName, AProcessPath: string);
  175. end;
  176. TThreadPost = class(TThread) //以Post方式提交数据到web页面线程类。
  177. private
  178. FUrl: string;
  179. FContent: string;
  180. protected
  181. procedure Execute; override;
  182. public
  183. constructor Create(URL, Content: string); overload;
  184. end;
  185. TUploadMission = class;
  186. TNDMissionType = (mtDir, mtFile);
  187. TMainForm = class(TRealICQSkinForm)
  188. actLoginAs: TAction;
  189. actLogout: TAction;
  190. actPersonalSet: TAction;
  191. actChangePass: TAction;
  192. actClose: TAction;
  193. actOnline: TAction;
  194. actHidden: TAction;
  195. actOffline: TAction;
  196. actBusy: TAction;
  197. actMute: TAction;
  198. actLeave: TAction;
  199. actOtherState: TAction;
  200. actFindUsers: TAction;
  201. actSaveList: TAction;
  202. actLoadList: TAction;
  203. actShowBigHeadImage: TAction;
  204. actShowSmallHeadImage: TAction;
  205. actShowNormalHeadImage: TAction;
  206. actShowLoginName: TAction;
  207. actShowDisplayName: TAction;
  208. actShowAllName: TAction;
  209. actAlwaysOnTop: TAction;
  210. actMsgManager: TAction;
  211. actAVSet: TAction;
  212. actOptions: TAction;
  213. actHelp: TAction;
  214. actAbout: TAction;
  215. ImgLstPageControl: TImageList;
  216. ActionManager: TActionManager;
  217. ColorDialog: TColorDialog;
  218. actQuit: TAction;
  219. RealICQClient: TRealICQClient;
  220. actReg: TAction;
  221. actConnectSet: TAction;
  222. ppUserItemRightMenu: TPopupActionBar;
  223. actSendMessage: TAction;
  224. actDelFriend: TAction;
  225. miSendMessage: TMenuItem;
  226. N1: TMenuItem;
  227. miDelFriend: TMenuItem;
  228. actShowGroup: TAction;
  229. actGroupManager: TAction;
  230. actShowMiddleHeadImage: TAction;
  231. miGroup: TMenuItem;
  232. actRemoveUser: TAction;
  233. miRemoveUser: TMenuItem;
  234. actShowStrangers: TAction;
  235. actShowBlacklists: TAction;
  236. actShowTeams: TAction;
  237. actShowLatests: TAction;
  238. ppChangeStates: TPopupActionBar;
  239. O1: TMenuItem;
  240. H1: TMenuItem;
  241. N3: TMenuItem;
  242. N5: TMenuItem;
  243. N10: TMenuItem;
  244. ImgLstTrayIcon: TImageList;
  245. ppTrayIcon: TPopupActionBar;
  246. MenuItem12: TMenuItem;
  247. REALICQ1: TMenuItem;
  248. X1: TMenuItem;
  249. M1: TMenuItem;
  250. S1: TMenuItem;
  251. I1: TMenuItem;
  252. N19: TMenuItem;
  253. N20: TMenuItem;
  254. actOpenMainForm: TAction;
  255. TimerForCheckDblClick: TTimer;
  256. ppColors: TPopupActionBar;
  257. MenuItem18: TMenuItem;
  258. miMoreColors: TMenuItem;
  259. ImgLstColors: TImageList;
  260. pnlAll: TPanel;
  261. actSeeInformation: TAction;
  262. miSeeUserInformation: TMenuItem;
  263. N21: TMenuItem;
  264. miSkins: TMenuItem;
  265. pnlLogout: TPanel;
  266. pnlWorkArea: TPanel;
  267. pnlMiddle: TPanel;
  268. pnlClient: TPanel;
  269. TrayIcon: TTrayIcon;
  270. actShowGIFInMailForm: TAction;
  271. actShowGIFInTalkingForm: TAction;
  272. TimerForFlashTrayIcon: TTimer;
  273. ImgLstForFlashTrayIcon: TImageList;
  274. ApplicationEvents: TApplicationEvents;
  275. actCustomFacesManager: TAction;
  276. actOpenRecvFileDir: TAction;
  277. actCreateTeam: TAction;
  278. actSendTeamMessage: TAction;
  279. actSeeTeamInformation: TAction;
  280. actQuitTeam: TAction;
  281. actDisbandTeam: TAction;
  282. actQuitOrDisbandTeams: TAction;
  283. pnlAdvertisement: TPanel;
  284. pnlForWebBrowser: TPanel;
  285. WebBrowserForAdvertisement: TWebBrowser;
  286. pnlForHideWebBrowser: TPanel;
  287. TimerForShowSystemMessage: TTimer;
  288. actShowHistory: TAction;
  289. miShowHistory: TMenuItem;
  290. actShowTeamHistory: TAction;
  291. imgLogoutBK: TImage;
  292. imgLogoutBKTop: TImage;
  293. lblLoginNameTitle: TLabel;
  294. spLoginNameBorder: TShape;
  295. edLoginName: TEdit;
  296. lblLoginState: TLabel;
  297. lblPasswordTitle: TLabel;
  298. edPassword: TEdit;
  299. spPasswordBorder: TShape;
  300. lblLoginStateTitle: TLabel;
  301. spbLoginState: TRealICQSpeedButton;
  302. spbSavePassword: TRealICQSpeedButton;
  303. spbAutoLogin: TRealICQSpeedButton;
  304. lblRemoveMyLoginInfo: TLabel;
  305. lblNetworkConfig: TLabel;
  306. lblRegister: TLabel;
  307. ppLoginedUsers: TPopupActionBar;
  308. MenuItem4: TMenuItem;
  309. miClearLoginHistory: TMenuItem;
  310. ImgLstCheckStates: TImageList;
  311. ppLoginStates: TPopupActionBar;
  312. miOnline: TMenuItem;
  313. lblReConnect: TLabel;
  314. actChangeRemark: TAction;
  315. M2: TMenuItem;
  316. actShowRemark: TAction;
  317. TimerForCheckLogoutTimeout: TTimer;
  318. ImgLstForLogining: TImageList;
  319. TimerForLogining: TTimer;
  320. actShowTree: TAction;
  321. pnlWebSearch: TPanel;
  322. pnlWebSearchSplit: TPanel;
  323. ppContacterViewStyle: TPopupActionBar;
  324. Z1: TMenuItem;
  325. A1: TMenuItem;
  326. D1: TMenuItem;
  327. L1: TMenuItem;
  328. P1: TMenuItem;
  329. N22: TMenuItem;
  330. S2: TMenuItem;
  331. M3: TMenuItem;
  332. B1: TMenuItem;
  333. N23: TMenuItem;
  334. S3: TMenuItem;
  335. B2: TMenuItem;
  336. N24: TMenuItem;
  337. G1: TMenuItem;
  338. M4: TMenuItem;
  339. N25: TMenuItem;
  340. N26: TMenuItem;
  341. T1: TMenuItem;
  342. btLogin: TRealICQButton;
  343. ppLanguages: TPopupActionBar;
  344. imgLogo: TImage;
  345. TimerForHideMainForm: TTimer;
  346. TimerForShowMainForm: TTimer;
  347. RealICQNetWorkDiskClient: TRealICQNetWorkDiskClient;
  348. ppNetWorkFile: TPopupActionBar;
  349. miNDNewDir: TMenuItem;
  350. miNDDelete: TMenuItem;
  351. N28: TMenuItem;
  352. miNDRename: TMenuItem;
  353. pnlMiddleClient: TPanel;
  354. pnlMiddleRight: TPanel;
  355. Spl: TSplitter;
  356. pnlMuiltiWeb: TPanel;
  357. pnlMuiltWebStatus: TPanel;
  358. lblIEStatus: TLabel;
  359. pnlMuiltiWebToolbar: TPanel;
  360. spbPrev: TRealICQSpeedButton;
  361. spbNext: TRealICQSpeedButton;
  362. spbStop: TRealICQSpeedButton;
  363. spbRefresh: TRealICQSpeedButton;
  364. spbAddToNA: TRealICQSpeedButton;
  365. Label2: TLabel;
  366. spbGo: TRealICQSingleImageButton;
  367. cbxURLInputer: TComboBoxEx;
  368. TabSetMuiltWeb: TTabSet;
  369. shpWebStatus: TShape;
  370. shpWebLeftBorder: TShape;
  371. UploadFileOpenDialog: TOpenDialog;
  372. ppNetWorkMisson: TPopupActionBar;
  373. miNDCancel: TMenuItem;
  374. DownloadFileSaveDialog: TSaveDialog;
  375. miNDDownload: TMenuItem;
  376. pgcMultiWeb: TRealICQNoBorderPageControl;
  377. ImgLstForShowHideRight: TImageList;
  378. ImgLstForIEAddress: TImageList;
  379. spbWebClose: TRealICQSpeedButton;
  380. imgWebToolBack: TImage;
  381. shpWebRightBorder: TShape;
  382. sbpNewWebTab: TRealICQSpeedButton;
  383. Bevel5: TBevel;
  384. actOfflieAutoResponse: TAction;
  385. L3: TMenuItem;
  386. imgBottomMenu: TImage;
  387. btMainMenu: TBitmapButton;
  388. spbAddFriend: TRealICQSpeedButton;
  389. pgcMainWorkArea: TTRealICQPageControl;
  390. tsContacters: TTabSheet;
  391. tsAddrBook: TTabSheet;
  392. tsNetWorkDisk: TTabSheet;
  393. pnlAddrBook: TPanel;
  394. pnlNDStateBar: TPanel;
  395. lblNDState: TLabel;
  396. lblNDSpaceSize: TLabel;
  397. pnlNDToolBar: TPanel;
  398. imgNDToolbarBack: TImage;
  399. spbNDNewDir: TRealICQSpeedButton;
  400. spbNDDelete: TRealICQSpeedButton;
  401. spbNDMoveUp: TRealICQSpeedButton;
  402. spbNDUpload: TRealICQSpeedButton;
  403. spbNDDownload: TRealICQSpeedButton;
  404. Bevel1: TBevel;
  405. Bevel2: TBevel;
  406. spbNDConnect: TRealICQSpeedButton;
  407. Bevel4: TBevel;
  408. Bevel3: TBevel;
  409. spbNDRefresh: TRealICQSpeedButton;
  410. spbNDCancelAll: TRealICQSpeedButton;
  411. spbNDDisconnect: TRealICQSpeedButton;
  412. pnlNetWorkFiles: TPanel;
  413. shpNDDirBorder: TShape;
  414. edNDDir: TEdit;
  415. pnlNDFiles: TPanel;
  416. SplitterNDMissions: TSplitter;
  417. pnlNDMissions: TPanel;
  418. PageControlNDMission: TRealICQNoBorderPageControl;
  419. tsUploadingFiles: TTabSheet;
  420. tsDownloadingFiles: TTabSheet;
  421. TabSetNDMissions: TTabSet;
  422. pnlTop: TPanel;
  423. imgTitleBackMiddle: TImage;
  424. shpHeadBack: TShape;
  425. imgHead: TImage;
  426. imgLeave: TImage;
  427. spbDisplayName: TRealICQSpeedButton;
  428. spbWatchword: TRealICQSpeedButton;
  429. shpWatchwordBorder: TShape;
  430. imgHeadImageBorder: TImage;
  431. spbSelUIColor: TRealICQSpeedButton;
  432. spbEmail: TRealICQSpeedButton;
  433. sbpSMS: TRealICQSpeedButton;
  434. edWatchword: TEdit;
  435. WebBrowserForEMail: TWebBrowser;
  436. spbHistroyMessage: TRealICQSpeedButton;
  437. imgLstContacterPageCtrl: TImageList;
  438. edFilterKeyword: TEdit;
  439. spbContacterViewStyle: TRealICQSpeedButton;
  440. spbCancelFilter: TRealICQSpeedButton;
  441. imgWeather: TImage;
  442. ppMainMenu: TPopupActionBar;
  443. miOpenRecvFileDir: TMenuItem;
  444. miCustomFacesManager: TMenuItem;
  445. miAVSet: TMenuItem;
  446. N31: TMenuItem;
  447. miShowGroup: TMenuItem;
  448. miGroupManage: TMenuItem;
  449. N27: TMenuItem;
  450. miLoginAs: TMenuItem;
  451. miSet: TMenuItem;
  452. miLogOut: TMenuItem;
  453. miQuit: TMenuItem;
  454. lblWeather: TLabel;
  455. lblWeatheren: TLabel;
  456. shpFilterBorder: TShape;
  457. pnlToolBar: TPanel;
  458. SysMsg: TRealICQHoverImage;
  459. MyContacters: TRealICQHoverImage;
  460. MyTeam: TRealICQHoverImage;
  461. MyFriend: TRealICQHoverImage;
  462. Latests: TRealICQHoverImage;
  463. pnlSearch: TPanel;
  464. ShpLeft: TShape;
  465. ShpRight: TShape;
  466. ShpBottom: TShape;
  467. ScrollBoxSearchUser: TScrollBox;
  468. spbPersonManage: TRealICQSpeedButton;
  469. MyContactersIcon: TRealICQHoverImage;
  470. SysMsgIcon: TRealICQHoverImage;
  471. MyFriendIcon: TRealICQHoverImage;
  472. MyTeamIcon: TRealICQHoverImage;
  473. LatestsIcon: TRealICQHoverImage;
  474. lblSearchResult: TLabel;
  475. lblWeatherCity: TLabel;
  476. tsCustomerService: TTabSheet;
  477. pnlCustomerServiceStatus: TPanel;
  478. lblCustomerServiceStatus: TLabel;
  479. Panel1: TPanel;
  480. ImageForCustomerTop: TImage;
  481. btCustomerLogin: TRealICQSpeedButton;
  482. Bevel8: TBevel;
  483. btCustomerLogout: TRealICQSpeedButton;
  484. btCustomerDisplayName: TRealICQSpeedButton;
  485. ppChangeCustomerState: TPopupActionBar;
  486. MenuItem5: TMenuItem;
  487. MenuItem7: TMenuItem;
  488. MenuItem8: TMenuItem;
  489. MenuItem9: TMenuItem;
  490. MenuItem10: TMenuItem;
  491. MenuItem11: TMenuItem;
  492. MenuItem13: TMenuItem;
  493. MenuItem15: TMenuItem;
  494. MenuItem16: TMenuItem;
  495. MenuItem17: TMenuItem;
  496. MenuItem19: TMenuItem;
  497. MenuItem21: TMenuItem;
  498. MenuItem22: TMenuItem;
  499. tsCustomers: TTabSheet;
  500. pnlCustomer: TPanel;
  501. ppServerList: TPopupActionBar;
  502. MenuItem20: TMenuItem;
  503. spbTelMeeting: TRealICQSpeedButton;
  504. ppSelCallTel: TPopupActionBar;
  505. miCallMobile: TMenuItem;
  506. miCallTel: TMenuItem;
  507. miChangePwd: TMenuItem;
  508. pnlAddrBkStateBar: TPanel;
  509. imgAddrBookToolbarBack: TImage;
  510. spbAddGroupUser: TRealICQSpeedButton;
  511. spbAddGroup: TRealICQSpeedButton;
  512. spbImportGroupUser: TRealICQSpeedButton;
  513. ScrollBoxAddrBook: TScrollBox;
  514. ppAddrBookList: TPopupActionBar;
  515. miAddGroup: TMenuItem;
  516. miUpdateGroup: TMenuItem;
  517. miDelGroup: TMenuItem;
  518. miAddGroupUser: TMenuItem;
  519. miUpdateGroupUser: TMenuItem;
  520. miDelGroupUser: TMenuItem;
  521. miCut: TMenuItem;
  522. miPaste: TMenuItem;
  523. pnlForTopMessage: TPanel;
  524. ShpHint: TShape;
  525. spbShowNotReadMessage: TRealICQSpeedButton;
  526. TimerForGetBranchOnlineStates: TTimer;
  527. TimerForGetBranchUsersOnlineStates: TTimer;
  528. btPrevLog: TRealICQSpeedButton;
  529. btNextLog: TRealICQSpeedButton;
  530. lblLogs: TLabel;
  531. lblLogsTitle: TLabel;
  532. TimerForShowSystemNotices: TTimer;
  533. btShowMiniPage: TRealICQSpeedButton;
  534. miSetRemark: TMenuItem;
  535. N29: TMenuItem;
  536. miImportGroupUser: TMenuItem;
  537. miGoSpace: TMenuItem;
  538. Label3: TLabel;
  539. miManageGroup: TMenuItem;
  540. menuItemShowGroup: TMenuItem;
  541. pnlGroups: TPanel;
  542. pnlMoreUser: TPanel;
  543. ImgLoadingMoreBranchs: TImage;
  544. pnlSelectServer: TPanel;
  545. shpSearchMoreUser: TShape;
  546. spServerListBorder: TShape;
  547. spbSelectServer: TRealICQSpeedButton;
  548. spbRefreshBranchUsers: TRealICQSpeedButton;
  549. edtSearchMoreUser: TEdit;
  550. edServerList: TEdit;
  551. pnlSearchMoreUser: TPanel;
  552. ShpSearchLeft: TShape;
  553. ShpSearchRight: TShape;
  554. ShpSearchBottom: TShape;
  555. LblSearchHint: TLabel;
  556. ImgLogining: TImage;
  557. ScrollBoxSearchMoreUser: TScrollBox;
  558. ScrollBoxMoreUser: TScrollBox;
  559. pnlTeams: TPanel;
  560. spbFindTeam: TRealICQSpeedButton;
  561. spbCreateTeam: TRealICQSpeedButton;
  562. pnlTemp: TPanel;
  563. ScrollBoxContacters: TScrollBox;
  564. ScrollBoxLatests: TScrollBox;
  565. ScrollBoxMyFriend: TScrollBox;
  566. ScrollBoxTeam: TScrollBox;
  567. spbNetworkBackup: TRealICQSpeedButton;
  568. TimerForHideUserCard: TTimer;
  569. TimerForShowUserCard: TTimer;
  570. RealICQHoverImage1: TRealICQHoverImage;
  571. ImageListForStatBig: TImageList;
  572. ImageListForStatSmall: TImageList;
  573. M5: TMenuItem;
  574. actPhone: TAction;
  575. actRepast: TAction;
  576. actMeeting: TAction;
  577. N6: TMenuItem;
  578. N7: TMenuItem;
  579. N8: TMenuItem;
  580. miLeave: TMenuItem;
  581. miBusy: TMenuItem;
  582. miMute: TMenuItem;
  583. miHidden: TMenuItem;
  584. N9: TMenuItem;
  585. N11: TMenuItem;
  586. N12: TMenuItem;
  587. N13: TMenuItem;
  588. N14: TMenuItem;
  589. N15: TMenuItem;
  590. N16: TMenuItem;
  591. N17: TMenuItem;
  592. N18: TMenuItem;
  593. spb360Safe: TRealICQSpeedButton;
  594. spbChangeLoginName: TRealICQSpeedButton;
  595. spbWinMeet: TRealICQSpeedButton;
  596. ppTeamListView: TPopupActionBar;
  597. MenuItem1: TMenuItem;
  598. MenuItem2: TMenuItem;
  599. H3: TMenuItem;
  600. miSendTeamSMS: TMenuItem;
  601. MenuItem3: TMenuItem;
  602. X2: TMenuItem;
  603. R1: TMenuItem;
  604. Q1: TMenuItem;
  605. spb360SD: TRealICQSpeedButton;
  606. WebBrowserForPostWorkOrder: TWebBrowser;
  607. pnlLocked: TPanel;
  608. shp_lock_client: TShape;
  609. img_lock_headimage_border: TImage;
  610. img_lock_HeadPrev: TImage;
  611. img_lockback_top: TImage;
  612. btn_unlock: TRealICQSpeedButton;
  613. btn_lock_DisplayName: TRealICQSpeedButton;
  614. btn_lock: TMenuItem;
  615. miExportGroupUser: TMenuItem;
  616. SD: TSaveDialog;
  617. TimerForreconnectgroup: TTimer;
  618. Image1: TImage;
  619. btnCALogin: TRealICQSpeedButton;
  620. chrmAppCentre: TChromium;
  621. spblock: TRealICQSpeedButton;
  622. procedure SysMsgIconClick(Sender: TObject);
  623. procedure TimerForreconnectgroupTimer(Sender: TObject);
  624. procedure pnlWorkAreaClick(Sender: TObject);
  625. procedure spbExportGroupUserClick(Sender: TObject);
  626. procedure btn_unlockClick(Sender: TObject);
  627. procedure btn_lockClick(Sender: TObject);
  628. procedure WebBrowserForPostWorkOrderDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  629. procedure spb360SDClick(Sender: TObject);
  630. procedure miSendTeamSMSClick(Sender: TObject);
  631. procedure spbWinMeetClick(Sender: TObject);
  632. procedure RealICQClientGettedSendOfflineFileRequest(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  633. procedure spb360SafeClick(Sender: TObject);
  634. procedure RealICQClientGettedPermission(Sender: TObject);
  635. procedure miMuteClick(Sender: TObject);
  636. procedure miBusyClick(Sender: TObject);
  637. procedure miLeaveClick(Sender: TObject);
  638. procedure imgHeadImageBorderMouseLeave(Sender: TObject);
  639. procedure imgHeadImageBorderMouseEnter(Sender: TObject);
  640. procedure pnlToolBarResize(Sender: TObject);
  641. procedure TimerForShowUserCardTimer(Sender: TObject);
  642. procedure TimerForHideUserCardTimer(Sender: TObject);
  643. procedure spbNetworkBackupClick(Sender: TObject);
  644. procedure tsContactersResize(Sender: TObject);
  645. procedure tsContactersShow(Sender: TObject);
  646. procedure RealICQClientReceivedVideoImage(Sender: TObject; ALoginName: string; ABitmap: TBitmap);
  647. procedure spbRefreshBranchUsersClick(Sender: TObject);
  648. procedure RealICQClientChangePasswordResult(Sender: TObject; APassChanged: Boolean; ANewPassword: string);
  649. procedure RealICQClientGetDBProcedureResult(Sender: TObject; DBProcedureName, ArgIn, ArgOut: string);
  650. procedure miGoSpaceClick(Sender: TObject);
  651. procedure miSetRemarkClick(Sender: TObject);
  652. procedure btShowMiniPageClick(Sender: TObject);
  653. procedure RealICQClientGettedMiniPageSets(Sender: TObject);
  654. procedure spbShowNotReadMessageClick(Sender: TObject);
  655. procedure lblLogsClick(Sender: TObject);
  656. procedure TimerForShowSystemNoticesTimer(Sender: TObject);
  657. procedure lblLogsMouseLeave(Sender: TObject);
  658. procedure lblLogsMouseEnter(Sender: TObject);
  659. procedure btNextLogClick(Sender: TObject);
  660. procedure btPrevLogClick(Sender: TObject);
  661. procedure RealICQClientGetSystemNoticesCount(Sender: TObject; iCount: Integer; NoticesRecords: array of TSystemNotices);
  662. procedure RealICQClientGetNotReadMessageCount(Sender: TObject; iCount: Integer);
  663. procedure TimerForGetBranchUsersOnlineStatesTimer(Sender: TObject);
  664. procedure TimerForGetBranchOnlineStatesTimer(Sender: TObject);
  665. procedure TrayIconMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  666. procedure RealICQClientGettedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  667. procedure LblHintClick(Sender: TObject);
  668. procedure btCloseTopMessageClick(Sender: TObject);
  669. procedure spbImportGroupUserClick(Sender: TObject);
  670. procedure miPasteClick(Sender: TObject);
  671. procedure miCutClick(Sender: TObject);
  672. procedure miDelGroupUserClick(Sender: TObject);
  673. procedure miUpdateGroupUserClick(Sender: TObject);
  674. procedure miAddGroupUserClick(Sender: TObject);
  675. procedure miDelGroupClick(Sender: TObject);
  676. procedure miUpdateGroupClick(Sender: TObject);
  677. procedure miAddGroupClick(Sender: TObject);
  678. procedure ppAddrBookListPopup(Sender: TObject);
  679. procedure ppAddrBookListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  680. procedure RealICQClientGettedSendFolderRequest(Sender: TObject; AID, ACount: Cardinal; ALoginName: string; AFilesStream: TStream);
  681. procedure RealICQClientCanceledSendFolder(Sender: TObject; AID: Cardinal; ALoginName: string);
  682. procedure RealICQClientGettedBranchUser(Sender: TObject);
  683. procedure ppSelCallTelGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  684. procedure tsCustomerServiceContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
  685. procedure RealICQClientSearchUserResult(Sender: TObject);
  686. procedure edtSearchMoreUserChange(Sender: TObject);
  687. procedure edtSearchMoreUserExit(Sender: TObject);
  688. procedure edtSearchMoreUserClick(Sender: TObject);
  689. procedure spbTelMeetingClick(Sender: TObject);
  690. procedure RealICQClientGettedWebUrl(Sender: TObject);
  691. procedure RealICQClientReceivedServerList(Sender: TObject; AServerList: string);
  692. procedure spbSelectServerClick(Sender: TObject);
  693. procedure MeasureItem(Sender: TObject; ACanvas: TCanvas; var Width, Height: Integer);
  694. procedure ppServerListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  695. procedure RealICQClientGettedMoreUserList(Sender: TObject);
  696. procedure RealICQClientGettedMoreBranchList(Sender: TObject);
  697. procedure ppChangeCustomerStateGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  698. procedure btCustomerDisplayNameClick(Sender: TObject);
  699. procedure btCustomerLogoutClick(Sender: TObject);
  700. procedure spbPersonManageClick(Sender: TObject);
  701. procedure edFilterKeywordClick(Sender: TObject);
  702. procedure ImageButtonEnter(Sender: TObject);
  703. procedure ImageButtonLeave(Sender: TObject);
  704. procedure ImageButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  705. procedure pgcMainWorkAreaWebPanelButtonClick(Sender: TObject);
  706. procedure ppMainMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  707. procedure btMainMenuClick(Sender: TObject);
  708. procedure tsAddrBookShow(Sender: TObject);
  709. procedure WebBrowserAddrBookDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  710. procedure WebBrowserAddrBookBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  711. procedure RealICQClientGettedCancelRemoteControlTransmite(Sender: TObject; ALoginName: string);
  712. procedure RealICQClientCancelControlRemoteControlTransmite(Sender: TObject; ALoginName: string);
  713. procedure RealICQClientSendedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  714. procedure RealICQClientSendedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  715. procedure RealICQClientGettedStopRemoteControlTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  716. procedure RealICQClientGettedRemoteControlTransmiteScreenSize(Sender: TObject; ALoginName: string; AWidth, AHeight: Integer);
  717. procedure RealICQClientGettedRemoteControlTransmiteScreenImage(Sender: TObject; ALoginName: string; ALeft, ATop, AWidth, AHeight: Integer; AP: TPoint; ABitmap: TBitmap);
  718. procedure RealICQClientGettedRemoteControlTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  719. procedure RealICQClientGettedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  720. procedure RealICQClientGettedRemoteControlTransmiteControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  721. procedure RealICQClientGettedRemoteControlTransmiteConnectted(Sender: TObject; ALoginName: string);
  722. procedure RealICQClientGettedRemoteControlTransmiteBeControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  723. procedure RealICQClientReceivedOfflineFile(Sender: TObject; ASender, AFileName: string; AFileSize: Int64; ASendDateTime: TDateTime);
  724. procedure TimerForLoginingTimer(Sender: TObject);
  725. procedure TimerForCheckLogoutTimeoutTimer(Sender: TObject);
  726. procedure actShowRemarkExecute(Sender: TObject);
  727. procedure actChangeRemarkExecute(Sender: TObject);
  728. procedure actHelpExecute(Sender: TObject);
  729. procedure actAboutExecute(Sender: TObject);
  730. procedure lblReConnectClick(Sender: TObject);
  731. procedure spbAutoLoginClick(Sender: TObject);
  732. procedure spbSavePasswordClick(Sender: TObject);
  733. procedure miOtherStateClick(Sender: TObject);
  734. procedure miMeetingClick(Sender: TObject);
  735. procedure miHiddenClick(Sender: TObject);
  736. procedure miOnlineClick(Sender: TObject);
  737. procedure ppLoginStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  738. procedure ppChangeStatesPopup(Sender: TObject);
  739. procedure spbLoginStateClick(Sender: TObject);
  740. procedure miClearLoginHistoryClick(Sender: TObject);
  741. procedure spbChangeLoginNameClick(Sender: TObject);
  742. procedure ppLoginedUsersPopup(Sender: TObject);
  743. procedure ppLoginedUsersGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  744. procedure edLoginNameChange(Sender: TObject);
  745. procedure lblRegisterMouseLeave(Sender: TObject);
  746. procedure lblRegisterMouseEnter(Sender: TObject);
  747. procedure actShowTeamHistoryExecute(Sender: TObject);
  748. procedure actShowHistoryExecute(Sender: TObject);
  749. procedure actAVSetExecute(Sender: TObject);
  750. procedure actMsgManagerExecute(Sender: TObject);
  751. procedure WebBrowserForAdvertisementBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  752. procedure RealICQClientReceivedSystemMessage(Sender: TObject; ASystemMessage: TRealICQSystemMessage);
  753. procedure TimerForShowSystemMessageTimer(Sender: TObject);
  754. procedure RealICQClientReceivedAdversement(Sender: TObject);
  755. procedure WebBrowserForAdvertisementDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  756. procedure RealICQClientDownloadTeamFace(Sender: TObject; AFileName: string);
  757. procedure RealICQClientPleaseUploadTeamFace(Sender: TObject; MD5String: string; var FileName: string);
  758. procedure RealICQClientReceivedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  759. procedure RealICQClientSendTeamMessageFailed(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  760. procedure RealICQClientSendedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  761. procedure RealICQClientJoinTeamResponse(Sender: TObject; ATeamID: string; ALoginName: string; ATag: string; AAcceptted: Boolean);
  762. procedure RealICQClientJoinTeamRequest(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName, ATag: string);
  763. procedure spbFindTeamClick(Sender: TObject);
  764. procedure RealICQClientTeamQuitted(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName: string);
  765. procedure RealICQClientTeamDisbanded(Sender: TObject; ARealICQTeam: TRealICQTeam);
  766. procedure actQuitOrDisbandTeamsExecute(Sender: TObject);
  767. procedure ppTeamListViewPopup(Sender: TObject);
  768. procedure ppTeamListViewGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  769. procedure actDisbandTeamExecute(Sender: TObject);
  770. procedure actQuitTeamExecute(Sender: TObject);
  771. procedure actSeeTeamInformationExecute(Sender: TObject);
  772. procedure actSendTeamMessageExecute(Sender: TObject);
  773. procedure RealICQClientJoinedTeam(Sender: TObject; ARealICQTeam: TRealICQTeam);
  774. procedure RealICQClientTeamInfoReady(Sender: TObject; ARealICQTeam: TRealICQTeam);
  775. procedure actCreateTeamExecute(Sender: TObject);
  776. procedure RealICQClientGettedCancelVideoTransmite(Sender: TObject; ALoginName: string);
  777. procedure RealICQClientGettedStopVideoTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  778. procedure RealICQClientSendedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  779. procedure RealICQClientGettedVideoTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  780. procedure RealICQClientGettedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  781. procedure RealICQClientGettedVideoTransmiteConnectted(Sender: TObject; ALoginName: string; ASendBigBmp, ARecvBigBmp: Boolean);
  782. procedure RealICQClientGettedAudioTransmiteConnectted(Sender: TObject; ALoginName: string);
  783. procedure RealICQClientGettedStopAudioTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  784. procedure RealICQClientGettedCancelAudioTransmite(Sender: TObject; ALoginName: string);
  785. procedure RealICQClientGettedAudioTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  786. procedure RealICQClientGettedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  787. procedure RealICQClientSendedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  788. procedure RealICQClientInputting(Sender: TObject; ALoginName: string; AInputting: Boolean);
  789. procedure actOpenRecvFileDirExecute(Sender: TObject);
  790. procedure actCustomFacesManagerExecute(Sender: TObject);
  791. procedure RealICQClientPleaseSendFaceToMe(Sender: TObject; ALoginName, AFaceMD5Code: string);
  792. procedure RealICQClientCancelSendFile(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  793. procedure RealICQClientSendedSendFileRequest(Sender, FileTransmitter: TObject);
  794. procedure RealICQClientGettedSendFileRequest(Sender: TObject; SendFileRequestInfo: TSendFileRequestInfo);
  795. procedure ApplicationEventsException(Sender: TObject; E: Exception);
  796. procedure RealICQClientDisconnected(Sender: TObject);
  797. procedure TimerForFlashTrayIconTimer(Sender: TObject);
  798. procedure RealICQClientReceivedMessage(Sender: TObject; RealICQMessage: TRealICQMessage);
  799. procedure RealICQClientSendMessageFailed(Sender: TObject; RealICQMessage: TRealICQMessage);
  800. procedure FormShow(Sender: TObject);
  801. procedure actShowGIFInTalkingFormExecute(Sender: TObject);
  802. procedure actShowGIFInMailFormExecute(Sender: TObject);
  803. procedure RealICQClientUserExInformationChanged(Sender: TObject; RealICQUser: TRealICQUser);
  804. procedure actSendMessageExecute(Sender: TObject);
  805. procedure RealICQClientDownloadFile(Sender: TObject; AFileName: string);
  806. procedure RealICQClientGetWebTabs(Sender: TObject; ATabCount: Integer; WebTabRecords: array of TWebTabRecord);
  807. procedure spbCancelFilterClick(Sender: TObject);
  808. procedure edFilterKeywordChange(Sender: TObject);
  809. procedure edFilterKeywordExit(Sender: TObject);
  810. procedure actSeeInformationExecute(Sender: TObject);
  811. procedure ppColorsPopup(Sender: TObject);
  812. procedure miMoreColorsClick(Sender: TObject);
  813. procedure ppColorsGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  814. procedure TrayIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  815. procedure actCloseExecute(Sender: TObject);
  816. procedure TrayIconClick(Sender: TObject);
  817. procedure TimerForCheckDblClickTimer(Sender: TObject);
  818. procedure ppTrayIconGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  819. procedure TrayIconDblClick(Sender: TObject);
  820. procedure actOpenMainFormExecute(Sender: TObject);
  821. procedure actQuitExecute(Sender: TObject);
  822. procedure FormResize(Sender: TObject);
  823. procedure ppChangeStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  824. procedure spbDisplayNameClick(Sender: TObject);
  825. procedure actAlwaysOnTopExecute(Sender: TObject);
  826. procedure actShowLatestsExecute(Sender: TObject);
  827. procedure actShowTeamsExecute(Sender: TObject);
  828. procedure actShowBlacklistsExecute(Sender: TObject);
  829. procedure actShowStrangersExecute(Sender: TObject);
  830. procedure actRemoveUserExecute(Sender: TObject);
  831. procedure RealICQClientAddedBlacklists(Sender: TObject; ALoginName: string);
  832. procedure RealICQClientGettedBlacklists(Sender: TObject);
  833. procedure actGroupManagerExecute(Sender: TObject);
  834. procedure actShowMiddleHeadImageExecute(Sender: TObject);
  835. procedure actShowGroupExecute(Sender: TObject);
  836. procedure RealICQClientRemovedUser(Sender: TObject; ALoginName: string);
  837. procedure ppUserItemRightMenuPopup(Sender: TObject);
  838. procedure ppUserItemRightMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  839. procedure actDelFriendExecute(Sender: TObject);
  840. procedure RealICQClientReConnectExecute(Sender: TObject; ASeconds: Integer);
  841. procedure btLoginClick(Sender: TObject);
  842. procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  843. procedure spbSelUIColorClick(Sender: TObject);
  844. procedure FormDestroy(Sender: TObject);
  845. procedure FormCreate(Sender: TObject);
  846. procedure RealICQClientLoginResult(Sender: TObject; LoginResultType: TRealICQLoginResultType; ResultMessage: string);
  847. procedure actLoginExecute(Sender: TObject);
  848. procedure actLogoutExecute(Sender: TObject);
  849. procedure actLoginAsExecute(Sender: TObject);
  850. procedure RealICQClientLoginStateChanged(Sender: TObject);
  851. procedure FormClose(Sender: TObject; var Action: TCloseAction);
  852. procedure RealICQClientGettedFriendList(Sender: TObject);
  853. procedure RealICQClientUserInformationReady(Sender: TObject; RealICQUser: TRealICQUser);
  854. procedure actOnlineExecute(Sender: TObject);
  855. procedure actHiddenExecute(Sender: TObject);
  856. procedure actLeaveExecute(Sender: TObject);
  857. procedure actOtherStateExecute(Sender: TObject);
  858. procedure RealICQClientBeDropped(Sender: TObject; Excuse: string);
  859. procedure RealICQClientLoginFailed(Sender: TObject; E: Exception);
  860. procedure actRegExecute(Sender: TObject);
  861. procedure actShowLoginNameExecute(Sender: TObject);
  862. procedure actShowDisplayNameExecute(Sender: TObject);
  863. procedure actShowAllNameExecute(Sender: TObject);
  864. procedure actShowBigHeadImageExecute(Sender: TObject);
  865. procedure actShowSmallHeadImageExecute(Sender: TObject);
  866. procedure actShowNormalHeadImageExecute(Sender: TObject);
  867. procedure actFindUsersExecute(Sender: TObject);
  868. procedure RealICQClientAddFriendRequest(Sender: TObject; ALoginName, ATag: string);
  869. procedure RealICQClientAddFriendResponse(Sender: TObject; ALoginName, ATag: string; AAcceptted: Boolean);
  870. procedure actOptionsExecute(Sender: TObject);
  871. procedure actPersonalSetExecute(Sender: TObject);
  872. procedure actConnectSetExecute(Sender: TObject);
  873. procedure actChangePassExecute(Sender: TObject);
  874. procedure actShowTreeExecute(Sender: TObject);
  875. procedure edWebSearchKeyWordEnter(Sender: TObject);
  876. procedure edWebSearchKeyWordExit(Sender: TObject);
  877. procedure spbWebSearchClick(Sender: TObject);
  878. procedure edWebSearchKeyWordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  879. procedure RealICQClientShakeWindow(Sender: TObject; ALoginName: string);
  880. procedure ppContacterViewStyleGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  881. procedure spbContacterViewStyleClick(Sender: TObject);
  882. procedure spbWatchwordClick(Sender: TObject);
  883. procedure edWatchwordExit(Sender: TObject);
  884. procedure edWatchwordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  885. procedure ApplicationEventsDeactivate(Sender: TObject);
  886. procedure ppLanguagesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  887. procedure ppLanguagesPopup(Sender: TObject);
  888. procedure spbSelLanguageClick(Sender: TObject);
  889. procedure edPasswordEnter(Sender: TObject);
  890. procedure TimerForHideMainFormTimer(Sender: TObject);
  891. procedure TimerForShowMainFormTimer(Sender: TObject);
  892. procedure FormDeactivate(Sender: TObject);
  893. procedure sbpSMSClick(Sender: TObject);
  894. procedure RealICQClientSMSResult(Sender: TObject; AMessageID: Cardinal; AResult: Integer);
  895. procedure RealICQClientReceivedSMS(Sender: TObject; ASMSSender, ASMSContent: string; ASMSDateTime: TDateTime);
  896. procedure RealICQClientReceivedCustomMessage(Sender: TObject; AContent: string);
  897. procedure spbEmailClick(Sender: TObject);
  898. procedure tsNetWorkDiskShow(Sender: TObject);
  899. procedure RealICQNetWorkDiskClientConnectStateChanged(Sender: TObject);
  900. procedure RealICQNetWorkDiskClientLoginFailed(Sender: TObject; E: Exception);
  901. procedure RealICQNetWorkDiskClientLoginResult(Sender: TObject; LoginResultType: Byte);
  902. procedure spbNDConnectClick(Sender: TObject);
  903. procedure RealICQNetWorkDiskClientDirectoryListReady(Sender: TObject);
  904. procedure spbNDMoveUpClick(Sender: TObject);
  905. procedure spbNDNewDirClick(Sender: TObject);
  906. procedure RealICQNetWorkDiskClientNewDirResult(Sender: TObject; Directory: TRealICQNetWorkDiskDirectory);
  907. procedure ppNetWorkFileGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  908. procedure ppNetWorkFilePopup(Sender: TObject);
  909. procedure spbNDDeleteClick(Sender: TObject);
  910. procedure miNDRenameClick(Sender: TObject);
  911. procedure RealICQNetWorkDiskClientRenamedDir(Sender: TObject; ADirectory: TRealICQNetWorkDiskDirectory);
  912. procedure RealICQNetWorkDiskClientRenamedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile);
  913. procedure RealICQNetWorkDiskClientDeleteResult(Sender: TObject; AList: string);
  914. procedure spbNDRefreshClick(Sender: TObject);
  915. procedure spbNDUploadClick(Sender: TObject);
  916. procedure RealICQNetWorkDiskClientUploadedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile; AMissionID: string);
  917. procedure TabSetNDMissionsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
  918. procedure TabSetNDMissionsClick(Sender: TObject);
  919. procedure RealICQNetWorkDiskClientUploadFileAborted(Sender: TObject; AMissionID: string);
  920. procedure RealICQNetWorkDiskClientUploadingFile(Sender: TObject; ATransmitter: TResponsionStreamTransmitter; ATransmittedSize: Int64);
  921. procedure ppNetWorkMissonGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  922. procedure ppNetWorkMissonPopup(Sender: TObject);
  923. procedure miNDCancelClick(Sender: TObject);
  924. procedure RealICQNetWorkDiskClientGettedUsedSpaceSize(Sender: TObject);
  925. procedure spbNDCancelAllClick(Sender: TObject);
  926. procedure RealICQNetWorkDiskClientNoSpace(Sender: TObject);
  927. procedure spbNDDisconnectClick(Sender: TObject);
  928. procedure RealICQNetWorkDiskClientDownloadFileAborted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  929. procedure RealICQNetWorkDiskClientDownloadFileCompleted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  930. procedure spbNDDownloadClick(Sender: TObject);
  931. procedure RealICQNetWorkDiskClientDownloadFileTransmitting(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  932. procedure pgcMainWorkAreaTabChanging(Sender: TObject; NewIndex: Integer; var AllowChanged: Boolean);
  933. procedure TabSetMuiltWebClick(Sender: TObject);
  934. procedure spbShowHideRightClick(Sender: TObject);
  935. procedure cbxURLInputerDropDown(Sender: TObject);
  936. procedure spbGoClick(Sender: TObject);
  937. procedure cbxURLInputerKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  938. procedure cbxURLInputerSelect(Sender: TObject);
  939. procedure spbPrevClick(Sender: TObject);
  940. procedure spbStopClick(Sender: TObject);
  941. procedure spbNextClick(Sender: TObject);
  942. procedure spbRefreshClick(Sender: TObject);
  943. procedure spbAddToNAClick(Sender: TObject);
  944. procedure spbPrintPrevClick(Sender: TObject);
  945. procedure spbWebCloseClick(Sender: TObject);
  946. procedure sbpNewWebTabClick(Sender: TObject);
  947. procedure TabSetMuiltWebGetImageIndex(Sender: TObject; TabIndex: Integer; var ImageIndex: Integer);
  948. procedure ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean);
  949. procedure RealICQClientReceivedOfflineAutoResponseSet(Sender: TObject; AEnabled: Boolean; AText: string);
  950. procedure actOfflieAutoResponseExecute(Sender: TObject);
  951. procedure RealICQClientUsersBranchReady(Sender: TObject);
  952. procedure WebBrowserForContactersBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  953. procedure RealICQClientGettedSysMsgInterfaces(Sender: TObject);
  954. procedure RealICQClientGettedCanSendSMSCount(Sender: TObject);
  955. procedure ImgQrCodeClick(Sender: TObject);
  956. procedure SysMsgClick(Sender: TObject);
  957. procedure btnCALoginClick(Sender: TObject);
  958. procedure btOAClick(Sender: TObject);
  959. procedure btSwapClick(Sender: TObject);
  960. private
  961. FIsLogout: Boolean;
  962. FLastGetSystemNoticesTicket: Cardinal;
  963. FSystemNoticeIndex: Integer;
  964. FSystemNotices: TList;
  965. FNotAddedEmployeeList: TStringList;
  966. procedure ShowBranchAndUsers(ExpandSelfNode: Boolean = False);
  967. procedure ShowBranchAndFriends;
  968. procedure GetOtherBranchs;
  969. procedure GetBranchUser(Branch: TRealICQBranch);
  970. procedure ShowSystemNotices;
  971. procedure OpenNewWorkDisk(Path: string);
  972. private
  973. FCurrentServerID: string;
  974. FTopSystemMessage: TRealICQSystemMessage;
  975. FServerInfoList: TStringList;
  976. FWebPanels: TStringList;
  977. FAutoHide: Boolean;
  978. FAutoShowRequestMessage: Boolean;
  979. FMovingMainForm: Boolean;
  980. FDblClickedTrayIcon: Boolean;
  981. FMainFormHidden: Boolean;
  982. FHidePosition: THidePosition;
  983. FConfirmReplaceResult: Integer;
  984. FLastDownloadDirectory: string;
  985. FAddrBookURL: string;
  986. // FPCAMessage:TPCAMessage;
  987. FGroupAddress: string;
  988. FGroupPort: Integer;
  989. FGroupImagePort: Integer;
  990. FGroupShareAddress: string;
  991. FGroupSharePort: Integer;
  992. procedure PostUpdateLog;
  993. procedure GetWeather(City, Weatheren, Weather: string);
  994. procedure WMMoving(var Msg: TMessage); message WM_MOVING;
  995. procedure WMSizing(var Msg: TMessage); message WM_SIZING;
  996. procedure WMSize(var Msg: TMessage); message WM_SIZE;
  997. procedure WMMove(var Msg: TMessage); message WM_MOVE;
  998. procedure AddUploadMission(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string; CheckMission: Boolean = True);
  999. procedure CheckUploadMissions;
  1000. procedure GoNextLevelUploadMissions(UploadMission: TUploadMission);
  1001. procedure CheckNDControlState;
  1002. procedure AddDownloadMission(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = ''; CheckMission: Boolean = True);
  1003. procedure CheckDownloadMissions;
  1004. procedure ShowNetWorkDiskSpaceInfo;
  1005. procedure WebBrowserRightStatusTextChange(ASender: TObject; const Text: WideString);
  1006. procedure WebBrowserRightTitleChange(ASender: TObject; const Text: WideString);
  1007. procedure WebBrowserRightDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  1008. procedure WebBrowserRightDocumentCompleteForPost(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  1009. procedure WebBrowserRightNewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
  1010. procedure WebBrowserRightWindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
  1011. public
  1012. MessageBoxForm: TMessageBoxForm;
  1013. property WebPanels: TStringList read FWebPanels;
  1014. procedure LoadWebPanelsFromXML;
  1015. procedure SaveWebPanelsToXML;
  1016. procedure ShowWebTabs;
  1017. procedure HideMainForm;
  1018. procedure ShowMainForm;
  1019. function AddWebBrowserToPageControl(AUrl: string; WebPanelTag: Integer = -1): TWebBrowser;
  1020. procedure OpenNotReadMessage(iIndex: Integer);
  1021. procedure SaveBranchUserDataToXML(FileName: string);
  1022. procedure UpdatePostLogState(Status: Boolean);
  1023. procedure ShowOrHideMuiltiWeb;
  1024. private
  1025. FDownFile: TDownFile;
  1026. {通讯录}
  1027. FCutNode: TTreeNode;
  1028. FManageGroupMsgList: TStringList;
  1029. FManageGroupMemberMsgList: TStringList;
  1030. {通讯录}
  1031. FGetUsersTask: TStringList;
  1032. FHintWindow: TSingleBorderHintWindow;
  1033. ActiveButtonTag: Integer;
  1034. FToolBarButtonList: TStringList;
  1035. FToolBarButtonIconList: TStringList;
  1036. FFriendInfo: TStringList; //存储从好友列表移动到黑名单的好友信息
  1037. FLoginAsSavePassword, FSavePassword, FAutoLogin: Boolean;
  1038. FLoginState: TRealICQLoginState;
  1039. FLeaveMessage: string;
  1040. FCanAlert, FHidden: Boolean;
  1041. FUIMainColor: TColor;
  1042. FShowGroup: Boolean;
  1043. FGroups: TStringList;
  1044. FLVSelectedItemBorderColor: TColor;
  1045. FLVSelectedItemBorderInnerColor: TColor;
  1046. FLVSelectedItemBackColor: TColor;
  1047. FLVHeadImageBorderColor: TColor;
  1048. FLVHeadImageBackColor: TColor;
  1049. FLVStyle: TRealICQContacterListItemStyle;
  1050. FLVCaptionStyle: TRealICQContacterListItemCaptionStyle;
  1051. FShowTree: Boolean; //是否以树型方式组织联系人列表
  1052. FShowStrangers: Boolean;
  1053. FShowBlacklists: Boolean;
  1054. FShowTeams: Boolean;
  1055. FShowLatests: Boolean;
  1056. FShowGIFInMailForm: Boolean;
  1057. FShowGIFInTalkingForm: Boolean;
  1058. FFlashTrayIconIndex: Integer;
  1059. FFlashTrayIconIndexAtLogining: Integer;
  1060. FAlwaysOnTop: Boolean;
  1061. FTalkingFormAlwaysOnTop: Boolean;
  1062. FCtrlEnterSendMessage: Boolean;
  1063. FCopyScreenHideTalkForm: Boolean;
  1064. FReadMessageHotKey: string; // Cardinal;
  1065. FCopyScreenHotKey: string; // Cardinal;
  1066. FMainFormLeft: Integer;
  1067. FMainFormTop: Integer;
  1068. FMainFormWidth: Integer;
  1069. FMainFormHeight: Integer;
  1070. FTalkingFormLeft: Integer;
  1071. FTalkingFormTop: Integer;
  1072. FTalkingFormWidth: Integer;
  1073. FTalkingFormHeight: Integer;
  1074. FSMSFormLeft, FSMSFormTop, FSMSFormWidth, FSMSFormHeight: Integer;
  1075. FConfirmSendOfflineFile: Boolean;
  1076. FShowMainFormOnStart: Boolean;
  1077. FCursorPosX: Integer;
  1078. FCursorPosY: Integer;
  1079. FLastDBlClickTicket: Cardinal;
  1080. FNeedShowUserCardLoginName: string;
  1081. FShowUserCardTargetTop: Integer;
  1082. FWebTabs: TList;
  1083. //未处理的系统消息集合
  1084. FSystemMessages: TList;
  1085. FLastSearchKeyWord: string;
  1086. // FLastActiveIndex: Integer;
  1087. FSearchListViewInVisible: Boolean;
  1088. FSearchListView: TRealICQContacterListView;
  1089. FSearchMoreUserListView: TRealICQContacterListView;
  1090. //显示系统消息的ListView
  1091. FLVSystemMessage: TRealICQContacterListView;
  1092. //显示群组列表的ListView
  1093. FLVTeams: TRealICQContacterListView;
  1094. //显示最近联系人列表的ListView
  1095. FLVNetWorkDisk: TRealICQContacterListView;
  1096. FLVNetWorkDiskUploadingFiles: TRealICQContacterListView;
  1097. FLVNetWorkDiskDownloadingFiles: TRealICQContacterListView;
  1098. //客服最近联系列表w
  1099. FTVCustomerLatests: TRealICQContacterTreeView;
  1100. FLVCustomers: TRealICQContacterListView;
  1101. FContacterListViews: TStringList;
  1102. FContacterTreeViews: TStringList;
  1103. FTrayIconRect: TRect;
  1104. FGettedTrayIconRect: Boolean;
  1105. FInputFont: TFont;
  1106. FSystemFaceCount: Integer;
  1107. FFaceList, FTempFaceList, FFaceCategory: TStringList;
  1108. FShowHintOnOnline: Boolean;
  1109. FShowHintOnOffline: Boolean;
  1110. FDontShowHintOnBusy: Boolean;
  1111. FPlaySoundOnOnline: Boolean;
  1112. FPlaySoundOnOffline: Boolean;
  1113. FPlaySoundOnGetMessage: Boolean;
  1114. FPlaySoundOnGetSystemMessage: Boolean;
  1115. FFlashCaptionOnOnline: Boolean;
  1116. FFlashImageOnGetMessage: Boolean;
  1117. FShowShakeWindow: Boolean;
  1118. FShowCustomMessage: Boolean;
  1119. FShowFileTransCompleted: Boolean;
  1120. FOnlineEventSound: string;
  1121. FOfflineEventSound: string;
  1122. FMessageEventSound: string;
  1123. FSystemMessageEventSound: string;
  1124. FRecvFileSafeLevel: TRecvFileSafeLevel;
  1125. FAllowURL: Boolean;
  1126. FAutoSaveMessage: Boolean;
  1127. FShowHistoryInNewWindow: Boolean;
  1128. FAutoUpdate: Boolean;
  1129. FRecvFileDir: string;
  1130. FUseCacheDir: Boolean;
  1131. FCacheDir: string;
  1132. FLimitCacheDirSize: Boolean;
  1133. FMaxCacheDirSize: Integer;
  1134. FAudoDeleteCacheFile: Boolean;
  1135. FAudoDeleteCacheFileDate: Integer;
  1136. FScanVirus: Boolean;
  1137. FScanVirusProgram: string;
  1138. FDontUseCacheFileOnBigFile: Boolean;
  1139. FDontUseCacheFileOnBigFileSize: Integer;
  1140. //读取/保存历史记录的对象
  1141. FDBHistory: TRealICQDBHistory;
  1142. FOfflineAutoResponseTexts: TStringList;
  1143. CLOSEWINDOWS: UINT; //接收别的进程发送的退出程序的消息
  1144. procedure DownFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  1145. procedure DownFaceFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  1146. procedure QuitWindows();
  1147. procedure ShowFriendLists;
  1148. procedure ShowBlacklists;
  1149. procedure CheckCacheDir;
  1150. procedure LoadOfflineAutoResponseSets;
  1151. //读取最近的联系人列表
  1152. procedure LoadLatests;
  1153. procedure AddMessageHistory(ASystemMessageType: TSystemMessageType; ASimpleMessage: string; ASystemMessage: TRealICQSystemMessage);
  1154. function GetSelectedLoginName: string;
  1155. procedure SetTalkingFormAlwaysOnTop(Value: Boolean);
  1156. procedure SetCtrlEnterSendMessage(Value: Boolean);
  1157. procedure SetCopyScreenHideTalkForm(Value: Boolean);
  1158. procedure SetSearchListViewVisible(AShow: Boolean);
  1159. procedure SetUIState;
  1160. procedure SetLoginControlsVisible(Value: Boolean);
  1161. procedure SetLoginStateControlState;
  1162. procedure LoadMainTabImage;
  1163. procedure LoadHintAndSoundConfigs;
  1164. procedure LoadReceiveFileConfigs;
  1165. procedure LoadSafeConfigs;
  1166. procedure LoadGroupConfigs;
  1167. procedure SaveIfShowGroupConfig;
  1168. procedure ShowGroupInterface;
  1169. procedure LoadStyleConfigs;
  1170. procedure SaveStyleConfigs;
  1171. procedure LoadHotKeyConfigs;
  1172. procedure SaveHotKeyConfigs;
  1173. procedure SetReadMessageHotKey(Value: string);
  1174. procedure SetCopyScreenHotKey(Value: string);
  1175. procedure LoadDefaultConfigs;
  1176. procedure LoadAutoUpdateConfigs;
  1177. procedure LoadInputConfigs;
  1178. procedure SaveInputFontConfig;
  1179. procedure LoadGroupConfig;
  1180. function GetSystemMessageCounter(AMessageID: Integer): Integer;
  1181. procedure IncSystemMessageCounter(AMessageID: Integer);
  1182. procedure SetInputFont(Value: TFont);
  1183. procedure SetShowGroup(Value: Boolean);
  1184. function GetListViewByLoginName(ALoginName: string; AOnlyInGroups: Boolean = False): TRealICQContacterListView;
  1185. procedure SetFlashCaptionOnOnlineValue(Value: Boolean);
  1186. procedure ShowNavBarNumeric;
  1187. procedure SetLoginStateMenuChecked;
  1188. procedure SetStyleMenuChecked;
  1189. procedure miChangeLoginNameClick(Sender: TObject);
  1190. procedure miChangeServerClick(Sender: TObject);
  1191. procedure miMoveGroupClick(Sender: TObject);
  1192. procedure miMoveToBlacklistsClick(Sender: TObject);
  1193. procedure miMoveToStrangersClick(Sender: TObject);
  1194. procedure ItemShowHint(Sender: TObject; Item: TRealICQContacterListItem; var HintStr: string);
  1195. procedure NDItemDoubleClick(Item: TRealICQContacterListItem);
  1196. procedure NDSelectItemChanged(Item: TRealICQContacterListItem);
  1197. procedure NDMissionItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1198. procedure NDMissionDropFiles(Sender: TObject; var Message: TMessage);
  1199. procedure NDItemMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1200. procedure NodeBranchClick(Sender: TObject; Branch: TRealICQBranch);
  1201. procedure NodeOnline(Employee: TRealICQEmployee);
  1202. procedure NodeOffline(Employee: TRealICQEmployee);
  1203. procedure NodeDoubleClick(Employee: TRealICQEmployee);
  1204. procedure NodeIconButtonClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  1205. procedure NodeIconButtonDblClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  1206. procedure NodeOnMouseEnter(Employee: TRealICQEmployee);
  1207. procedure NodeOnMouseLeave(Employee: TRealICQEmployee);
  1208. {通讯录}
  1209. procedure NodeGroupClick(Sender: TObject; Group: TRealICQBranch);
  1210. procedure GetChildsGroupId(GroupId: string; var Groups: string);
  1211. procedure GettedAddrBookUsers(Sender: TObject);
  1212. procedure GettedAddrBookUsers1(Sender: TObject);
  1213. procedure GettedAddrBookGroups(Sender: TObject);
  1214. procedure LoadAddrBook(ExpandGroupId: string);
  1215. procedure GettedManageAddrBookResult(Sender: TObject; OperatModal: Integer; OperatCommand: Integer; RetValue, MessageId: Cardinal);
  1216. function GetGroupUsers(GroupId: string): Integer;
  1217. function GetAddrBookUserIndex(GroupId, LoginName: string): Integer;
  1218. function GetAddrBookUser(GroupId, LoginName: string): TRealICQUser;
  1219. {通讯录}
  1220. procedure miSkinClick(Sender: TObject);
  1221. procedure miColorClick(Sender: TObject);
  1222. procedure WebTabShow(Sender: TObject);
  1223. procedure miLanguageClick(Sender: TObject);
  1224. private
  1225. FCheckedUpdate: Boolean;
  1226. TabAcountIndex: Integer;
  1227. FNotReadMessages: TStringList; {未读消息}
  1228. HotKeyID_ReadMessage: Integer;
  1229. HotKeyID_CopyScreen: Integer;
  1230. procedure WMHotKeyHandle(var Msg: TWMHotKey); message WM_HotKey;
  1231. procedure ShowRealICQMessage(RealICQMessage: TRealICQMessage; ShowSendFailed: Boolean; ARealICQClient: TRealICQClient);
  1232. procedure ShowSystemMessage(ASystemMessage: TRealICQSystemMessage);
  1233. procedure SetShowMainFormOnStart(Value: Boolean);
  1234. procedure SaveWindowState;
  1235. function GetBitmapFromFileExt(AFileName: string): string;
  1236. protected
  1237. procedure ChangeLanguage(ALanguageIniFile: string); override;
  1238. procedure Post(stURL, stPostData: string; var wbWebBrowser: TWebBrowser);
  1239. procedure WMQueryEndSession(var message: TWMQUERYENDSESSION); message WM_QUERYENDSESSION;
  1240. procedure WMPowerBroadcast(var message: TMessage); message WM_POWERBROADCAST;
  1241. procedure CMWininichange(var Message: TWMWinIniChange); message CM_WININICHANGE;
  1242. procedure WndProc(var Message: TMessage); override;
  1243. procedure CreateParams(var Params: TCreateParams); override;
  1244. public
  1245. FLVLatests: TRealICQContacterListView;
  1246. constructor Create(AOwner: TComponent); override;
  1247. procedure ChangeUIColor(AColor: TColor); override;
  1248. procedure ChangePPMenuColorMap(PopupMenuEx: TCustomActionPopupMenuEx);
  1249. procedure NodeOnHeadImageMouseEnter(Employee: TRealICQEmployee);
  1250. procedure NodeOnHeadImageMouseLeave(Employee: TRealICQEmployee);
  1251. procedure ShowMeInformation;
  1252. procedure ShowUserCardForm(ALoginName: string; ATargetTop: Integer);
  1253. procedure HideUserCardForm;
  1254. procedure UpdateAddrBookInfo(RealICQUser: TRealICQUser);
  1255. function GetDefaultBrowser: string; //获取默认浏览器
  1256. procedure ShowRealICQTeamMessage(RealICQTeamMessage: TRealICQTeamMessage; ShowSendFailed: Boolean);
  1257. procedure WebSocketRemoveTeamResponse(aTeamID: string);
  1258. procedure WebSocketQuitTeam(aTeamID: string);
  1259. procedure WebSocketSendReadTeamInfo(aTeamID: string);
  1260. procedure WebSocketRecivedbroadcastmesssage(aID, aGroupID, aSayer, aStyle, aMsg: string; aTimesTamp: TDateTime);
  1261. procedure WebSocketJionTeamRequest(TeamID, ALoginName, ATag: string);
  1262. procedure DownLoadUpdateConfig;
  1263. procedure OpenWebTab(TabSheet: TTabSheet; WebPanel: TWebPanel; AcountIndex: Integer);
  1264. procedure UploadWebTabAccounts;
  1265. procedure GetBranchEmpOnlineAndSum(Branchs: TStringList; BranchInfo: TRealICQBranchInfo; var OnlineEmployee, EmployeeCount: Integer);
  1266. function GetBranchName(LoginName: string): string;
  1267. function GetCompany: string;
  1268. procedure StopHeadImageFlash(AID: string);
  1269. {通讯录}
  1270. function GetGroupUserCount: Integer;
  1271. procedure SaveContacter(Name, Mobile, Tel, Email, Remark, BranchId: string);
  1272. procedure GetParentGroupNameList(BranchInfo: TRealICQBranchInfo; var Groups: string);
  1273. procedure CreateManageGroupMessage(GroupId, GroupName, ParentId, MessageId: string);
  1274. procedure CreateManageGroupMemberMessage(ID, DisplayName, NickName, Mobile, Tel, Email, Remark, GroupId, MessageId: string);
  1275. {通讯录}
  1276. procedure ItemOnline(Item: TRealICQContacterListItem);
  1277. procedure ItemOffline(Item: TRealICQContacterListItem);
  1278. procedure ItemDoubleClick(Item: TRealICQContacterListItem);
  1279. procedure ItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1280. procedure ItemIconButtonDblClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1281. procedure ItemOnMouseEnter(Item: TRealICQContacterListItem);
  1282. procedure ItemOnMouseLeave(Item: TRealICQContacterListItem);
  1283. procedure ItemOnHeadImageEnter(Item: TRealICQContacterListItem);
  1284. procedure ItemOnHeadImageLeave(Item: TRealICQContacterListItem);
  1285. procedure SetToolBarState(Sender: TObject);
  1286. function GetActiveTabSheetName: string;
  1287. function AddFriendTreeView(AOwner: TWinControl; GroupName: string): Integer;
  1288. function AddContacterListView(AOwner: TWinControl; GroupName: string): Integer;
  1289. function AddContacterTreeView(AOwner: TWinControl; GroupName: string): Integer;
  1290. procedure UpdateContacterListView(RealICQContacterListView: TRealICQContacterListView);
  1291. procedure CheckWindowPositon;
  1292. procedure BindUserDataToItem(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean = True);
  1293. procedure BindUserDataToItemForGroup(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AGroupAlias: string; AShowNavBarNumeric: Boolean = True);
  1294. procedure UpdateEmployeeNode(Employee: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  1295. procedure UpdateFriendNode(Friend: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  1296. procedure StopFlash(ALoginName: string);
  1297. procedure StopFlashTeam(ATeamID: string);
  1298. procedure SetGetMoreUserEvent;
  1299. procedure SaveDefaultConfigs;
  1300. // procedure LoadSysMsgInterfaceConfig;
  1301. // procedure SaveSysMsgInterfaceConfig;
  1302. procedure SaveGroupConfigs;
  1303. procedure SaveHintAndSoundConfigs;
  1304. procedure SaveCustomFaceConfig;
  1305. procedure SaveReceiveFileConfigs;
  1306. procedure SaveSafeConfigs;
  1307. procedure SaveAutoUpdateConfigs;
  1308. procedure SaveOfflineAutoResponseSets;
  1309. procedure SetDOMStyle(Doc: IHTMLDocument2);
  1310. procedure OpenMessagesManagerForm;
  1311. property ContacterListViews: TStringList read FContacterListViews;
  1312. property ContacterTreeViews: TStringList read FContacterTreeViews;
  1313. property ListViewLatests: TRealICQContacterListView read FLVLatests;
  1314. property CurrentServerID: string read FCurrentServerID;
  1315. property UIMainColor: TColor read FUIMainColor;
  1316. property CanAlert: Boolean read FCanAlert;
  1317. property OfflineAutoResponseTexts: TStringList read FOfflineAutoResponseTexts write FOfflineAutoResponseTexts;
  1318. property ShowGroup: Boolean read FShowGroup write SetShowGroup;
  1319. property Groups: TStringList read FGroups write FGroups;
  1320. property TalkingFormAlwaysOnTop: Boolean read FTalkingFormAlwaysOnTop write SetTalkingFormAlwaysOnTop;
  1321. property CtrlEnterSendMessage: Boolean read FCtrlEnterSendMessage write SetCtrlEnterSendMessage;
  1322. property CopyScreenHideTalkForm: Boolean read FCopyScreenHideTalkForm write SetCopyScreenHideTalkForm;
  1323. property InputFont: TFont read FInputFont write SetInputFont;
  1324. property FaceList: TStringList read FFaceList;
  1325. property TempFaceList: TStringList read FTempFaceList;
  1326. property FaceCategory: TStringList read FFaceCategory;
  1327. property SystemFaceCount: Integer read FSystemFaceCount;
  1328. property ShowGIFInMailForm: Boolean read FShowGIFInMailForm;
  1329. property ShowGIFInTalkingForm: Boolean read FShowGIFInTalkingForm;
  1330. property NotReadMessages: TStringList read FNotReadMessages;
  1331. property TalkingFormLeft: Integer read FTalkingFormLeft write FTalkingFormLeft;
  1332. property TalkingFormTop: Integer read FTalkingFormTop write FTalkingFormTop;
  1333. property TalkingFormWidth: Integer read FTalkingFormWidth write FTalkingFormWidth;
  1334. property TalkingFormHeight: Integer read FTalkingFormHeight write FTalkingFormHeight;
  1335. property SMSFormLeft: Integer read FSMSFormLeft write FSMSFormLeft;
  1336. property SMSFormTop: Integer read FSMSFormTop write FSMSFormTop;
  1337. property SMSFormWidth: Integer read FSMSFormWidth write FSMSFormWidth;
  1338. property SMSFormHeight: Integer read FSMSFormHeight write FSMSFormHeight;
  1339. property ShowMainFormOnStart: Boolean read FShowMainFormOnStart write SetShowMainFormOnStart;
  1340. property ConfirmSendOfflineFile: Boolean read FConfirmSendOfflineFile write FConfirmSendOfflineFile;
  1341. property AlwaysOnTop: Boolean read FAlwaysOnTop write FAlwaysOnTop;
  1342. property AutoHide: Boolean read FAutoHide write FAutoHide;
  1343. property AutoShowRequestMessage: Boolean read FAutoShowRequestMessage write FAutoShowRequestMessage;
  1344. property ShowHintOnOnline: Boolean read FShowHintOnOnline write FShowHintOnOnline;
  1345. property ShowHintOnOffline: Boolean read FShowHintOnOffline write FShowHintOnOffline;
  1346. property DontShowHintOnBusy: Boolean read FDontShowHintOnBusy write FDontShowHintOnBusy;
  1347. property PlaySoundOnOnline: Boolean read FPlaySoundOnOnline write FPlaySoundOnOnline;
  1348. property PlaySoundOnOffline: Boolean read FPlaySoundOnOffline write FPlaySoundOnOffline;
  1349. property PlaySoundOnGetMessage: Boolean read FPlaySoundOnGetMessage write FPlaySoundOnGetMessage;
  1350. property PlaySoundOnGetSystemMessage: Boolean read FPlaySoundOnGetSystemMessage write FPlaySoundOnGetSystemMessage;
  1351. property FlashCaptionOnOnline: Boolean read FFlashCaptionOnOnline write FFlashCaptionOnOnline;
  1352. property FlashImageOnGetMessage: Boolean read FFlashImageOnGetMessage write FFlashImageOnGetMessage;
  1353. property ShowShakeWindow: Boolean read FShowShakeWindow write FShowShakeWindow;
  1354. property ShowCustomMessage: Boolean read FShowCustomMessage write FShowCustomMessage;
  1355. property ShowFileTransCompleted: Boolean read FShowFileTransCompleted write FShowFileTransCompleted;
  1356. property OnlineEventSound: string read FOnlineEventSound write FOnlineEventSound;
  1357. property OfflineEventSound: string read FOfflineEventSound write FOfflineEventSound;
  1358. property MessageEventSound: string read FMessageEventSound write FMessageEventSound;
  1359. property SystemMessageEventSound: string read FSystemMessageEventSound write FSystemMessageEventSound;
  1360. property RecvFileDir: string read FRecvFileDir write FRecvFileDir;
  1361. property UseCacheDir: Boolean read FUseCacheDir write FUseCacheDir;
  1362. property CacheDir: string read FCacheDir write FCacheDir;
  1363. property LimitCacheDirSize: Boolean read FLimitCacheDirSize write FLimitCacheDirSize;
  1364. property MaxCacheDirSize: Integer read FMaxCacheDirSize write FMaxCacheDirSize;
  1365. property AudoDeleteCacheFile: Boolean read FAudoDeleteCacheFile write FAudoDeleteCacheFile;
  1366. property AudoDeleteCacheFileDate: Integer read FAudoDeleteCacheFileDate write FAudoDeleteCacheFileDate;
  1367. property ScanVirus: Boolean read FScanVirus write FScanVirus;
  1368. property ScanVirusProgram: string read FScanVirusProgram write FScanVirusProgram;
  1369. property DontUseCacheFileOnBigFile: Boolean read FDontUseCacheFileOnBigFile write FDontUseCacheFileOnBigFile;
  1370. property DontUseCacheFileOnBigFileSize: Integer read FDontUseCacheFileOnBigFileSize write FDontUseCacheFileOnBigFileSize;
  1371. property RecvFileSafeLevel: TRecvFileSafeLevel read FRecvFileSafeLevel write FRecvFileSafeLevel;
  1372. property AllowURL: Boolean read FAllowURL write FAllowURL;
  1373. property AutoSaveMessage: Boolean read FAutoSaveMessage write FAutoSaveMessage;
  1374. property ShowHistoryInNewWindow: Boolean read FShowHistoryInNewWindow write FShowHistoryInNewWindow;
  1375. property ReadMessageHotKey: string read FReadMessageHotKey write SetReadMessageHotKey;
  1376. property CopyScreenHotKey: string read FCopyScreenHotKey write SetCopyScreenHotKey;
  1377. property AutoUpdate: Boolean read FAutoUpdate write FAutoUpdate;
  1378. property AddrBookURL: string read FAddrBookURL write FAddrBookURL;
  1379. property DBHistory: TRealICQDBHistory read FDBHistory;
  1380. property GroupAddress: string read FGroupAddress write FGroupAddress;
  1381. property GroupPort: Integer read FGroupPort write FGroupPort;
  1382. property GroupImagePort: Integer read FGroupImagePort write FGroupImagePort;
  1383. property GroupShareAddress: string read FGroupShareAddress write FGroupShareAddress;
  1384. property GroupSharePort: Integer read FGroupSharePort write FGroupSharePort;
  1385. end;
  1386. TUploadMission = class
  1387. private
  1388. FID: string;
  1389. FUploadMissionType: TNDMissionType;
  1390. FDirectoryID: Integer;
  1391. FName: string;
  1392. public
  1393. constructor Create(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string);
  1394. destructor Destroy; override;
  1395. property ID: string read FID;
  1396. property UploadMissionType: TNDMissionType read FUploadMissionType;
  1397. property DirectoryID: Integer read FDirectoryID;
  1398. property Name: string read FName;
  1399. end;
  1400. TDownloadMission = class
  1401. FID: string;
  1402. FDownloadMissionType: TNDMissionType;
  1403. FFileID: Integer;
  1404. FFileName: string;
  1405. FDirectoryName: string;
  1406. public
  1407. constructor Create(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = '');
  1408. destructor Destroy; override;
  1409. property ID: string read FID;
  1410. property DownloadMissionType: TNDMissionType read FDownloadMissionType;
  1411. property FileID: Integer read FFileID;
  1412. property FileName: string read FFileName;
  1413. property DirectoryName: string read FDirectoryName;
  1414. end;
  1415. TNavigateType = (ntGET, ntPOST, ntFill);
  1416. //WEB标签面版数据
  1417. TWebPanel = class
  1418. private
  1419. FMustShow: Boolean;
  1420. FShow: Boolean;
  1421. FID, FName, FURL, FImage: string;
  1422. FNavigateType: TNavigateType;
  1423. FPostFields: string;
  1424. FUserIMLoginName: Boolean;
  1425. FUserIMPassword: Boolean;
  1426. FCustomLoginName, FCustomPassword: string;
  1427. FContent: string;
  1428. FAcounts: TList;
  1429. public
  1430. constructor Create();
  1431. destructor Destroy; override;
  1432. property MustShow: Boolean read FMustShow write FMustShow;
  1433. property Show: Boolean read FShow write FShow;
  1434. property ID: string read FID write FID;
  1435. property Name: string read FName write FName;
  1436. property URL: string read FURL write FURL;
  1437. property Image: string read FImage write FImage;
  1438. property NavigateType: TNavigateType read FNavigateType write FNavigateType;
  1439. property PostFields: string read FPostFields write FPostFields;
  1440. property UserIMLoginName: Boolean read FUserIMLoginName write FUserIMLoginName;
  1441. property UserIMPassword: Boolean read FUserIMPassword write FUserIMPassword;
  1442. property CustomLoginName: string read FCustomLoginName write FCustomLoginName;
  1443. property CustomPassword: string read FCustomPassword write FCustomPassword;
  1444. property Content: string read FContent write FContent;
  1445. property Acounts: TList read FAcounts write FAcounts;
  1446. end;
  1447. //未读消息(文字消息)
  1448. TNotReadMessage = class
  1449. private
  1450. FRealICQMessage: TRealICQMessage;
  1451. FShowSendFailed: Boolean;
  1452. FRealICQClient: TRealICQClient;
  1453. public
  1454. destructor Destroy; override;
  1455. property RealICQMessage: TRealICQMessage read FRealICQMessage write FRealICQMessage;
  1456. property ShowSendFailed: Boolean read FShowSendFailed;
  1457. end;
  1458. //未读消息(文字消息)
  1459. TNotReadTeamMessage = class
  1460. private
  1461. FRealICQTeamMessage: TRealICQTeamMessage;
  1462. FShowSendFailed: Boolean;
  1463. public
  1464. destructor Destroy; override;
  1465. property RealICQTeamMessage: TRealICQTeamMessage read FRealICQTeamMessage write FRealICQTeamMessage;
  1466. property ShowSendFailed: Boolean read FShowSendFailed;
  1467. end;
  1468. //未读消息(手机短消息)
  1469. TNotReadSMSMessage = class
  1470. private
  1471. FSMSSender, FSMSContent: string;
  1472. FSMSDateTime: TDateTime;
  1473. public
  1474. property SMSSender: string read FSMSSender;
  1475. property SMSContent: string read FSMSContent;
  1476. property SMSDateTime: TDateTime read FSMSDateTime;
  1477. end;
  1478. TWebTabAcount = class
  1479. private
  1480. FWebTabID: Integer;
  1481. FTitle: string;
  1482. FLoginName: string;
  1483. FPassword: string;
  1484. FExplain: string;
  1485. public
  1486. published
  1487. property WebTabID: Integer read FWebTabID write FWebTabID;
  1488. property Title: string read FTitle write FTitle;
  1489. property LoginName: string read FLoginName write FLoginName;
  1490. property Password: string read FPassword write FPassword;
  1491. property Explain: string read FExplain write FExplain;
  1492. end;
  1493. //添加表示用户状态的图标至指定的 ImageList 中
  1494. procedure AddUserStatePictureToImageList(ImageList: TImageList);
  1495. procedure ClearFileMissions;
  1496. var
  1497. MainForm: TMainForm;
  1498. DisplayWebs: Boolean;
  1499. LVSystemMessage, LVMyContacters, LVFriends, LVStrangers, LVBlacklists, LVLatests, LVTeams, LVMoreUsers, LVAddrbook, LVSearch: string;
  1500. CsvLines, CommaStr: TStringList;
  1501. implementation
  1502. uses
  1503. RegFrm, SearchFrm, AddFriendRequestFrm, AddFriendFrm, OptionsFrm,
  1504. ChangePassFrm, GroupManagerFrm, OnlineOfflineAlertFrm, UserCardDetailView,
  1505. TalkingFrm, TrueHiddenMainFrm, SelFaceFrm, CustomFacesManagerFrm, AddFaceFrm,
  1506. CreateTeamFrm, PtoPFileTransmitter, FileTransmitterObjective, NotifyAlertFrm,
  1507. TeamOptionsFrm, SearchTeamFrm, SystemMessageFrm, MessagesManagerFrm,
  1508. UserCardFrm, VideoFrm, ShareUtils, CopyScreenFrm, SMSFrm,
  1509. ConfirmReplaceNDFileFrm, RemoteControlFrm, ReceiveFolderRequestFrm,
  1510. NotReadMessageBoxFrm, AddWebTabFrm, SelWebTabAcountsFrm, QRCodeFrm,
  1511. LoggerImport, TeamsAdapter, MainFormContrller, Authority, FileTransmitAdapter,
  1512. DataProviderImport, BranchService, UsersService, FriendsService,
  1513. WorkmatesService, MessagesHander, CAImport, InterfaceCA, UserRemarkService,
  1514. GroupConfig, ConditionConfig, PerlRegEx, LimitCondition, UserCardView,
  1515. AboutFrm, SettingView, TextMessageService, ViewManager, InterfaceUI, GuideView;
  1516. var
  1517. HookID: THandle;
  1518. FUploadMissions, FDownloadMissions: TStringList;
  1519. FSavedUploadMissions, FSavedDownloadMissions: TList;
  1520. //------------------------------------------------------------------------------
  1521. procedure AddUserStatePictureToImageList(ImageList: TImageList);
  1522. var
  1523. Bitmap: TBitmap;
  1524. //BitmapLeave: TBitmap;
  1525. //png: TPNGObject;
  1526. //Icon: TIcon;
  1527. begin
  1528. Bitmap := TBitmap.Create;
  1529. //Icon := TIcon.Create;
  1530. //BitmapLeave := TBitmap.Create;
  1531. //png := TPNGObject.Create;
  1532. try
  1533. // try
  1534. // Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1535. // except
  1536. // end;
  1537. // ImageList.Add(Bitmap, nil);
  1538. //
  1539. // Grayscale(Bitmap);
  1540. // ImageList.Insert(0, Bitmap, nil);
  1541. //
  1542. // try
  1543. // Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1544. // BitmapLeave.LoadFromFile(LeavePicture);
  1545. // Bitmap.Canvas.Draw(0, 8, BitmapLeave);
  1546. // except
  1547. // end;
  1548. // ImageList.Add(Bitmap, nil);
  1549. //-----------------------------------------------
  1550. //png.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1551. //Image1.Picture.Bitmap.Assign(png);
  1552. //
  1553. //
  1554. //
  1555. // try
  1556. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1557. // except
  1558. // end;
  1559. // ImageList.AddIcon(Icon);
  1560. //
  1561. // try
  1562. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1563. // except
  1564. // end;
  1565. // ImageList.AddIcon(Icon);
  1566. //
  1567. // try
  1568. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1569. // except
  1570. // end;
  1571. // ImageList.AddIcon(Icon);
  1572. try
  1573. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImageOffline_16.bmp');
  1574. except
  1575. end;
  1576. ImageList.Add(Bitmap, nil);
  1577. try
  1578. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImage_16.bmp');
  1579. except
  1580. end;
  1581. ImageList.Add(Bitmap, nil);
  1582. try
  1583. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImage_leave_16.bmp');
  1584. except
  1585. end;
  1586. ImageList.Add(Bitmap, nil);
  1587. try
  1588. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\OpenFolder.bmp');
  1589. except
  1590. end;
  1591. ImageList.Add(Bitmap, nil);
  1592. try
  1593. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CloseFolder.bmp');
  1594. except
  1595. end;
  1596. ImageList.Add(Bitmap, nil);
  1597. try
  1598. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  1599. except
  1600. end;
  1601. ImageList.Add(Bitmap, nil);
  1602. try
  1603. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  1604. except
  1605. end;
  1606. ImageList.Add(Bitmap, nil);
  1607. try
  1608. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SearchPicture);
  1609. except
  1610. end;
  1611. ImageList.Add(Bitmap, nil);
  1612. try
  1613. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSBMP);
  1614. except
  1615. end;
  1616. ImageList.Add(Bitmap, nil);
  1617. finally
  1618. //BitmapLeave.Free;
  1619. Bitmap.Free;
  1620. //Icon.Free;
  1621. //png.Free;
  1622. end;
  1623. end;
  1624. //------------------------------------------------------------------------------
  1625. function MouseProc(nCode: Integer; wParam, lParam: Longint): Longint; stdcall;
  1626. var
  1627. szClassName: array[0..255] of Char;
  1628. const
  1629. ie_name = 'Internet Explorer_Server';
  1630. begin
  1631. case nCode < 0 of
  1632. True:
  1633. Result := CallNextHookEx(HookID, nCode, wParam, lParam) else
  1634. case wParam of
  1635. WM_RBUTTONDOWN, WM_RBUTTONUP:
  1636. begin
  1637. GetClassName(PMOUSEHOOKSTRUCT(lParam)^.HWND, szClassName, SizeOf(szClassName));
  1638. if (lstrcmp(@szClassName[0], @ie_name[1]) = 0) and (IsChild(MainForm.WebBrowserForAdvertisement.Handle, PMOUSEHOOKSTRUCT(lParam)^.HWND) or InTalkingFormTeamDisk(PMOUSEHOOKSTRUCT(lParam)^.HWND) or InTalkingFormAdvertisement(PMOUSEHOOKSTRUCT(lParam)^.HWND)) then
  1639. begin
  1640. Result := HC_SKIP {屏蔽WebBrowser上的右键}
  1641. end
  1642. else
  1643. begin
  1644. Result := CallNextHookEx(HookID, nCode, wParam, lParam);
  1645. end;
  1646. end
  1647. else
  1648. Result := CallNextHookEx(HookID, nCode, wParam, lParam);
  1649. end;
  1650. end;
  1651. end;
  1652. {$R *.dfm}
  1653. {TWebPanel}
  1654. constructor TWebPanel.Create();
  1655. begin
  1656. FAcounts := TList.Create;
  1657. end;
  1658. destructor TWebPanel.Destroy;
  1659. var
  1660. WebTabAcount: TWebTabAcount;
  1661. begin
  1662. try
  1663. while FAcounts.Count > 0 do
  1664. begin
  1665. WebTabAcount := FAcounts[0];
  1666. FAcounts.Delete(0);
  1667. try
  1668. FreeAndNil(WebTabAcount);
  1669. except
  1670. end;
  1671. end;
  1672. try
  1673. FreeAndNil(FAcounts);
  1674. except
  1675. end;
  1676. finally
  1677. inherited Destroy;
  1678. end;
  1679. end;
  1680. {TDownloadMission}
  1681. //------------------------------------------------------------------------------
  1682. constructor TDownloadMission.Create(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = '');
  1683. begin
  1684. FDownloadMissionType := ADownloadMissionType;
  1685. FDirectoryName := ADirectoryName;
  1686. FFileID := AFileID;
  1687. FFileName := AFileName;
  1688. FID := IntToStr(GetTickCount);
  1689. while FDownloadMissions.IndexOf(FID) >= 0 do
  1690. begin
  1691. FID := IntToStr(GetTickCount);
  1692. Sleep(10);
  1693. Application.ProcessMessages;
  1694. end;
  1695. FDownloadMissions.AddObject(FID, Self);
  1696. end;
  1697. //------------------------------------------------------------------------------
  1698. destructor TDownloadMission.Destroy;
  1699. begin
  1700. try
  1701. try
  1702. FDownloadMissions.Delete(FDownloadMissions.IndexOf(FID));
  1703. except
  1704. end;
  1705. finally
  1706. inherited Destroy;
  1707. end;
  1708. end;
  1709. {TUploadMission}
  1710. //------------------------------------------------------------------------------
  1711. constructor TUploadMission.Create(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string);
  1712. begin
  1713. FUploadMissionType := AUploadMissionType;
  1714. FDirectoryID := ADirectoryID;
  1715. FName := AName;
  1716. FID := IntToStr(Integer(FUploadMissionType)) + IntToStr(FDirectoryID) + FName;
  1717. end;
  1718. //------------------------------------------------------------------------------
  1719. destructor TUploadMission.Destroy;
  1720. begin
  1721. try
  1722. try
  1723. FUploadMissions.Delete(FUploadMissions.IndexOf(FID));
  1724. except
  1725. end;
  1726. finally
  1727. inherited Destroy;
  1728. end;
  1729. end;
  1730. {TNotReadMessage}
  1731. //------------------------------------------------------------------------------
  1732. destructor TNotReadMessage.Destroy;
  1733. begin
  1734. try
  1735. FreeAndNil(FRealICQMessage);
  1736. finally
  1737. inherited Destroy;
  1738. end;
  1739. end;
  1740. {TNotReadTeamMessage}
  1741. //------------------------------------------------------------------------------
  1742. destructor TNotReadTeamMessage.Destroy;
  1743. begin
  1744. try
  1745. FreeAndNil(FRealICQTeamMessage);
  1746. finally
  1747. inherited Destroy;
  1748. end;
  1749. end;
  1750. {TMainForm}
  1751. function TMainForm.GetBitmapFromFileExt(AFileName: string): string;
  1752. var
  1753. FileExt, IconTempFileName, FFileExtImage: string;
  1754. TempFile: array[0..MAX_PATH] of char;
  1755. SHFI: TSHFileInfo;
  1756. Bitmap: TBitmap;
  1757. begin
  1758. try
  1759. FileExt := ExtractFileExt(AFileName);
  1760. FFileExtImage := TRealICQClient.GetFileExtImagesDir + Copy(FileExt, 2, Length(FileExt) - 1) + '.BMP';
  1761. if not FileExists(FFileExtImage) then
  1762. begin
  1763. GetTempPath(MAX_PATH, TempFile);
  1764. GetTempFileName(TempFile, PChar(FileExt), GetTickCount, TempFile);
  1765. IconTempFileName := ReplaceStr(TempFile, ExtractFileExt(TempFile), FileExt);
  1766. TFileStream.Create(IconTempFileName, fmCreate).Free;
  1767. SHGetFileInfo(PChar(IconTempFileName), 0, SHFI, SizeOf(SHFI), SHGFI_ICON or SHGFI_SMALLICON);
  1768. DeleteFile(PChar(IconTempFileName));
  1769. Bitmap := TBitmap.Create;
  1770. try
  1771. Bitmap.Width := 16;
  1772. Bitmap.Height := 16;
  1773. DrawIconEx(Bitmap.Canvas.Handle, 0, 0, SHFI.hIcon, 16, 16, 0, 0, DI_NORMAL);
  1774. Bitmap.SaveToFile(FFileExtImage);
  1775. finally
  1776. FreeAndNil(Bitmap);
  1777. end;
  1778. end;
  1779. Result := FFileExtImage;
  1780. except
  1781. end;
  1782. end;
  1783. //------------------------------------------------------------------------------
  1784. procedure TMainForm.SetShowMainFormOnStart(Value: Boolean);
  1785. begin
  1786. if FShowMainFormOnStart = Value then
  1787. Exit;
  1788. FShowMainFormOnStart := Value;
  1789. SaveDefaultConfigs;
  1790. end;
  1791. //------------------------------------------------------------------------------
  1792. procedure TMainForm.SetTalkingFormAlwaysOnTop(Value: Boolean);
  1793. begin
  1794. FTalkingFormAlwaysOnTop := Value;
  1795. SaveStyleConfigs;
  1796. end;
  1797. //------------------------------------------------------------------------------
  1798. procedure TMainForm.SetCtrlEnterSendMessage(Value: Boolean);
  1799. begin
  1800. FCtrlEnterSendMessage := Value;
  1801. SaveStyleConfigs;
  1802. end;
  1803. procedure TMainForm.SetCopyScreenHideTalkForm(Value: Boolean);
  1804. begin
  1805. FCopyScreenHideTalkForm := Value;
  1806. SaveStyleConfigs;
  1807. end;
  1808. procedure TMainForm.SetShowGroup(Value: Boolean);
  1809. begin
  1810. FShowGroup := Value;
  1811. ShowGroupInterface;
  1812. end;
  1813. procedure TMainForm.SaveIfShowGroupConfig;
  1814. var
  1815. XMLFile: string;
  1816. XMLDocument: TXMLDocument;
  1817. GroupConfigNode: IXMLNode;
  1818. begin
  1819. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  1820. XMLDocument := TXMLDocument.Create(Self);
  1821. try
  1822. XMLDocument.Active := True;
  1823. if not FileExists(XMLFile) then
  1824. begin
  1825. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  1826. XMLDocument.Active := True;
  1827. end;
  1828. XMLDocument.LoadFromFile(XMLFile);
  1829. GroupConfigNode := XMLDocument.DocumentElement;
  1830. GroupConfigNode.ChildNodes.FindNode('ShowGroup').Attributes['Value'] := FShowGroup;
  1831. XMLDocument.SaveToFile();
  1832. finally
  1833. XMLDocument.Free;
  1834. end;
  1835. end;
  1836. //------------------------------------------------------------------------------
  1837. procedure TMainForm.SaveGroupConfigs;
  1838. var
  1839. XMLFile: string;
  1840. XMLDocument: TXMLDocument;
  1841. GroupConfigNode, GroupListNode, GroupNode: IXMLNode;
  1842. GroupMembers: TStringList;
  1843. iLoop, jLoop: Integer;
  1844. begin
  1845. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  1846. XMLDocument := TXMLDocument.Create(Self);
  1847. try
  1848. XMLDocument.Active := True;
  1849. if not FileExists(XMLFile) then
  1850. begin
  1851. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  1852. XMLDocument.Active := True;
  1853. end;
  1854. XMLDocument.LoadFromFile(XMLFile);
  1855. GroupConfigNode := XMLDocument.DocumentElement;
  1856. GroupListNode := GroupConfigNode.ChildNodes.FindNode('Groups');
  1857. for iLoop := 0 to GroupListNode.ChildNodes.Count - 1 do
  1858. begin
  1859. GroupNode := GroupListNode.ChildNodes[iLoop];
  1860. GroupNode.ChildNodes.Clear;
  1861. end;
  1862. GroupListNode.ChildNodes.Clear;
  1863. for iLoop := 0 to FGroups.Count - 1 do
  1864. begin
  1865. GroupNode := GroupListNode.AddChild('Group');
  1866. GroupNode.Attributes['Name'] := FGroups[iLoop];
  1867. GroupNode.Attributes['Position'] := iLoop;
  1868. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  1869. for jLoop := 0 to GroupMembers.Count - 1 do
  1870. begin
  1871. if (not TFriendsService.GetService.IsFriend(GroupMembers[jLoop])) and (not TWorkmatesService.GetService.IsWorkmate(GroupMembers[jLoop])) then
  1872. continue;
  1873. if (AnsiSameText(RealICQClient.LoginName, GroupMembers[jLoop]) and (RealICQClient.WorkingMode = wmPublic)) then
  1874. continue;
  1875. GroupNode.AddChild('GroupMember').Text := GroupMembers[jLoop];
  1876. end;
  1877. end;
  1878. XMLDocument.SaveToFile();
  1879. finally
  1880. XMLDocument.Free;
  1881. end;
  1882. end;
  1883. //------------------------------------------------------------------------------
  1884. procedure TMainForm.SetInputFont(Value: TFont);
  1885. begin
  1886. FInputFont.Assign(Value);
  1887. SaveInputFontConfig;
  1888. end;
  1889. //------------------------------------------------------------------------------
  1890. function TMainForm.GetSystemMessageCounter(AMessageID: Integer): Integer;
  1891. var
  1892. XMLFile: string;
  1893. XMLDocument: TXMLDocument;
  1894. CountersNode, CounterNode: IXMLNode;
  1895. iLoop: Integer;
  1896. CountersDate: TDateTime;
  1897. begin
  1898. Result := 0;
  1899. XMLFile := TRealICQClient.GetUserDir + SystemMessagesCounterXMLFile;
  1900. XMLDocument := TXMLDocument.Create(Self);
  1901. try
  1902. try
  1903. XMLDocument.Active := True;
  1904. if not FileExists(XMLFile) then
  1905. begin
  1906. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SystemMessagesCounterXMLFile), PChar(XMLFile), False);
  1907. XMLDocument.Active := True;
  1908. end;
  1909. XMLDocument.LoadFromFile(XMLFile);
  1910. CountersNode := XMLDocument.DocumentElement;
  1911. try
  1912. CountersDate := StrToDate(CountersNode.Attributes['Date']);
  1913. except
  1914. CountersDate := StrToDate(AnsiReplaceStr(CountersNode.Attributes['Date'], '-', '/'));
  1915. end;
  1916. if CompareDate(CountersDate, Now) <> 0 then
  1917. begin
  1918. CountersNode.Attributes['Date'] := DateToStr(Now);
  1919. CountersNode.ChildNodes.Clear;
  1920. XMLDocument.SaveToFile();
  1921. Exit;
  1922. end;
  1923. for iLoop := 0 to CountersNode.ChildNodes.Count - 1 do
  1924. begin
  1925. CounterNode := CountersNode.ChildNodes[iLoop];
  1926. if StrToInt(CounterNode.Attributes['ID']) = AMessageID then
  1927. begin
  1928. Result := StrToInt(CounterNode.Attributes['Counter']);
  1929. Exit;
  1930. end;
  1931. end;
  1932. finally
  1933. XMLDocument.Free;
  1934. end;
  1935. except
  1936. try
  1937. DeleteFile(XMLFile);
  1938. except
  1939. end;
  1940. Result := 0;
  1941. end;
  1942. end;
  1943. //------------------------------------------------------------------------------
  1944. procedure TMainForm.ImgQrCodeClick(Sender: TObject);
  1945. begin
  1946. QRCodeForm := TQRCodeForm.Create(Self);
  1947. try
  1948. QRCodeForm.ShowModal;
  1949. finally
  1950. FreeAndNil(QRCodeForm);
  1951. end;
  1952. end;
  1953. procedure TMainForm.IncSystemMessageCounter(AMessageID: Integer);
  1954. var
  1955. XMLFile: string;
  1956. XMLDocument: TXMLDocument;
  1957. CountersNode, CounterNode: IXMLNode;
  1958. iLoop: Integer;
  1959. Finded: Boolean;
  1960. CountersDate: TDateTime;
  1961. begin
  1962. XMLFile := TRealICQClient.GetUserDir + SystemMessagesCounterXMLFile;
  1963. XMLDocument := TXMLDocument.Create(Self);
  1964. try
  1965. XMLDocument.Active := True;
  1966. if not FileExists(XMLFile) then
  1967. begin
  1968. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SystemMessagesCounterXMLFile), PChar(XMLFile), False);
  1969. XMLDocument.Active := True;
  1970. end;
  1971. XMLDocument.LoadFromFile(XMLFile);
  1972. CountersNode := XMLDocument.DocumentElement;
  1973. try
  1974. CountersDate := StrToDate(CountersNode.Attributes['Date']);
  1975. except
  1976. CountersDate := StrToDate(AnsiReplaceStr(CountersNode.Attributes['Date'], '-', '/'));
  1977. end;
  1978. if CompareDate(CountersDate, Now) <> 0 then
  1979. begin
  1980. CountersNode.Attributes['Date'] := DateToStr(Now);
  1981. CountersNode.ChildNodes.Clear;
  1982. end;
  1983. Finded := False;
  1984. for iLoop := 0 to CountersNode.ChildNodes.Count - 1 do
  1985. begin
  1986. CounterNode := CountersNode.ChildNodes[iLoop];
  1987. if StrToInt(CounterNode.Attributes['ID']) = AMessageID then
  1988. begin
  1989. CounterNode.Attributes['Counter'] := IntToStr(StrToInt(CounterNode.Attributes['Counter']) + 1);
  1990. Finded := True;
  1991. Break;
  1992. end;
  1993. end;
  1994. if not Finded then
  1995. begin
  1996. CounterNode := CountersNode.AddChild('SystemMessage');
  1997. CounterNode.Attributes['ID'] := IntToStr(AMessageID);
  1998. CounterNode.Attributes['Counter'] := '1';
  1999. end;
  2000. XMLDocument.SaveToFile();
  2001. finally
  2002. XMLDocument.Free;
  2003. end;
  2004. end;
  2005. //------------------------------------------------------------------------------
  2006. procedure TMainForm.SaveCustomFaceConfig;
  2007. var
  2008. XMLFile, FaceCategorys: string;
  2009. XMLDocument: TXMLDocument;
  2010. InputConfigNode, FacesNode, FaceNode: IXMLNode;
  2011. iLoop, jLoop: Integer;
  2012. Face: TFace;
  2013. begin
  2014. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2015. XMLDocument := TXMLDocument.Create(Self);
  2016. try
  2017. XMLDocument.Active := True;
  2018. if not FileExists(XMLFile) then
  2019. begin
  2020. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2021. XMLDocument.Active := True;
  2022. //删除系统表情
  2023. XMLDocument.LoadFromFile(XMLFile);
  2024. InputConfigNode := XMLDocument.DocumentElement;
  2025. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2026. FacesNode.ChildNodes.Clear;
  2027. XMLDocument.SaveToFile();
  2028. XMLDocument.Active := False;
  2029. end;
  2030. XMLDocument.Active := True;
  2031. XMLDocument.LoadFromFile(XMLFile);
  2032. InputConfigNode := XMLDocument.DocumentElement;
  2033. if InputConfigNode.ChildNodes.FindNode('FaceCategory') = nil then
  2034. begin
  2035. InputConfigNode.AddChild('FaceCategory').Text := '';
  2036. XMLDocument.SaveToFile();
  2037. end;
  2038. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2039. FacesNode.ChildNodes.Clear;
  2040. FaceCategorys := '';
  2041. for iLoop := 0 to FFaceCategory.Count - 1 do
  2042. begin
  2043. for jLoop := FSystemFaceCount to FaceList.Count - 1 do
  2044. begin
  2045. Face := FaceList.Objects[jLoop] as TFace;
  2046. if AnsiSameText(Face.Category, FFaceCategory[iLoop]) then
  2047. begin
  2048. FaceNode := FacesNode.AddChild('Face');
  2049. FaceNode.Text := ExtractFileName(Face.FileName);
  2050. FaceNode.Attributes['ShortCut'] := Face.ShortCut;
  2051. FaceNode.Attributes['Name'] := Face.Name;
  2052. FaceNode.Attributes['MD5Code'] := Face.MD5Code;
  2053. FaceNode.Attributes['Category'] := Face.Category;
  2054. end;
  2055. end;
  2056. if iLoop < FFaceCategory.Count - 1 then
  2057. FaceCategorys := FaceCategorys + FFaceCategory[iLoop] + ','
  2058. else
  2059. FaceCategorys := FaceCategorys + FFaceCategory[iLoop];
  2060. end;
  2061. InputConfigNode.ChildNodes.FindNode('FaceCategory').Text := FaceCategorys;
  2062. if SelFaceForm <> nil then
  2063. SelFaceForm.ReDrawFaces;
  2064. XMLDocument.SaveToFile();
  2065. finally
  2066. XMLDocument.Free;
  2067. end;
  2068. end;
  2069. //------------------------------------------------------------------------------
  2070. procedure TMainForm.SaveInputFontConfig;
  2071. var
  2072. XMLFile: string;
  2073. XMLDocument: TXMLDocument;
  2074. InputConfigNode, FacesNode: IXMLNode;
  2075. begin
  2076. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2077. XMLDocument := TXMLDocument.Create(Self);
  2078. try
  2079. XMLDocument.Active := True;
  2080. if not FileExists(XMLFile) then
  2081. begin
  2082. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2083. XMLDocument.Active := True;
  2084. //删除系统表情
  2085. XMLDocument.LoadFromFile(XMLFile);
  2086. InputConfigNode := XMLDocument.DocumentElement;
  2087. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2088. FacesNode.ChildNodes.Clear;
  2089. XMLDocument.SaveToFile();
  2090. XMLDocument.Active := False;
  2091. end;
  2092. XMLDocument.Active := True;
  2093. XMLDocument.LoadFromFile(XMLFile);
  2094. InputConfigNode := XMLDocument.DocumentElement;
  2095. try
  2096. InputConfigNode.ChildNodes.FindNode('Font').Text := FontToString(FInputFont);
  2097. except
  2098. InputConfigNode.ChildNodes.FindNode('Font').Text := FontToString(Font);
  2099. end;
  2100. XMLDocument.SaveToFile();
  2101. finally
  2102. XMLDocument.Free;
  2103. end;
  2104. end;
  2105. //------------------------------------------------------------------------------
  2106. procedure TMainForm.LoadInputConfigs;
  2107. var
  2108. XMLFile: string;
  2109. XMLDocument: TXMLDocument;
  2110. InputConfigNode, FacesNode, FaceNode: IXMLNode;
  2111. Face: TFace;
  2112. iLoop: Integer;
  2113. Category: string;
  2114. begin
  2115. FInputFont.Assign(Font);
  2116. {$region '删除前一个用户的表情'}
  2117. while FFaceList.Count > 0 do
  2118. begin
  2119. FFaceList.Objects[0].Free;
  2120. FFaceList.Delete(0);
  2121. end;
  2122. FFaceList.Clear;
  2123. while FTempFaceList.Count > 0 do
  2124. begin
  2125. FTempFaceList.Objects[0].Free;
  2126. FTempFaceList.Delete(0);
  2127. end;
  2128. FTempFaceList.Clear;
  2129. FFaceCategory.Clear;
  2130. FSystemFaceCount := 0;
  2131. {$endregion}
  2132. {$region '读取系统表情'}
  2133. FFaceCategory.Add(SystemFaceGroup);
  2134. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile;
  2135. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2136. XMLDocument := TXMLDocument.Create(Self);
  2137. try
  2138. XMLDocument.Active := True;
  2139. XMLDocument.LoadFromFile(XMLFile);
  2140. InputConfigNode := XMLDocument.DocumentElement;
  2141. try
  2142. StringToFont(InputConfigNode.ChildNodes.FindNode('Font').Text, FInputFont);
  2143. except
  2144. FInputFont.Assign(Font);
  2145. end;
  2146. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2147. for iLoop := 0 to FacesNode.ChildNodes.Count - 1 do
  2148. begin
  2149. FaceNode := FacesNode.ChildNodes[iLoop];
  2150. Face := TFace.Create(ExtractFilePath(paramstr(0)) + FaceNode.Text, FaceNode.Attributes['ShortCut'], FaceNode.Attributes['Name'], '', SystemFaceGroup);
  2151. FFaceList.AddObject(Face.ShortCut, Face);
  2152. Inc(FSystemFaceCount);
  2153. end;
  2154. finally
  2155. XMLDocument.Free;
  2156. end;
  2157. {$endregion}
  2158. {$region '读取自定义表情'}
  2159. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2160. XMLDocument := TXMLDocument.Create(Self);
  2161. try
  2162. XMLDocument.Active := True;
  2163. if not FileExists(XMLFile) then
  2164. begin
  2165. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2166. XMLDocument.Active := True;
  2167. //删除系统表情
  2168. XMLDocument.LoadFromFile(XMLFile);
  2169. InputConfigNode := XMLDocument.DocumentElement;
  2170. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2171. FacesNode.ChildNodes.Clear;
  2172. XMLDocument.SaveToFile();
  2173. XMLDocument.Active := False;
  2174. end;
  2175. XMLDocument.Active := True;
  2176. XMLDocument.LoadFromFile(XMLFile);
  2177. InputConfigNode := XMLDocument.DocumentElement;
  2178. try
  2179. StringToFont(InputConfigNode.ChildNodes.FindNode('Font').Text, FInputFont);
  2180. except
  2181. FInputFont.Assign(Font);
  2182. end;
  2183. if InputConfigNode.ChildNodes.FindNode('FaceCategory') = nil then
  2184. begin
  2185. InputConfigNode.AddChild('FaceCategory').Text := '';
  2186. XMLDocument.SaveToFile();
  2187. end;
  2188. FreeAndNil(FFaceCategory);
  2189. FFaceCategory := SplitString(InputConfigNode.ChildNodes.FindNode('FaceCategory').Text, ',');
  2190. if FFaceCategory.IndexOf('') >= 0 then
  2191. FFaceCategory.Delete(FFaceCategory.IndexOf(''));
  2192. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2193. for iLoop := 0 to FacesNode.ChildNodes.Count - 1 do
  2194. begin
  2195. FaceNode := FacesNode.ChildNodes[iLoop];
  2196. try
  2197. Category := FaceNode.Attributes['Category'];
  2198. except
  2199. Category := NOFaceCategory;
  2200. end;
  2201. if FFaceCategory.IndexOf(Category) = -1 then
  2202. begin
  2203. if AnsiSameText(Category, NOFaceCategory) then
  2204. FFaceCategory.Insert(0, Category)
  2205. else
  2206. FFaceCategory.Add(Category);
  2207. end;
  2208. Face := TFace.Create(TRealICQClient.GetCustomFaceDir + FaceNode.Text, FaceNode.Attributes['ShortCut'], FaceNode.Attributes['Name'], FaceNode.Attributes['MD5Code'], Category);
  2209. FFaceList.AddObject(Face.MD5Code, Face);
  2210. end;
  2211. finally
  2212. XMLDocument.Free;
  2213. end;
  2214. {$endregion}
  2215. end;
  2216. //------------------------------------------------------------------------------
  2217. procedure TMainForm.LoadSafeConfigs;
  2218. var
  2219. XMLFile: string;
  2220. XMLDocument: TXMLDocument;
  2221. SafeConfigNode: IXMLNode;
  2222. begin
  2223. XMLFile := TRealICQClient.GetUserDir + SafeConfigXMLFile;
  2224. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2225. XMLDocument := TXMLDocument.Create(Self);
  2226. try
  2227. XMLDocument.Active := True;
  2228. if not FileExists(XMLFile) then
  2229. begin
  2230. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SafeConfigXMLFile), PChar(XMLFile), False);
  2231. XMLDocument.Active := True;
  2232. end;
  2233. XMLDocument.LoadFromFile(XMLFile);
  2234. SafeConfigNode := XMLDocument.DocumentElement;
  2235. FRecvFileSafeLevel := TRecvFileSafeLevel(Integer(SafeConfigNode.ChildNodes.FindNode('RecvFileSafeLevel').Attributes['Value']));
  2236. FAllowURL := SafeConfigNode.ChildNodes.FindNode('AllowURL').Attributes['Value'];
  2237. FShowHistoryInNewWindow := SafeConfigNode.ChildNodes.FindNode('ShowHistoryInNewWindow').Attributes['Value'];
  2238. FAutoSaveMessage := SafeConfigNode.ChildNodes.FindNode('AutoSaveMessage').Attributes['Value'];
  2239. finally
  2240. XMLDocument.Free;
  2241. end;
  2242. end;
  2243. //------------------------------------------------------------------------------
  2244. procedure TMainForm.SaveSafeConfigs;
  2245. var
  2246. XMLFile: string;
  2247. XMLDocument: TXMLDocument;
  2248. SafeConfigNode: IXMLNode;
  2249. begin
  2250. XMLFile := TRealICQClient.GetUserDir + SafeConfigXMLFile;
  2251. XMLDocument := TXMLDocument.Create(Self);
  2252. try
  2253. XMLDocument.Active := True;
  2254. if not FileExists(XMLFile) then
  2255. begin
  2256. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SafeConfigXMLFile), PChar(XMLFile), False);
  2257. XMLDocument.Active := True;
  2258. end;
  2259. XMLDocument.LoadFromFile(XMLFile);
  2260. SafeConfigNode := XMLDocument.DocumentElement;
  2261. SafeConfigNode.ChildNodes.FindNode('RecvFileSafeLevel').Attributes['Value'] := Integer(FRecvFileSafeLevel);
  2262. SafeConfigNode.ChildNodes.FindNode('AllowURL').Attributes['Value'] := FAllowURL;
  2263. SafeConfigNode.ChildNodes.FindNode('ShowHistoryInNewWindow').Attributes['Value'] := FShowHistoryInNewWindow;
  2264. SafeConfigNode.ChildNodes.FindNode('AutoSaveMessage').Attributes['Value'] := FAutoSaveMessage;
  2265. XMLDocument.SaveToFile();
  2266. finally
  2267. XMLDocument.Free;
  2268. end;
  2269. end;
  2270. //------------------------------------------------------------------------------
  2271. procedure TMainForm.LoadWebPanelsFromXML;
  2272. var
  2273. ADesKey: string;
  2274. iLoop: Integer;
  2275. XMLFile: string;
  2276. XMLDocument: TXMLDocument;
  2277. WebPanelsNode, WebPanelNode: IXMLNode;
  2278. WebPanel: TWebPanel;
  2279. begin
  2280. XMLFile := TRealICQClient.GetUserDir + WebPanelsXMLFile;
  2281. XMLDocument := TXMLDocument.Create(Self);
  2282. try
  2283. try
  2284. XMLDocument.Active := True;
  2285. if not FileExists(XMLFile) then
  2286. begin
  2287. XMLDocument.XML.Text := '<?xml version="1.0"?>' + '<WebPanels>' + '</WebPanels>';
  2288. XMLDocument.Active := True;
  2289. XMLDocument.SaveToFile(XMLFile);
  2290. end
  2291. else
  2292. begin
  2293. XMLDocument.LoadFromFile(XMLFile);
  2294. end;
  2295. WebPanelsNode := XMLDocument.DocumentElement;
  2296. while FWebPanels.Count > 0 do
  2297. begin
  2298. FWebPanels.Objects[0].Free;
  2299. FWebPanels.Delete(0);
  2300. end;
  2301. FWebPanels.Clear;
  2302. ADesKey := MD5En(RealICQClient.LoginName);
  2303. for iLoop := WebPanelsNode.ChildNodes.Count - 1 downto 0 do
  2304. begin
  2305. WebPanelNode := WebPanelsNode.ChildNodes[iLoop];
  2306. WebPanel := TWebPanel.Create;
  2307. try
  2308. WebPanel.FMustShow := WebPanelNode.Attributes['MustShow'];
  2309. except
  2310. WebPanel.FMustShow := False;
  2311. end;
  2312. try
  2313. WebPanel.FShow := WebPanelNode.Attributes['Show'];
  2314. except
  2315. WebPanel.FShow := False;
  2316. end;
  2317. try
  2318. WebPanel.FID := WebPanelNode.Attributes['ID'];
  2319. except
  2320. WebPanel.FID := '';
  2321. end;
  2322. WebPanel.FName := DESryStrHex(WebPanelNode.Attributes['Name'], ADesKey);
  2323. WebPanel.FURL := DESryStrHex(WebPanelNode.Attributes['URL'], ADesKey);
  2324. WebPanel.FImage := DESryStrHex(WebPanelNode.Attributes['Image'], ADesKey);
  2325. WebPanel.FNavigateType := WebPanelNode.Attributes['NavigateType'];
  2326. WebPanel.FPostFields := DESryStrHex(WebPanelNode.Attributes['PostFields'], ADesKey);
  2327. WebPanel.FUserIMLoginName := WebPanelNode.Attributes['UserIMLoginName'];
  2328. WebPanel.FUserIMPassword := WebPanelNode.Attributes['UserIMPassword'];
  2329. WebPanel.FCustomLoginName := DESryStrHex(WebPanelNode.Attributes['CustomLoginName'], ADesKey);
  2330. WebPanel.FCustomPassword := DESryStrHex(WebPanelNode.Attributes['CustomPassword'], ADesKey);
  2331. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  2332. end;
  2333. except
  2334. end;
  2335. finally
  2336. XMLDocument.Free;
  2337. end;
  2338. end;
  2339. //------------------------------------------------------------------------------
  2340. procedure TMainForm.SaveWebPanelsToXML;
  2341. var
  2342. ADesKey: string;
  2343. iLoop: Integer;
  2344. XMLFile: string;
  2345. XMLDocument: TXMLDocument;
  2346. WebPanelsNode, WebPanelNode: IXMLNode;
  2347. WebPanel: TWebPanel;
  2348. begin
  2349. XMLFile := TRealICQClient.GetUserDir + WebPanelsXMLFile;
  2350. XMLDocument := TXMLDocument.Create(Self);
  2351. try
  2352. try
  2353. XMLDocument.Active := True;
  2354. if not FileExists(XMLFile) then
  2355. begin
  2356. XMLDocument.XML.Text := '<?xml version="1.0"?>' + '<WebPanels>' + '</WebPanels>';
  2357. XMLDocument.Active := True;
  2358. end
  2359. else
  2360. begin
  2361. XMLDocument.LoadFromFile(XMLFile);
  2362. end;
  2363. WebPanelsNode := XMLDocument.DocumentElement;
  2364. ADesKey := MD5En(RealICQClient.LoginName);
  2365. WebPanelsNode.ChildNodes.Clear;
  2366. for iLoop := 0 to FWebPanels.Count - 1 do
  2367. begin
  2368. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  2369. WebPanelNode := WebPanelsNode.AddChild('WebPanel');
  2370. WebPanelNode.Attributes['MustShow'] := WebPanel.FMustShow;
  2371. WebPanelNode.Attributes['Show'] := WebPanel.FShow;
  2372. WebPanelNode.Attributes['ID'] := WebPanel.FID;
  2373. WebPanelNode.Attributes['Name'] := EncryStrHex(WebPanel.FName, ADesKey);
  2374. WebPanelNode.Attributes['URL'] := EncryStrHex(WebPanel.FURL, ADesKey);
  2375. WebPanelNode.Attributes['Image'] := EncryStrHex(WebPanel.FImage, ADesKey);
  2376. WebPanelNode.Attributes['NavigateType'] := WebPanel.FNavigateType;
  2377. WebPanelNode.Attributes['PostFields'] := EncryStrHex(WebPanel.FPostFields, ADesKey);
  2378. WebPanelNode.Attributes['UserIMLoginName'] := WebPanel.FUserIMLoginName;
  2379. WebPanelNode.Attributes['UserIMPassword'] := WebPanel.FUserIMPassword;
  2380. WebPanelNode.Attributes['CustomLoginName'] := EncryStrHex(WebPanel.FCustomLoginName, ADesKey);
  2381. WebPanelNode.Attributes['CustomPassword'] := EncryStrHex(WebPanel.FCustomPassword, ADesKey);
  2382. end;
  2383. XMLDocument.SaveToFile(XMLFile);
  2384. except
  2385. end;
  2386. finally
  2387. XMLDocument.Free;
  2388. end;
  2389. end;
  2390. {
  2391. //----------------------------------------------------------
  2392. procedure TMainForm.LoadSysMsgInterfaceConfig;
  2393. var
  2394. XMLFile: String;
  2395. XMLDocument: TXMLDocument;
  2396. ConfigNodes,ConfigNode: IXMLNode;
  2397. iLoop:Integer;
  2398. SysMsgInterface:TSysMsgInterface;
  2399. MsgIID:String;
  2400. begin
  2401. XMLFile := TRealICQClient.GetUserDir+SysMsgInterfaceConfig;
  2402. XMLDocument := TXMLDocument.Create(Self);
  2403. try
  2404. try
  2405. XMLDocument.Active := True;
  2406. if not FileExists(XMLFile) then
  2407. begin
  2408. XMLDocument.XML.Text := '<?xml version="1.0"?>' +
  2409. '<SysMsgInterfaces>' +
  2410. '</SysMsgInterfaces>';
  2411. XMLDocument.Active := True;
  2412. XMLDocument.SaveToFile(XMLFile);
  2413. end
  2414. else
  2415. begin
  2416. XMLDocument.LoadFromFile(XMLFile);
  2417. end;
  2418. ConfigNodes := XMLDocument.DocumentElement;
  2419. for iLoop := 0 to ConfigNodes.ChildNodes.Count - 1 do
  2420. begin
  2421. ConfigNode:=ConfigNodes.ChildNodes[iLoop];
  2422. MsgIID:=ConfigNode.Attributes['MsgIID'];
  2423. if MainForm.RealICQClient.SysMsgInterfaces.IndexOf(MsgIID)>=0 then
  2424. begin
  2425. SysMsgInterface:=MainForm.RealICQClient.SysMsgInterfaces.Objects[MainForm.RealICQClient.SysMsgInterfaces.IndexOf(MsgIID)] as TSysMsgInterface;
  2426. SysMsgInterface.ShowMsg:=ConfigNode.Attributes['ShowMsg'];
  2427. end;
  2428. end;
  2429. except
  2430. //
  2431. end;
  2432. finally
  2433. XMLDocument.Free;
  2434. end;
  2435. end; }
  2436. {
  2437. //-----------------------------------------------------------
  2438. procedure TMainForm.SaveSysMsgInterfaceConfig;
  2439. var
  2440. XMLFile: String;
  2441. XMLDocument: TXMLDocument;
  2442. ConfigNodes,ConfigNode: IXMLNode;
  2443. iLoop:Integer;
  2444. SysMsgInterface:TSysMsgInterface;
  2445. begin
  2446. XMLFile := TRealICQClient.GetUserDir+SysMsgInterfaceConfig;
  2447. XMLDocument := TXMLDocument.Create(Self);
  2448. try
  2449. try
  2450. XMLDocument.Active := True;
  2451. if not FileExists(XMLFile) then
  2452. begin
  2453. XMLDocument.XML.Text := '<?xml version="1.0"?>' +
  2454. '<SysMsgInterfaces>' +
  2455. '</SysMsgInterfaces>';
  2456. XMLDocument.Active := True;
  2457. end
  2458. else
  2459. begin
  2460. XMLDocument.LoadFromFile(XMLFile);
  2461. end;
  2462. ConfigNodes := XMLDocument.DocumentElement;
  2463. ConfigNodes.ChildNodes.Clear;
  2464. for iLoop := 0 to MainForm.RealICQClient.SysMsgInterfaces.Count - 1 do
  2465. begin
  2466. SysMsgInterface:=MainForm.RealICQClient.SysMsgInterfaces.Objects[iLoop] as TSysMsgInterface;
  2467. ConfigNode:=ConfigNodes.AddChild('SysMsgInterface');
  2468. ConfigNode.Attributes['MsgIID']:=SysMsgInterface.MsgIID;
  2469. ConfigNode.Attributes['ShowMsg']:=SysMsgInterface.ShowMsg;
  2470. end;
  2471. XMLDocument.SaveToFile(XMLFile);
  2472. except
  2473. end;
  2474. finally
  2475. XMLDocument.Free;
  2476. end;
  2477. end; }
  2478. //------------------------------------------------------------------------------
  2479. procedure TMainForm.LoadReceiveFileConfigs;
  2480. var
  2481. XMLFile: string;
  2482. XMLDocument: TXMLDocument;
  2483. ReceiveFileConfigNode: IXMLNode;
  2484. begin
  2485. XMLFile := TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile;
  2486. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2487. XMLDocument := TXMLDocument.Create(Self);
  2488. try
  2489. XMLDocument.Active := True;
  2490. if not FileExists(XMLFile) then
  2491. begin
  2492. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + ReceiveFileConfigXMLFile), PChar(XMLFile), False);
  2493. XMLDocument.Active := True;
  2494. end;
  2495. XMLDocument.LoadFromFile(XMLFile);
  2496. ReceiveFileConfigNode := XMLDocument.DocumentElement;
  2497. FRecvFileDir := ReceiveFileConfigNode.ChildNodes.FindNode('RecvFileDir').Attributes['Value'];
  2498. FUseCacheDir := ReceiveFileConfigNode.ChildNodes.FindNode('UseCacheDir').Attributes['Value'];
  2499. FCacheDir := ReceiveFileConfigNode.ChildNodes.FindNode('CacheDir').Attributes['Value'];
  2500. FLimitCacheDirSize := ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['Value'];
  2501. FMaxCacheDirSize := ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['MaxSize'];
  2502. FAudoDeleteCacheFile := ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Value'];
  2503. FAudoDeleteCacheFileDate := ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Date'];
  2504. FScanVirus := ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Value'];
  2505. FScanVirusProgram := ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Program'];
  2506. FDontUseCacheFileOnBigFile := ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Value'];
  2507. FDontUseCacheFileOnBigFileSize := ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Size'];
  2508. if not DirectoryExists(FRecvFileDir) then
  2509. begin
  2510. FRecvFileDir := RealICQClient.GetUserDir + '我接收到的文件\';
  2511. if not DirectoryExists(FRecvFileDir) then
  2512. CreateDir(FRecvFileDir);
  2513. end;
  2514. if (not DirectoryExists(FCacheDir)) and FUseCacheDir then
  2515. begin
  2516. FCacheDir := RealICQClient.GetUserDir + 'CacheFiles\';
  2517. if not DirectoryExists(FCacheDir) then
  2518. CreateDir(FCacheDir);
  2519. end;
  2520. finally
  2521. XMLDocument.Free;
  2522. end;
  2523. end;
  2524. //------------------------------------------------------------------------------
  2525. procedure TMainForm.SaveReceiveFileConfigs;
  2526. var
  2527. XMLFile: string;
  2528. XMLDocument: TXMLDocument;
  2529. ReceiveFileConfigNode: IXMLNode;
  2530. begin
  2531. XMLFile := TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile;
  2532. XMLDocument := TXMLDocument.Create(Self);
  2533. try
  2534. XMLDocument.Active := True;
  2535. if not FileExists(XMLFile) then
  2536. begin
  2537. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + ReceiveFileConfigXMLFile), PChar(XMLFile), False);
  2538. XMLDocument.Active := True;
  2539. end;
  2540. XMLDocument.LoadFromFile(XMLFile);
  2541. ReceiveFileConfigNode := XMLDocument.DocumentElement;
  2542. ReceiveFileConfigNode.ChildNodes.FindNode('RecvFileDir').Attributes['Value'] := FRecvFileDir;
  2543. ReceiveFileConfigNode.ChildNodes.FindNode('UseCacheDir').Attributes['Value'] := FUseCacheDir;
  2544. ReceiveFileConfigNode.ChildNodes.FindNode('CacheDir').Attributes['Value'] := FCacheDir;
  2545. ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['Value'] := FLimitCacheDirSize;
  2546. ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['MaxSize'] := FMaxCacheDirSize;
  2547. ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Value'] := FAudoDeleteCacheFile;
  2548. ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Date'] := FAudoDeleteCacheFileDate;
  2549. ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Value'] := FScanVirus;
  2550. ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Program'] := FScanVirusProgram;
  2551. ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Value'] := FDontUseCacheFileOnBigFile;
  2552. ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Size'] := FDontUseCacheFileOnBigFileSize;
  2553. XMLDocument.SaveToFile();
  2554. finally
  2555. XMLDocument.Free;
  2556. end;
  2557. end;
  2558. //------------------------------------------------------------------------------
  2559. procedure TMainForm.LoadOfflineAutoResponseSets;
  2560. var
  2561. XMLFile: string;
  2562. XMLDocument: TXMLDocument;
  2563. OfflineAutoResponseConfigNode, TextNode: IXMLNode;
  2564. iLoop: Integer;
  2565. begin
  2566. XMLFile := TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile;
  2567. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2568. XMLDocument := TXMLDocument.Create(Self);
  2569. try
  2570. XMLDocument.Active := True;
  2571. if not FileExists(XMLFile) then
  2572. begin
  2573. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + OfflineAutoResponseConfigXMLFile), PChar(XMLFile), False);
  2574. XMLDocument.Active := True;
  2575. end;
  2576. XMLDocument.LoadFromFile(XMLFile);
  2577. OfflineAutoResponseConfigNode := XMLDocument.DocumentElement;
  2578. FOfflineAutoResponseTexts.Clear;
  2579. for iLoop := 0 to OfflineAutoResponseConfigNode.ChildNodes.Count - 1 do
  2580. begin
  2581. TextNode := OfflineAutoResponseConfigNode.ChildNodes[iLoop];
  2582. FOfflineAutoResponseTexts.Add(TextNode.Text);
  2583. end;
  2584. finally
  2585. XMLDocument.Free;
  2586. end;
  2587. end;
  2588. //------------------------------------------------------------------------------
  2589. procedure TMainForm.SaveOfflineAutoResponseSets;
  2590. var
  2591. XMLFile: string;
  2592. XMLDocument: TXMLDocument;
  2593. OfflineAutoResponseConfigNode: IXMLNode;
  2594. iLoop: Integer;
  2595. begin
  2596. XMLFile := TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile;
  2597. XMLDocument := TXMLDocument.Create(Self);
  2598. try
  2599. XMLDocument.Active := True;
  2600. if not FileExists(XMLFile) then
  2601. begin
  2602. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + OfflineAutoResponseConfigXMLFile), PChar(XMLFile), False);
  2603. XMLDocument.Active := True;
  2604. end;
  2605. XMLDocument.LoadFromFile(XMLFile);
  2606. OfflineAutoResponseConfigNode := XMLDocument.DocumentElement;
  2607. OfflineAutoResponseConfigNode.ChildNodes.Clear;
  2608. for iLoop := 0 to FOfflineAutoResponseTexts.Count - 1 do
  2609. begin
  2610. OfflineAutoResponseConfigNode.AddChild('Text').Text := FOfflineAutoResponseTexts.Strings[iLoop];
  2611. end;
  2612. finally
  2613. XMLDocument.SaveToFile();
  2614. XMLDocument.Free;
  2615. end;
  2616. end;
  2617. //------------------------------------------------------------------------------
  2618. procedure TMainForm.LoadHintAndSoundConfigs;
  2619. var
  2620. XMLFile: string;
  2621. XMLDocument: TXMLDocument;
  2622. HintAndSoundConfigNode: IXMLNode;
  2623. begin
  2624. XMLFile := TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile;
  2625. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2626. XMLDocument := TXMLDocument.Create(Self);
  2627. try
  2628. XMLDocument.Active := True;
  2629. if not FileExists(XMLFile) then
  2630. begin
  2631. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HintAndSoundConfigXMLFile), PChar(XMLFile), False);
  2632. XMLDocument.Active := True;
  2633. end;
  2634. XMLDocument.LoadFromFile(XMLFile);
  2635. HintAndSoundConfigNode := XMLDocument.DocumentElement;
  2636. FFlashCaptionOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('FlashCaptionOnOnline').Attributes['Value'];
  2637. FFlashCaptionOnOnline := False;
  2638. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  2639. FShowHintOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOnline').Attributes['Value'];
  2640. FShowHintOnOffline := HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOffline').Attributes['Value'];
  2641. FDontShowHintOnBusy := HintAndSoundConfigNode.ChildNodes.FindNode('DontShowHintOnBusy').Attributes['Value'];
  2642. FPlaySoundOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['Value'];
  2643. FPlaySoundOnOffline := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['Value'];
  2644. FPlaySoundOnGetMessage := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['Value'];
  2645. FPlaySoundOnGetSystemMessage := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['Value'];
  2646. FFlashImageOnGetMessage := HintAndSoundConfigNode.ChildNodes.FindNode('FlashImageOnGetMessage').Attributes['Value'];
  2647. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow')) then
  2648. begin
  2649. HintAndSoundConfigNode.AddChild('ShowShakeWindow').Attributes['Value'] := True;
  2650. XMLDocument.SaveToFile();
  2651. end;
  2652. FShowShakeWindow := HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow').Attributes['Value'];
  2653. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage')) then
  2654. begin
  2655. HintAndSoundConfigNode.AddChild('ShowCustomMessage').Attributes['Value'] := True;
  2656. XMLDocument.SaveToFile();
  2657. end;
  2658. FShowCustomMessage := HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage').Attributes['Value'];
  2659. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted')) then
  2660. begin
  2661. HintAndSoundConfigNode.AddChild('ShowFileTransCompleted').Attributes['Value'] := True;
  2662. XMLDocument.SaveToFile();
  2663. end;
  2664. FShowFileTransCompleted := HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted').Attributes['Value'];
  2665. FOnlineEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['File'];
  2666. FOfflineEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['File'];
  2667. FMessageEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['File'];
  2668. FSystemMessageEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['File'];
  2669. if AnsiSameText(Copy(FOnlineEventSound, 1, 5), 'Sound') then
  2670. FOnlineEventSound := ExtractFilePath(paramstr(0)) + FOnlineEventSound;
  2671. if AnsiSameText(Copy(FOfflineEventSound, 1, 5), 'Sound') then
  2672. FOfflineEventSound := ExtractFilePath(paramstr(0)) + FOfflineEventSound;
  2673. if AnsiSameText(Copy(FMessageEventSound, 1, 5), 'Sound') then
  2674. FMessageEventSound := ExtractFilePath(paramstr(0)) + FMessageEventSound;
  2675. if AnsiSameText(Copy(FSystemMessageEventSound, 1, 5), 'Sound') then
  2676. FSystemMessageEventSound := ExtractFilePath(paramstr(0)) + FSystemMessageEventSound;
  2677. finally
  2678. XMLDocument.Free;
  2679. end;
  2680. end;
  2681. //------------------------------------------------------------------------------
  2682. procedure TMainForm.SaveHintAndSoundConfigs;
  2683. var
  2684. XMLFile: string;
  2685. XMLDocument: TXMLDocument;
  2686. HintAndSoundConfigNode: IXMLNode;
  2687. begin
  2688. XMLFile := TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile;
  2689. XMLDocument := TXMLDocument.Create(Self);
  2690. try
  2691. XMLDocument.Active := True;
  2692. if not FileExists(XMLFile) then
  2693. begin
  2694. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HintAndSoundConfigXMLFile), PChar(XMLFile), False);
  2695. XMLDocument.Active := True;
  2696. end;
  2697. XMLDocument.LoadFromFile(XMLFile);
  2698. HintAndSoundConfigNode := XMLDocument.DocumentElement;
  2699. HintAndSoundConfigNode.ChildNodes.FindNode('FlashCaptionOnOnline').Attributes['Value'] := FFlashCaptionOnOnline;
  2700. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  2701. HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOnline').Attributes['Value'] := FShowHintOnOnline;
  2702. HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOffline').Attributes['Value'] := FShowHintOnOffline;
  2703. HintAndSoundConfigNode.ChildNodes.FindNode('DontShowHintOnBusy').Attributes['Value'] := FDontShowHintOnBusy;
  2704. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['Value'] := FPlaySoundOnOnline;
  2705. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['Value'] := FPlaySoundOnOffline;
  2706. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['Value'] := FPlaySoundOnGetMessage;
  2707. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['Value'] := FPlaySoundOnGetSystemMessage;
  2708. HintAndSoundConfigNode.ChildNodes.FindNode('FlashImageOnGetMessage').Attributes['Value'] := FFlashImageOnGetMessage;
  2709. HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow').Attributes['Value'] := FShowShakeWindow;
  2710. HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage').Attributes['Value'] := FShowCustomMessage;
  2711. HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted').Attributes['Value'] := FShowFileTransCompleted;
  2712. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['File'] := FOnlineEventSound;
  2713. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['File'] := FOfflineEventSound;
  2714. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['File'] := FMessageEventSound;
  2715. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['File'] := FSystemMessageEventSound;
  2716. XMLDocument.SaveToFile();
  2717. finally
  2718. XMLDocument.Free;
  2719. end;
  2720. end;
  2721. //------------------------------------------------------------------------------
  2722. procedure TMainForm.LoadHotKeyConfigs;
  2723. var
  2724. XMLFile: string;
  2725. XMLDocument: TXMLDocument;
  2726. HotKeyConfigNode: IXMLNode;
  2727. begin
  2728. XMLFile := TRealICQClient.GetUserDir + HotKeyConfigXMLFile;
  2729. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2730. XMLDocument := TXMLDocument.Create(Self);
  2731. try
  2732. XMLDocument.Active := True;
  2733. if not FileExists(XMLFile) then
  2734. begin
  2735. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HotKeyConfigXMLFile), PChar(XMLFile), False);
  2736. XMLDocument.Active := True;
  2737. end;
  2738. XMLDocument.LoadFromFile(XMLFile);
  2739. HotKeyConfigNode := XMLDocument.DocumentElement;
  2740. ReadMessageHotKey := HotKeyConfigNode.ChildNodes.FindNode('ReadMessage').Attributes['Key'];
  2741. CopyScreenHotKey := HotKeyConfigNode.ChildNodes.FindNode('CopyScreen').Attributes['Key'];
  2742. finally
  2743. XMLDocument.Free;
  2744. end;
  2745. end;
  2746. //------------------------------------------------------------------------------
  2747. procedure TMainForm.SaveHotKeyConfigs;
  2748. var
  2749. XMLFile: string;
  2750. XMLDocument: TXMLDocument;
  2751. HotKeyConfigNode: IXMLNode;
  2752. begin
  2753. XMLFile := TRealICQClient.GetUserDir + HotKeyConfigXMLFile;
  2754. XMLDocument := TXMLDocument.Create(Self);
  2755. try
  2756. XMLDocument.Active := True;
  2757. if not FileExists(XMLFile) then
  2758. begin
  2759. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HotKeyConfigXMLFile), PChar(XMLFile), False);
  2760. XMLDocument.Active := True;
  2761. end;
  2762. XMLDocument.LoadFromFile(XMLFile);
  2763. HotKeyConfigNode := XMLDocument.DocumentElement;
  2764. HotKeyConfigNode.ChildNodes.FindNode('ReadMessage').Attributes['Key'] := FReadMessageHotKey;
  2765. HotKeyConfigNode.ChildNodes.FindNode('CopyScreen').Attributes['Key'] := FCopyScreenHotKey;
  2766. XMLDocument.SaveToFile();
  2767. finally
  2768. XMLDocument.Free;
  2769. end;
  2770. end;
  2771. procedure TMainForm.SetCopyScreenHotKey(Value: string);
  2772. var
  2773. HotKeyStr: string;
  2774. HotKey, ModKey: Cardinal;
  2775. begin
  2776. if FCopyScreenHotKey = Value then
  2777. Exit;
  2778. FCopyScreenHotKey := Value;
  2779. if AnsiPos('+', FCopyScreenHotKey) <= 0 then
  2780. FCopyScreenHotKey := 'CTRL+ALT+S';
  2781. HotKeyStr := CutOffString(trim(FCopyScreenHotKey), '+');
  2782. if AnsiPos('+', HotKeyStr) > 0 then
  2783. HotKeyStr := CutOffString(HotKeyStr, '+');
  2784. HotKey := Ord(PChar(UpperCase(HotKeyStr))[0]);
  2785. if HotKeyID_CopyScreen <> 0 then
  2786. begin
  2787. UnregisterHotKey(Handle, HotKeyID_CopyScreen);
  2788. DeleteAtom(HotKeyID_CopyScreen);
  2789. end;
  2790. if (FindAtom('FCopyScreenHotKey') = 0) and (HotKey > 0) then
  2791. begin
  2792. HotKeyID_CopyScreen := GlobalAddAtom(pchar('FCopyScreenHotKey')) - $C000;
  2793. ModKey := GetModKey(FCopyScreenHotKey);
  2794. if (not RegisterHotkey(Handle, HotKeyID_CopyScreen, ModKey, HotKey)) then
  2795. begin
  2796. FCanAlert := True;
  2797. ShowNotifyAlertForm('热键 ' + FCopyScreenHotKey + ' 冲突!');
  2798. FCanAlert := False;
  2799. end;
  2800. //MessageBox(Handle, PChar('热键 '+ FCopyScreenHotKey + ' 已被其它程序注册,请选择其它热键!'), '提示', MB_ICONERROR);
  2801. end;
  2802. SaveHotKeyConfigs;
  2803. end;
  2804. //------------------------------------------------------------------------------
  2805. procedure TMainForm.SetReadMessageHotKey(Value: string);
  2806. var
  2807. HotKeyStr: string;
  2808. HotKey, ModKey: Cardinal;
  2809. begin
  2810. if FReadMessageHotKey = Value then
  2811. Exit;
  2812. FReadMessageHotKey := Value;
  2813. if AnsiPos('+', FReadMessageHotKey) <= 0 then
  2814. FReadMessageHotKey := 'CTRL+ALT+X';
  2815. HotKeyStr := CutOffString(trim(FReadMessageHotKey), '+');
  2816. if AnsiPos('+', HotKeyStr) > 0 then
  2817. HotKeyStr := CutOffString(HotKeyStr, '+');
  2818. HotKey := Ord(PChar(UpperCase(HotKeyStr))[0]);
  2819. if HotKeyID_ReadMessage <> 0 then
  2820. begin
  2821. UnregisterHotKey(Handle, HotKeyID_ReadMessage);
  2822. DeleteAtom(HotKeyID_ReadMessage);
  2823. end;
  2824. if (FindAtom('FReadMessageHotKey') = 0) and (HotKey > 0) then
  2825. begin
  2826. HotKeyID_ReadMessage := GlobalAddAtom(pchar('FReadMessageHotKey')) - $C000;
  2827. ModKey := GetModKey(FReadMessageHotKey);
  2828. if (not RegisterHotkey(Handle, HotKeyID_ReadMessage, ModKey, HotKey)) then
  2829. begin
  2830. FCanAlert := True;
  2831. ShowNotifyAlertForm('热键 ' + FReadMessageHotKey + ' 冲突!');
  2832. FCanAlert := False;
  2833. end;
  2834. //MessageBox(Handle, PChar('热键 ' + FReadMessageHotKey + ' 已被其它程序注册,请选择其它热键!'), '提示', MB_ICONERROR);
  2835. end;
  2836. SaveHotKeyConfigs;
  2837. end;
  2838. //------------------------------------------------------------------------------
  2839. procedure TMainForm.LoadStyleConfigs;
  2840. var
  2841. XMLFile: string;
  2842. XMLDocument: TXMLDocument;
  2843. StyleConfigNode: IXMLNode;
  2844. iLoop: Integer;
  2845. RealICQContacterListView: TRealICQContacterListView;
  2846. RealICQContacterTreeView: TRealICQContacterTreeView;
  2847. AUIMainColor: TColor;
  2848. ALVStyle: TRealICQContacterListItemStyle;
  2849. ALVCaptionStyle: TRealICQContacterListItemCaptionStyle;
  2850. AShowTree: Boolean;
  2851. ASkinName, OldSkinName: string;
  2852. begin
  2853. XMLFile := TRealICQClient.GetUserDir + StyleConfigXMLFile;
  2854. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2855. XMLDocument := TXMLDocument.Create(Self);
  2856. try
  2857. XMLDocument.Active := True;
  2858. if not FileExists(XMLFile) then
  2859. begin
  2860. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + StyleConfigXMLFile), PChar(XMLFile), False);
  2861. XMLDocument.Active := True;
  2862. end;
  2863. XMLDocument.LoadFromFile(XMLFile);
  2864. StyleConfigNode := XMLDocument.DocumentElement;
  2865. OldSkinName := SkinName;
  2866. try
  2867. ASkinName := StyleConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'];
  2868. if ASkinName <> SkinName then
  2869. begin
  2870. SkinName := ASkinName;
  2871. SaveDefaultConfigs;
  2872. ChangeUIColor(UIMainColor);
  2873. end;
  2874. except
  2875. SkinName := OldSkinName;
  2876. end;
  2877. AUIMainColor := StyleConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'];
  2878. ChangeUIColor(FUIMainColor);
  2879. FUIMainColor := AUIMainColor;
  2880. SaveDefaultConfigs;
  2881. if not Assigned(StyleConfigNode.ChildNodes.FindNode('ShowTree')) then
  2882. begin
  2883. StyleConfigNode.AddChild('ShowTree').Attributes['Value'] := True;
  2884. XMLDocument.SaveToFile();
  2885. end;
  2886. AShowTree := StyleConfigNode.ChildNodes.FindNode('ShowTree').Attributes['Value'];
  2887. FShowTree := AShowTree;
  2888. actShowTree.Checked := FShowTree;
  2889. ALVStyle := StyleConfigNode.ChildNodes.FindNode('LVStyle').Attributes['Value'];
  2890. if (RealICQClient.WorkingMode = wmCorporation) or FShowTree then
  2891. begin
  2892. if ALVStyle <> lsNoHeadImage then
  2893. ALVStyle := lsSmallHeadImage;
  2894. end;
  2895. if ALVStyle <> FLVStyle then
  2896. begin
  2897. FLVStyle := ALVStyle;
  2898. for iLoop := 0 to FContacterListViews.Count - 1 do
  2899. begin
  2900. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  2901. RealICQContacterListView.Style := FLVStyle;
  2902. end;
  2903. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  2904. begin
  2905. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  2906. RealICQContacterTreeView.Style := FLVStyle;
  2907. end;
  2908. end;
  2909. ALVCaptionStyle := StyleConfigNode.ChildNodes.FindNode('LVCaptionStyle').Attributes['Value'];
  2910. if ALVCaptionStyle <> FLVCaptionStyle then
  2911. begin
  2912. FLVCaptionStyle := ALVCaptionStyle;
  2913. for iLoop := 0 to FContacterListViews.Count - 1 do
  2914. begin
  2915. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  2916. RealICQContacterListView.CaptionStyle := FLVCaptionStyle;
  2917. end;
  2918. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  2919. begin
  2920. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  2921. RealICQContacterTreeView.CaptionStyle := FLVCaptionStyle;
  2922. end;
  2923. end;
  2924. FShowGIFInMailForm := StyleConfigNode.ChildNodes.FindNode('ShowGIFInMailForm').Attributes['Value'];
  2925. actShowGIFInMailForm.Checked := FShowGIFInMailForm;
  2926. FShowGIFInTalkingForm := StyleConfigNode.ChildNodes.FindNode('ShowGIFInTalkingForm').Attributes['Value'];
  2927. actShowGIFInTalkingForm.Checked := FShowGIFInTalkingForm;
  2928. FShowStrangers := not StyleConfigNode.ChildNodes.FindNode('ShowStrangers').Attributes['Value'];
  2929. if (RealICQClient.WorkingMode = wmCorporation) then
  2930. FShowStrangers := True;
  2931. actShowStrangers.Enabled := True;
  2932. actShowStrangers.Execute;
  2933. FShowBlacklists := not StyleConfigNode.ChildNodes.FindNode('ShowBlacklists').Attributes['Value'];
  2934. if (RealICQClient.WorkingMode = wmCorporation) then
  2935. FShowBlacklists := True;
  2936. actShowBlacklists.Enabled := True;
  2937. actShowBlacklists.Execute;
  2938. FShowTeams := not StyleConfigNode.ChildNodes.FindNode('ShowTeams').Attributes['Value'];
  2939. actShowTeams.Enabled := True;
  2940. actShowTeams.Execute;
  2941. FShowLatests := not StyleConfigNode.ChildNodes.FindNode('ShowLatests').Attributes['Value'];
  2942. actShowLatests.Enabled := True;
  2943. actShowLatests.Execute;
  2944. FTalkingFormAlwaysOnTop := StyleConfigNode.ChildNodes.FindNode('TalkingFormAlwaysOnTop').Attributes['Value'];
  2945. FCtrlEnterSendMessage := StyleConfigNode.ChildNodes.FindNode('CtrlEnterSendMessage').Attributes['Value'];
  2946. if not Assigned(StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm')) then
  2947. begin
  2948. StyleConfigNode.AddChild('CopyScreenHideTalkForm').Attributes['Value'] := False;
  2949. XMLDocument.SaveToFile();
  2950. end;
  2951. FCopyScreenHideTalkForm := StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm').Attributes['Value'];
  2952. finally
  2953. XMLDocument.Free;
  2954. end;
  2955. end;
  2956. //------------------------------------------------------------------------------
  2957. procedure TMainForm.SaveStyleConfigs;
  2958. var
  2959. XMLFile: string;
  2960. XMLDocument: TXMLDocument;
  2961. StyleConfigNode: IXMLNode;
  2962. begin
  2963. XMLFile := TRealICQClient.GetUserDir + StyleConfigXMLFile;
  2964. XMLDocument := TXMLDocument.Create(Self);
  2965. try
  2966. XMLDocument.Active := True;
  2967. if not FileExists(XMLFile) then
  2968. begin
  2969. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + StyleConfigXMLFile), PChar(XMLFile), False);
  2970. XMLDocument.Active := True;
  2971. end;
  2972. XMLDocument.LoadFromFile(XMLFile);
  2973. StyleConfigNode := XMLDocument.DocumentElement;
  2974. StyleConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'] := SkinName;
  2975. StyleConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'] := FUIMainColor;
  2976. StyleConfigNode.ChildNodes.FindNode('ShowTree').Attributes['Value'] := FShowTree;
  2977. StyleConfigNode.ChildNodes.FindNode('LVStyle').Attributes['Value'] := FLVStyle;
  2978. StyleConfigNode.ChildNodes.FindNode('LVCaptionStyle').Attributes['Value'] := FLVCaptionStyle;
  2979. StyleConfigNode.ChildNodes.FindNode('ShowStrangers').Attributes['Value'] := FShowStrangers;
  2980. StyleConfigNode.ChildNodes.FindNode('ShowBlacklists').Attributes['Value'] := FShowBlacklists;
  2981. StyleConfigNode.ChildNodes.FindNode('ShowTeams').Attributes['Value'] := FShowTeams;
  2982. StyleConfigNode.ChildNodes.FindNode('ShowLatests').Attributes['Value'] := FShowLatests;
  2983. StyleConfigNode.ChildNodes.FindNode('ShowGIFInMailForm').Attributes['Value'] := FShowGIFInMailForm;
  2984. StyleConfigNode.ChildNodes.FindNode('ShowGIFInTalkingForm').Attributes['Value'] := FShowGIFInTalkingForm;
  2985. StyleConfigNode.ChildNodes.FindNode('TalkingFormAlwaysOnTop').Attributes['Value'] := False;
  2986. StyleConfigNode.ChildNodes.FindNode('CtrlEnterSendMessage').Attributes['Value'] := FCtrlEnterSendMessage;
  2987. StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm').Attributes['Value'] := FCopyScreenHideTalkForm;
  2988. XMLDocument.SaveToFile();
  2989. finally
  2990. XMLDocument.Free;
  2991. end;
  2992. end;
  2993. //------------------------------------------------------------------------------
  2994. procedure TMainForm.LoadAutoUpdateConfigs;
  2995. var
  2996. XMLFile: string;
  2997. XMLDocument: TXMLDocument;
  2998. AutoUpdateConfigNode: IXMLNode;
  2999. begin
  3000. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + AutoUpdateConfigXMLFile;
  3001. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3002. XMLDocument := TXMLDocument.Create(Self);
  3003. try
  3004. XMLDocument.Active := True;
  3005. XMLDocument.LoadFromFile(XMLFile);
  3006. AutoUpdateConfigNode := XMLDocument.DocumentElement;
  3007. FAutoUpdate := AutoUpdateConfigNode.ChildNodes.FindNode('AutoUpdate').Attributes['Value'];
  3008. finally
  3009. XMLDocument.Free;
  3010. end;
  3011. end;
  3012. //------------------------------------------------------------------------------
  3013. procedure TMainForm.SaveAutoUpdateConfigs;
  3014. var
  3015. XMLFile: string;
  3016. XMLDocument: TXMLDocument;
  3017. AutoUpdateConfigNode: IXMLNode;
  3018. begin
  3019. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + AutoUpdateConfigXMLFile;
  3020. XMLDocument := TXMLDocument.Create(Self);
  3021. try
  3022. XMLDocument.Active := True;
  3023. XMLDocument.LoadFromFile(XMLFile);
  3024. AutoUpdateConfigNode := XMLDocument.DocumentElement;
  3025. AutoUpdateConfigNode.ChildNodes.FindNode('AutoUpdate').Attributes['Value'] := FAutoUpdate;
  3026. XMLDocument.SaveToFile();
  3027. finally
  3028. XMLDocument.Free;
  3029. end;
  3030. end;
  3031. //------------------------------------------------------------------------------
  3032. procedure TMainForm.LoadDefaultConfigs;
  3033. var
  3034. XMLFile: string;
  3035. XMLDocument: TXMLDocument;
  3036. DefaultConfigNode: IXMLNode;
  3037. OldSkinName: string;
  3038. BaseTop, BaseLeft: Integer;
  3039. begin
  3040. BaseTop := (Height - ClientHeight) div 2;
  3041. BaseLeft := (Width - ClientWidth) div 2;
  3042. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + DefaultConfigXMLFile;
  3043. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3044. XMLDocument := TXMLDocument.Create(Self);
  3045. try
  3046. XMLDocument.Active := True;
  3047. XMLDocument.LoadFromFile(XMLFile);
  3048. DefaultConfigNode := XMLDocument.DocumentElement;
  3049. FUIMainColor := DefaultConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'];
  3050. OldSkinName := SkinName;
  3051. try
  3052. SkinName := DefaultConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'];
  3053. except
  3054. SkinName := OldSkinName;
  3055. end;
  3056. FShowMainFormOnStart := True; //DefaultConfigNode.ChildNodes.FindNode('ShowMainFormOnStart').Attributes['Value'];
  3057. FMainFormLeft := DefaultConfigNode.ChildNodes.FindNode('MainFormLeft').Attributes['Value'];
  3058. FMainFormTop := DefaultConfigNode.ChildNodes.FindNode('MainFormTop').Attributes['Value'];
  3059. FMainFormWidth := DefaultConfigNode.ChildNodes.FindNode('MainFormWidth').Attributes['Value'];
  3060. FMainFormHeight := DefaultConfigNode.ChildNodes.FindNode('MainFormHeight').Attributes['Value'];
  3061. FTalkingFormLeft := DefaultConfigNode.ChildNodes.FindNode('TalkingFormLeft').Attributes['Value'];
  3062. FTalkingFormTop := DefaultConfigNode.ChildNodes.FindNode('TalkingFormTop').Attributes['Value'];
  3063. FTalkingFormWidth := DefaultConfigNode.ChildNodes.FindNode('TalkingFormWidth').Attributes['Value'];
  3064. FTalkingFormHeight := DefaultConfigNode.ChildNodes.FindNode('TalkingFormHeight').Attributes['Value'];
  3065. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft')) then
  3066. begin
  3067. DefaultConfigNode.AddChild('SMSFormLeft').Attributes['Value'] := -1;
  3068. XMLDocument.SaveToFile();
  3069. end;
  3070. FSMSFormLeft := DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft').Attributes['Value'];
  3071. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormTop')) then
  3072. begin
  3073. DefaultConfigNode.AddChild('SMSFormTop').Attributes['Value'] := -1;
  3074. XMLDocument.SaveToFile();
  3075. end;
  3076. FSMSFormTop := DefaultConfigNode.ChildNodes.FindNode('SMSFormTop').Attributes['Value'];
  3077. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth')) then
  3078. begin
  3079. DefaultConfigNode.AddChild('SMSFormWidth').Attributes['Value'] := -1;
  3080. XMLDocument.SaveToFile();
  3081. end;
  3082. FSMSFormWidth := DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth').Attributes['Value'];
  3083. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight')) then
  3084. begin
  3085. DefaultConfigNode.AddChild('SMSFormHeight').Attributes['Value'] := -1;
  3086. XMLDocument.SaveToFile();
  3087. end;
  3088. FSMSFormHeight := DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight').Attributes['Value'];
  3089. if FMainFormHeight <= 0 then
  3090. FMainFormHeight := Round(Screen.WorkAreaHeight * 0.8);
  3091. if FMainFormWidth <= 0 then
  3092. FMainFormWidth := 258;
  3093. if (FMainFormLeft + FMainFormWidth - BaseLeft < 2) then
  3094. FMainFormLeft := 0;
  3095. if (FMainFormLeft - BaseLeft > Screen.WorkAreaWidth - 2) then
  3096. FMainFormLeft := Screen.WorkAreaWidth - FMainFormWidth;
  3097. if (FMainFormTop + FMainFormHeight - BaseTop < 2) then
  3098. FMainFormTop := 0;
  3099. if (FMainFormTop > Screen.WorkAreaHeight) then
  3100. FMainFormTop := 0;
  3101. if FTalkingFormHeight <= 0 then
  3102. FTalkingFormHeight := Round(Screen.WorkAreaHeight * 0.6);
  3103. if FTalkingFormWidth <= 0 then
  3104. FTalkingFormWidth := Round(Screen.WorkAreaWidth * 0.6);
  3105. if (FTalkingFormLeft < 0) or (FTalkingFormLeft > Screen.WorkAreaWidth) then
  3106. FTalkingFormLeft := (Screen.WorkAreaWidth - FTalkingFormWidth) div 2;
  3107. if (FTalkingFormTop < 0) or (FTalkingFormTop > Screen.WorkAreaHeight) then
  3108. FTalkingFormTop := (Screen.WorkAreaHeight - FTalkingFormHeight) div 2;
  3109. if FSMSFormHeight <= 0 then
  3110. FSMSFormHeight := 410;
  3111. if FSMSFormWidth <= 0 then
  3112. FSMSFormWidth := 460;
  3113. if (FSMSFormLeft < 0) or (FSMSFormLeft > Screen.WorkAreaWidth) then
  3114. FSMSFormLeft := (Screen.WorkAreaWidth - FSMSFormWidth) div 2;
  3115. if (FSMSFormTop < 0) or (FSMSFormTop > Screen.WorkAreaHeight) then
  3116. FSMSFormTop := (Screen.WorkAreaHeight - FSMSFormHeight) div 2;
  3117. Left := FMainFormLeft;
  3118. Top := FMainFormTop;
  3119. Width := FMainFormWidth;
  3120. Height := FMainFormHeight;
  3121. FAlwaysOnTop := not DefaultConfigNode.ChildNodes.FindNode('AlwaysOnTop').Attributes['Value'];
  3122. actAlwaysOnTop.Enabled := True;
  3123. actAlwaysOnTop.Execute;
  3124. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm')) then
  3125. begin
  3126. DefaultConfigNode.AddChild('AutoHideMainForm').Attributes['Value'] := True;
  3127. XMLDocument.SaveToFile();
  3128. end;
  3129. FAutoHide := DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm').Attributes['Value'];
  3130. CheckWindowPositon;
  3131. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage')) then
  3132. begin
  3133. DefaultConfigNode.AddChild('AutoShowRequestMessage').Attributes['Value'] := False;
  3134. XMLDocument.SaveToFile();
  3135. end;
  3136. FAutoShowRequestMessage := DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage').Attributes['Value'];
  3137. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile')) then
  3138. begin
  3139. DefaultConfigNode.AddChild('ConfirmSendOfflineFile').Attributes['Value'] := True;
  3140. XMLDocument.SaveToFile();
  3141. end;
  3142. FConfirmSendOfflineFile := DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile').Attributes['Value'];
  3143. finally
  3144. XMLDocument.Free;
  3145. end;
  3146. end;
  3147. procedure TMainForm.CheckWindowPositon;
  3148. var
  3149. BaseTop, BaseLeft: Integer;
  3150. begin
  3151. BaseTop := (Height - ClientHeight) div 2;
  3152. BaseLeft := (Width - ClientWidth) div 2;
  3153. if (Left <= -BaseLeft) then
  3154. begin
  3155. FHidePosition := hpLeft;
  3156. Top := -BaseTop;
  3157. Left := -BaseLeft;
  3158. Height := Screen.WorkAreaHeight + BaseTop * 2;
  3159. end
  3160. else if ((Left + Width) >= (Screen.WorkAreaWidth + BaseLeft)) then
  3161. begin
  3162. FHidePosition := hpRight;
  3163. Top := -BaseTop;
  3164. Left := Screen.WorkAreaWidth - Width + BaseLeft;
  3165. Height := Screen.WorkAreaHeight + BaseTop * 2;
  3166. end
  3167. else if (Top <= -BaseTop) then
  3168. begin
  3169. FHidePosition := hpTop;
  3170. Top := -BaseTop;
  3171. end
  3172. else if (Top > -BaseTop) and (Left > -BaseLeft) and ((Left + Width) < (Screen.WorkAreaWidth + BaseLeft)) then
  3173. begin
  3174. FHidePosition := hpNone;
  3175. end;
  3176. if TimerForHideMainForm <> nil then
  3177. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  3178. end;
  3179. //------------------------------------------------------------------------------
  3180. procedure TMainForm.SaveDefaultConfigs;
  3181. var
  3182. XMLFile: string;
  3183. XMLDocument: TXMLDocument;
  3184. DefaultConfigNode: IXMLNode;
  3185. begin
  3186. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + DefaultConfigXMLFile;
  3187. XMLDocument := TXMLDocument.Create(Self);
  3188. try
  3189. XMLDocument.Active := True;
  3190. XMLDocument.LoadFromFile(XMLFile);
  3191. DefaultConfigNode := XMLDocument.DocumentElement;
  3192. DefaultConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'] := SkinName;
  3193. DefaultConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'] := FUIMainColor;
  3194. DefaultConfigNode.ChildNodes.FindNode('AlwaysOnTop').Attributes['Value'] := False;
  3195. DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm').Attributes['Value'] := FAutoHide;
  3196. DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage').Attributes['Value'] := FAutoShowRequestMessage;
  3197. DefaultConfigNode.ChildNodes.FindNode('ShowMainFormOnStart').Attributes['Value'] := True;
  3198. try
  3199. DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile').Attributes['Value'] := FConfirmSendOfflineFile;
  3200. except
  3201. end;
  3202. DefaultConfigNode.ChildNodes.FindNode('MainFormLeft').Attributes['Value'] := FMainFormLeft;
  3203. DefaultConfigNode.ChildNodes.FindNode('MainFormTop').Attributes['Value'] := FMainFormTop;
  3204. DefaultConfigNode.ChildNodes.FindNode('MainFormWidth').Attributes['Value'] := FMainFormWidth;
  3205. DefaultConfigNode.ChildNodes.FindNode('MainFormHeight').Attributes['Value'] := FMainFormHeight;
  3206. DefaultConfigNode.ChildNodes.FindNode('TalkingFormLeft').Attributes['Value'] := FTalkingFormLeft;
  3207. DefaultConfigNode.ChildNodes.FindNode('TalkingFormTop').Attributes['Value'] := FTalkingFormTop;
  3208. DefaultConfigNode.ChildNodes.FindNode('TalkingFormWidth').Attributes['Value'] := FTalkingFormWidth;
  3209. DefaultConfigNode.ChildNodes.FindNode('TalkingFormHeight').Attributes['Value'] := FTalkingFormHeight;
  3210. DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft').Attributes['Value'] := FSMSFormLeft;
  3211. DefaultConfigNode.ChildNodes.FindNode('SMSFormTop').Attributes['Value'] := FSMSFormTop;
  3212. DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth').Attributes['Value'] := FSMSFormWidth;
  3213. DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight').Attributes['Value'] := FSMSFormHeight;
  3214. XMLDocument.SaveToFile();
  3215. finally
  3216. XMLDocument.Free;
  3217. end;
  3218. end;
  3219. //------------------------------------------------------------------------------
  3220. procedure TMainForm.LoadGroupConfig;
  3221. var
  3222. XMLDocument: TXMLDocument;
  3223. ServerConfigNode: IXMLNode;
  3224. begin
  3225. XMLDocument := TXMLDocument.Create(Self);
  3226. try
  3227. XMLDocument.Active := True;
  3228. if csDesigning in ComponentState then
  3229. exit;
  3230. XMLDocument.LoadFromFile(ExtractFilePath(Application.ExeName) + ConfigXMLFilePath + 'GroupServerConfig.xml');
  3231. ServerConfigNode := XMLDocument.DocumentElement;
  3232. FGroupAddress := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['Address'];
  3233. FGroupPort := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['Port'];
  3234. FGroupImagePort := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['ImagePort'];
  3235. FGroupShareAddress := ServerConfigNode.ChildNodes.FindNode('GroupShareServer').Attributes['Address'];
  3236. FGroupSharePort := ServerConfigNode.ChildNodes.FindNode('GroupShareServer').Attributes['Port'];
  3237. except
  3238. on E: Exception do
  3239. begin
  3240. Error(E.Message, 'TMainForm.LoadGroupConfig');
  3241. XMLDocument.Free;
  3242. end;
  3243. end;
  3244. XMLDocument.Free;
  3245. end;
  3246. procedure TMainForm.LoadGroupConfigs;
  3247. var
  3248. XMLFile: string;
  3249. XMLDocument: TXMLDocument;
  3250. GroupConfigNode, GroupListNode, GroupNode: IXMLNode;
  3251. GroupMembers: TStringList;
  3252. iLoop, jLoop: Integer;
  3253. begin
  3254. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  3255. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3256. XMLDocument := TXMLDocument.Create(Self);
  3257. try
  3258. XMLDocument.Active := True;
  3259. if not FileExists(XMLFile) then
  3260. begin
  3261. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  3262. XMLDocument.Active := True;
  3263. end;
  3264. XMLDocument.LoadFromFile(XMLFile);
  3265. GroupConfigNode := XMLDocument.DocumentElement;
  3266. FShowGroup := GroupConfigNode.ChildNodes.FindNode('ShowGroup').Attributes['Value'];
  3267. actShowGroup.Checked := FShowGroup;
  3268. GroupListNode := GroupConfigNode.ChildNodes.FindNode('Groups');
  3269. FGroups.Clear;
  3270. for iLoop := 0 to GroupListNode.ChildNodes.Count - 1 do
  3271. begin
  3272. GroupNode := GroupListNode.ChildNodes[iLoop];
  3273. GroupMembers := TStringList.Create;
  3274. for jLoop := 0 to GroupNode.ChildNodes.Count - 1 do
  3275. begin
  3276. GroupMembers.Add(GroupNode.ChildNodes[jLoop].Text);
  3277. end;
  3278. FGroups.InsertObject(GroupNode.Attributes['Position'], GroupNode.Attributes['Name'], GroupMembers);
  3279. end;
  3280. except
  3281. on E: Exception do
  3282. begin
  3283. Error(E.Message, 'TMainForm.LoadGroupConfigs');
  3284. XMLDocument.Free;
  3285. end;
  3286. end;
  3287. XMLDocument.Free;
  3288. end;
  3289. //------------------------------------------------------------------------------
  3290. procedure TMainForm.miMoveToStrangersClick(Sender: TObject);
  3291. {var
  3292. GroupIndex, iLoop: Integer;
  3293. GroupName: String;
  3294. ListView: TRealICQContacterListView;
  3295. ListItem: TRealICQContacterListItem;
  3296. ItemIndex: Integer;
  3297. RealICQContacterTreeView: TRealICQContacterTreeView;
  3298. Employee: TRealICQEmployee; }
  3299. begin
  3300. { if MessageBox(Handle,
  3301. '确实要将选中的用户移至陌生人中吗?',
  3302. '确认',
  3303. MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then Exit;
  3304. GroupName :='陌生人';// navForContacters.Groups[navForContacters.ActiveGroupIndex];
  3305. if (GroupName = lvStrangers)then exit;
  3306. if GroupName = LVMyContacters then
  3307. begin
  3308. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3309. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3310. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  3311. RealICQClient.MoveToStrangers(Employee.LoginName);
  3312. Exit;
  3313. end;
  3314. GroupIndex := FContacterListViews.IndexOf(GroupName);
  3315. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  3316. ListView.DisableAlign;
  3317. try
  3318. for iLoop := ListView.Items.Count - 1 downto 0 do
  3319. begin
  3320. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  3321. if ListItem.Selected then
  3322. begin
  3323. RealICQClient.MoveToStrangers(ListItem.LoginName);
  3324. Sleep(15);
  3325. end;
  3326. end;
  3327. finally
  3328. ListView.EnableAlign;
  3329. end;
  3330. }
  3331. end;
  3332. procedure TMainForm.miMuteClick(Sender: TObject);
  3333. begin
  3334. FLoginState := stMute;
  3335. FLeaveMessage := '勿扰';
  3336. SetLoginStateControlState;
  3337. end;
  3338. //------------------------------------------------------------------------------
  3339. procedure TMainForm.miOnlineClick(Sender: TObject);
  3340. begin
  3341. FLoginState := stOnline;
  3342. FLeaveMessage := '';
  3343. SetLoginStateControlState;
  3344. end;
  3345. //------------------------------------------------------------------------------
  3346. procedure TMainForm.miOtherStateClick(Sender: TObject);
  3347. var
  3348. LeaveMessage: string;
  3349. begin
  3350. LeaveMessage := Trim(ShowMyInputBox('其它状态', '请输入离开状态说明文字', '', 16));
  3351. if Length(LeaveMessage) > 0 then
  3352. begin
  3353. FLoginState := stLeave;
  3354. FLeaveMessage := LeaveMessage;
  3355. SetLoginStateControlState;
  3356. end;
  3357. end;
  3358. //------------------------------------------------------------------------------
  3359. procedure TMainForm.miMoveToBlacklistsClick(Sender: TObject);
  3360. var
  3361. GroupName: string;
  3362. TreeView: TRealICQContacterTreeView;
  3363. ItemIndex: Integer;
  3364. Friend: TRealICQEmployee;
  3365. Black: TRealICQEmployee;
  3366. begin
  3367. if MessageBox(Handle, '确实要将选中的用户移至黑名单吗?', '确认', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  3368. Exit;
  3369. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  3370. TreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3371. Friend := TreeView.GetSelectedEmployee;
  3372. if Friend = nil then
  3373. Exit;
  3374. Black := TRealICQEmployee.Create(Friend.LoginName);
  3375. Black.BranchID := LvBlackLists;
  3376. Black.DisplayName := Friend.DisplayName;
  3377. GroupName := Friend.BranchID;
  3378. if (GroupName = lvBlacklists) then
  3379. exit;
  3380. if GroupName = LvFriends then
  3381. begin
  3382. RealICQClient.DelFriend(Friend.LoginName);
  3383. RealICQClient.MoveToBlacklists(Friend.LoginName);
  3384. TreeView.AddEmployee(Black);
  3385. end;
  3386. end;
  3387. procedure TMainForm.miSkinClick(Sender: TObject);
  3388. var
  3389. OldSkin: string;
  3390. begin
  3391. OldSkin := SkinName;
  3392. try
  3393. SkinName := (Sender as TMenuItem).Caption;
  3394. ChangeAddFriendFormSkin(SkinName);
  3395. ChangeAddFriendRequestFormSkin(SkinName);
  3396. ChangeTalkingFormSkin(SkinName);
  3397. ChangeSMSFormSkin(SkinName);
  3398. ChangeSystemMessageFormsSkin(SkinName);
  3399. // ChangeSeeUserInformationFormsSkin(SkinName);
  3400. ChangeTeamOptionsFormSkin(SkinName);
  3401. if VideoForm <> nil then
  3402. begin
  3403. VideoForm.SkinName := SkinName;
  3404. VideoForm.ChangeUIColor(VideoForm.TalkingForm.WindowColor);
  3405. end;
  3406. if CreateTeamForm <> nil then
  3407. begin
  3408. CreateTeamForm.SkinName := SkinName;
  3409. CreateTeamForm.ChangeUIColor(UIMainColor);
  3410. end;
  3411. if SearchForm <> nil then
  3412. begin
  3413. SearchForm.SkinName := SkinName;
  3414. SearchForm.ChangeUIColor(UIMainColor);
  3415. end;
  3416. if SearchTeamForm <> nil then
  3417. begin
  3418. SearchTeamForm.SkinName := SkinName;
  3419. SearchTeamForm.ChangeUIColor(UIMainColor);
  3420. end;
  3421. if CustomFacesManagerForm <> nil then
  3422. begin
  3423. CustomFacesManagerForm.SkinName := SkinName;
  3424. CustomFacesManagerForm.ChangeUIColor(UIMainColor);
  3425. end;
  3426. except
  3427. MessageBox(Handle, '加载界面时出错!', '错误', MB_ICONERROR);
  3428. SkinName := OldSkin;
  3429. end;
  3430. ChangeUIColor(UIMainColor);
  3431. PostMessage(Handle, WM_SIZE, 0, 0);
  3432. if RealICQClient.Logined and RealICQClient.Connected then
  3433. SaveStyleConfigs;
  3434. SaveDefaultConfigs;
  3435. end;
  3436. //----------------------------------------------------
  3437. procedure TMainForm.ImageButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  3438. begin
  3439. FHintWindow.ReleaseHandle;
  3440. FHintWindow.Visible := False;
  3441. SetToolBarState(Sender);
  3442. end;
  3443. procedure TMainForm.tsContactersResize(Sender: TObject);
  3444. begin
  3445. { TODO -olqq -c : 注释 2015/1/22 15:30:11 }
  3446. // ScrollBoxContacters.Width := pnlGroups.Width;
  3447. // PnlMoreUser.Width := pnlGroups.Width;
  3448. // ScrollBoxMyFriend.Width := pnlGroups.Width;
  3449. // ScrollBoxTeam.Width := pnlGroups.Width;
  3450. // ScrollBoxLatests.Width := pnlGroups.Width;
  3451. //
  3452. // ScrollBoxContacters.Height := pnlGroups.Height;
  3453. // PnlMoreUser.Height := pnlGroups.Height;
  3454. // ScrollBoxMyFriend.Height := pnlGroups.Height;
  3455. // ScrollBoxTeam.Height := pnlGroups.Height;
  3456. // ScrollBoxLatests.Height := pnlGroups.Height;
  3457. {ScrollBoxContacters.Left := 0;
  3458. PnlMoreUser.Left := ScrollBoxContacters.Left + ScrollBoxContacters.Width;
  3459. ScrollBoxMyFriend.Left := PnlMoreUser.Left + PnlMoreUser.Width;
  3460. ScrollBoxTeam.Left := ScrollBoxMyFriend.Left + ScrollBoxMyFriend.Width;
  3461. ScrollBoxLatests.Left := ScrollBoxTeam.Left + ScrollBoxTeam.Width;}
  3462. end;
  3463. procedure TMainForm.tsContactersShow(Sender: TObject);
  3464. begin
  3465. {ScrollBoxContacters.Visible := True;
  3466. PnlMoreUser.Visible := True;
  3467. ScrollBoxMyFriend.Visible := True;
  3468. ScrollBoxTeam.Visible := True;
  3469. ScrollBoxLatests.Visible := True;}
  3470. { TODO -olqq -c : 注释 2015/1/22 15:33:36 }
  3471. // ScrollBoxContacters.Align := alNone;
  3472. // PnlMoreUser.Align := alNone;
  3473. // ScrollBoxMyFriend.Align := alNone;
  3474. // ScrollBoxTeam.Align := alNone;
  3475. // ScrollBoxLatests.Align := alNone;
  3476. //
  3477. // ScrollBoxContacters.Top := 0;
  3478. // PnlMoreUser.Top := 0;
  3479. // ScrollBoxMyFriend.Top := 0;
  3480. // ScrollBoxTeam.Top := 0;
  3481. // ScrollBoxLatests.Top := 0;
  3482. tsContactersResize(tsContacters);
  3483. end;
  3484. //-----------------------------------------------------
  3485. procedure TMainForm.SetToolBarState(Sender: TObject);
  3486. var
  3487. ImageButton: TRealICQHoverImage;
  3488. TmpImageButton: TRealICQHoverImage;
  3489. TmpImageButtonIcon: TRealICQHoverImage;
  3490. iLoop: Integer;
  3491. OldControl, NewControl: TWinControl;
  3492. ItemIndex, divSize: Integer;
  3493. RealICQContacterTreeView: TRealICQContacterTreeView;
  3494. begin
  3495. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3496. OldControl := nil;
  3497. if ScrollBoxContacters.Visible then
  3498. OldControl := ScrollBoxContacters;
  3499. if PnlMoreUser.Visible then
  3500. OldControl := PnlMoreUser;
  3501. if ScrollBoxMyFriend.Visible then
  3502. OldControl := ScrollBoxMyFriend;
  3503. if ScrollBoxTeam.Visible then
  3504. OldControl := ScrollBoxTeam;
  3505. if ScrollBoxLatests.Visible then
  3506. OldControl := ScrollBoxLatests;
  3507. {if ImageButton.Tag = 2 then
  3508. begin
  3509. if ScrollBoxMoreUser.Tag = 0 then
  3510. begin
  3511. ScrollBoxMoreUser.Tag := 1;
  3512. end;
  3513. end; }
  3514. NewControl := nil;
  3515. if ImageButton.Tag = 1 then
  3516. NewControl := ScrollBoxContacters;
  3517. if ImageButton.Tag = 2 then
  3518. NewControl := PnlMoreUser;
  3519. if ImageButton.Tag = 3 then
  3520. NewControl := ScrollBoxMyFriend;
  3521. if ImageButton.Tag = 4 then
  3522. NewControl := ScrollBoxTeam;
  3523. if ImageButton.Tag = 5 then
  3524. NewControl := ScrollBoxLatests;
  3525. if False and (OldControl <> nil) then
  3526. begin
  3527. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3528. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3529. RealICQContacterTreeView.HideScroll;
  3530. RealICQContacterTreeView.ReDrawAll;
  3531. RealICQContacterTreeView.BeginUpdate;
  3532. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  3533. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3534. RealICQContacterTreeView.HideScroll;
  3535. RealICQContacterTreeView.ReDrawAll;
  3536. RealICQContacterTreeView.BeginUpdate;
  3537. Application.ProcessMessages;
  3538. //Exit;
  3539. NewControl.DisableAlign;
  3540. NewControl.Enabled := False;
  3541. OldControl.DisableAlign;
  3542. OldControl.Enabled := False;
  3543. divSize := pnlGroups.Width div 10;
  3544. try
  3545. if OldControl.Tag < NewControl.Tag then
  3546. begin
  3547. NewControl.Left := OldControl.Left + OldControl.Width;
  3548. NewControl.Visible := True;
  3549. while NewControl.Left > 0 do
  3550. begin
  3551. if NewControl.Left - divSize < 0 then
  3552. begin
  3553. NewControl.Left := 0;
  3554. end
  3555. else
  3556. begin
  3557. OldControl.Left := OldControl.Left - divSize;
  3558. NewControl.Left := NewControl.Left - divSize;
  3559. end;
  3560. Application.ProcessMessages;
  3561. Sleep(10);
  3562. end;
  3563. OldControl.Visible := False;
  3564. end
  3565. else
  3566. begin
  3567. NewControl.Left := OldControl.Left - OldControl.Width;
  3568. NewControl.Visible := True;
  3569. while NewControl.Left < 0 do
  3570. begin
  3571. if NewControl.Left + divSize > 0 then
  3572. begin
  3573. NewControl.Left := 0;
  3574. end
  3575. else
  3576. begin
  3577. OldControl.Left := OldControl.Left + divSize;
  3578. NewControl.Left := NewControl.Left + divSize;
  3579. end;
  3580. Application.ProcessMessages;
  3581. Sleep(10);
  3582. end;
  3583. OldControl.Visible := False;
  3584. end;
  3585. finally
  3586. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3587. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3588. RealICQContacterTreeView.EndUpdate;
  3589. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  3590. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3591. RealICQContacterTreeView.EndUpdate;
  3592. NewControl.EnableAlign;
  3593. NewControl.Enabled := True;
  3594. OldControl.EnableAlign;
  3595. OldControl.Enabled := True;
  3596. end;
  3597. end
  3598. else
  3599. begin
  3600. if OldControl <> nil then
  3601. OldControl.Visible := False;
  3602. NewControl.Left := 0;
  3603. NewControl.Visible := True;
  3604. end;
  3605. pnlTeams.Visible := ImageButton.Tag = 4;
  3606. if pnlTeams.Visible then
  3607. pnlTeams.Height := 22
  3608. else
  3609. pnlTeams.Height := 0;
  3610. {ScrollBoxContacters.Visible := ImageButton.Tag = 1;
  3611. PnlMoreUser.Visible := ImageButton.Tag = 2;
  3612. ScrollBoxMyFriend.Visible := ImageButton.Tag = 3;
  3613. ScrollBoxTeam.Visible := ImageButton.Tag = 4;
  3614. pnlTeams.Visible := ImageButton.Tag = 4;
  3615. if pnlTeams.Visible then
  3616. pnlTeams.Height := 22
  3617. else
  3618. pnlTeams.Height := 0;
  3619. ScrollBoxLatests.Visible := ImageButton.Tag = 5; }
  3620. ActiveButtonTag := ImageButton.Tag;
  3621. for iLoop := 0 to FToolBarButtonList.Count - 1 do
  3622. begin
  3623. TmpImageButton := FToolBarButtonList.Objects[iLoop] as TRealICQHoverImage;
  3624. TmpImageButtonIcon := FToolBarButtonIconList.Objects[iLoop] as TRealICQHoverImage;
  3625. if TmpImageButton.Tag = ImageButton.Tag then
  3626. begin
  3627. TmpImageButton.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\menu\01_On.bmp');
  3628. TmpImageButton.OnMouseUp := nil;
  3629. TmpImageButton.OnMouseEnter := nil;
  3630. TmpImageButton.OnMouseLeave := nil;
  3631. TmpImageButtonIcon.OnMouseUp := nil;
  3632. TmpImageButtonIcon.OnMouseEnter := nil;
  3633. TmpImageButtonIcon.OnMouseLeave := nil;
  3634. end
  3635. else
  3636. begin
  3637. TmpImageButton.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\menu\01_Off.bmp');
  3638. TmpImageButton.OnMouseUp := ImageButtonMouseUp;
  3639. TmpImageButton.OnMouseEnter := ImageButtonEnter;
  3640. TmpImageButton.OnMouseLeave := ImageButtonLeave;
  3641. TmpImageButtonIcon.OnMouseUp := ImageButtonMouseUp;
  3642. TmpImageButtonIcon.OnMouseEnter := ImageButtonEnter;
  3643. TmpImageButtonIcon.OnMouseLeave := ImageButtonLeave;
  3644. end;
  3645. ConvertBitmapToColor(TmpImageButton.Picture.Bitmap, UIMainColor);
  3646. end;
  3647. end;
  3648. //----------------------------
  3649. procedure TMainForm.ImageButtonEnter(Sender: TObject);
  3650. var
  3651. ImageButton: TRealICQHoverImage;
  3652. ImagePath: string;
  3653. procedure OpenHint(HintStr: string);
  3654. var
  3655. TextWidth, TextHeight: Integer;
  3656. rect: TRect;
  3657. begin
  3658. TextWidth := FHintWindow.Canvas.TextWidth(HintStr);
  3659. TextHeight := FHintWindow.Canvas.TextHeight(HintStr);
  3660. rect.Left := Mouse.CursorPos.X;
  3661. rect.Top := Mouse.CursorPos.Y + 20;
  3662. rect.Right := rect.Left + TextWidth + 5;
  3663. rect.Bottom := rect.Top + TextHeight;
  3664. FHintWindow.Color := clInfoBk;
  3665. FHintWindow.ActivateHint(Rect, HintStr);
  3666. FHintWindow.Visible := True;
  3667. end;
  3668. begin
  3669. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3670. ImagePath := ExtractFilePath(Application.ExeName) + 'Images\menu\01_Over.bmp';
  3671. ImageButton.Picture.LoadFromFile(ImagePath);
  3672. ConvertBitmapToColor(ImageButton.Picture.Bitmap, UIMainColor);
  3673. OpenHint(FToolBarButtonList[ImageButton.Tag - 1]);
  3674. end;
  3675. //-----------------------------
  3676. procedure TMainForm.ImageButtonLeave(Sender: TObject);
  3677. var
  3678. ImageButton: TRealICQHoverImage;
  3679. ImagePath: string;
  3680. begin
  3681. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3682. ImagePath := ExtractFilePath(Application.ExeName) + 'Images\menu\01_Off.bmp';
  3683. ImageButton.Picture.LoadFromFile(ImagePath);
  3684. ConvertBitmapToColor(ImageButton.Picture.Bitmap, UIMainColor);
  3685. FHintWindow.ReleaseHandle;
  3686. FHintWindow.Visible := False;
  3687. end;
  3688. procedure TMainForm.miChangeLoginNameClick(Sender: TObject);
  3689. var
  3690. LoginUser: TLoginUser;
  3691. begin
  3692. try
  3693. LoginUser := RealICQClient.LoginedUsers.Objects[(Sender as TMenuItem).Tag] as TLoginUser;
  3694. edPassword.Text := '';
  3695. edLoginName.Text := LoginUser.LoginName;
  3696. if (LoginUser.Password <> '') and (LoginUser.LoginName <> '') then
  3697. begin
  3698. edPassword.Text := RealICQClient.DecyptPassword(LoginUser.Password);
  3699. FSavePassword := True;
  3700. self.ImgLstCheckStates.GetIcon(1, spbSavePassword.Icon);
  3701. end;
  3702. self.lblRemoveMyLoginInfo.Visible := True;
  3703. except
  3704. edLoginName.Text := '';
  3705. end;
  3706. end;
  3707. //------------------------------------------------------------------------------
  3708. procedure TMainForm.miClearLoginHistoryClick(Sender: TObject);
  3709. var
  3710. ClearAll: Boolean;
  3711. begin
  3712. ClearAll := True;
  3713. if UpperCase(Sender.ClassName) = UpperCase('TLabel') then
  3714. ClearAll := False;
  3715. MainForm.RealICQClient.ClearLoginHistory(ClearAll, edLoginName.Text);
  3716. edLoginName.Text := '';
  3717. edPassword.Text := '';
  3718. actLoginAs.Visible := False;
  3719. SetLoginControlsVisible(True);
  3720. end;
  3721. //------------------------------------------------------------------------------
  3722. procedure TMainForm.miColorClick(Sender: TObject);
  3723. begin
  3724. FUIMainColor := (Sender as TMenuItem).Tag;
  3725. ChangeUIColor((Sender as TMenuItem).Tag);
  3726. if RealICQClient.Logined and RealICQClient.Connected then
  3727. SaveStyleConfigs;
  3728. SaveDefaultConfigs;
  3729. end;
  3730. //------------------------------------------------------------------------------
  3731. procedure TMainForm.miHiddenClick(Sender: TObject);
  3732. begin
  3733. FLoginState := stHidden;
  3734. FLeaveMessage := '';
  3735. SetLoginStateControlState;
  3736. end;
  3737. //------------------------------------------------------------------------------
  3738. procedure TMainForm.miMeetingClick(Sender: TObject);
  3739. begin
  3740. FLoginState := stLeave;
  3741. FLeaveMessage := (Sender as TMenuItem).Caption;
  3742. SetLoginStateControlState;
  3743. end;
  3744. //------------------------------------------------------------------------------
  3745. procedure TMainForm.miMoreColorsClick(Sender: TObject);
  3746. begin
  3747. ColorDialog.Color := FUIMainColor;
  3748. if ColorDialog.Execute then
  3749. begin
  3750. ChangeUIColor(ColorDialog.Color);
  3751. FUIMainColor := ColorDialog.Color;
  3752. if RealICQClient.Logined and RealICQClient.Connected then
  3753. SaveStyleConfigs;
  3754. SaveDefaultConfigs;
  3755. end;
  3756. end;
  3757. //------------------------------------------------------------------------------
  3758. procedure TMainForm.miMoveGroupClick(Sender: TObject);
  3759. var
  3760. GroupName, TargetGroupName: string;
  3761. MenuItem: TMenuItem;
  3762. GroupIndex, itemIndex: Integer;
  3763. TreeView: TRealICQContacterTreeView;
  3764. Friend: TRealICQEmployee;
  3765. GroupMembers, TargetGroupMembers: TStringList;
  3766. RealICQUser: TRealICQUser;
  3767. OldScrollBarTop: Integer;
  3768. begin
  3769. MenuItem := Sender as TMenuItem;
  3770. if MenuItem <> nil then
  3771. TargetGroupName := MenuItem.Caption
  3772. else
  3773. TargetGroupName := LVFriends;
  3774. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  3775. TreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3776. Friend := TreeView.GetSelectedEmployee;
  3777. if Friend = nil then
  3778. Exit;
  3779. GroupName := Friend.BranchID;
  3780. OldScrollBarTop := TreeView.ScrollBarTop;
  3781. SetFlashCaptionOnOnlineValue(False);
  3782. LockWindowUpdate(GetDesktopWindow);
  3783. try
  3784. if FGroups.IndexOf(GroupName) >= 0 then
  3785. begin
  3786. GroupIndex := FGroups.IndexOf(GroupName);
  3787. GroupMembers := FGroups.Objects[GroupIndex] as TStringList;
  3788. GroupMembers.Delete(GroupMembers.IndexOf(Friend.LoginName));
  3789. end;
  3790. RealICQUser := Friend.Data;
  3791. TreeView.EmployeeItems.Delete(TreeView.EmployeeItems.IndexOf(Friend.LoginName));
  3792. //在树节点之间移动()
  3793. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  3794. Friend.BranchID := TargetGroupName;
  3795. TreeView.AddEmployee(Friend);
  3796. UpdateFriendNode(Friend, RealICQUser, True);
  3797. if FGroups.IndexOf(TargetGroupName) >= 0 then
  3798. begin
  3799. GroupIndex := FGroups.IndexOf(TargetGroupName);
  3800. TargetGroupMembers := FGroups.Objects[GroupIndex] as TStringList;
  3801. TargetGroupMembers.Add(Friend.LoginName);
  3802. end;
  3803. finally
  3804. TreeView.ScrollBarTop := OldScrollBarTop;
  3805. LockWindowUpdate(0);
  3806. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  3807. SaveGroupConfigs;
  3808. end;
  3809. end;
  3810. //------------------------------------------------------------------------------
  3811. procedure TMainForm.NodeDoubleClick(Employee: TRealICQEmployee);
  3812. var
  3813. SMSForm: TSMSForm;
  3814. begin
  3815. if (pgcMainWorkArea.ActivePage = tsAddrBook) then
  3816. begin
  3817. SMSForm := OpenSMSForm('', True);
  3818. SMSForm.edMobiles.Text := Employee.Mobile;
  3819. Exit;
  3820. end;
  3821. if Employee.Data <> nil then
  3822. begin
  3823. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3824. begin
  3825. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3826. Exit;
  3827. end;
  3828. {if GetActiveTabSheetName=MoreUser then
  3829. begin
  3830. RealICQClient.GetUserInformation(Employee.LoginName,True);
  3831. end; }
  3832. OpenTalkingForm(Employee.LoginName);
  3833. end;
  3834. end;
  3835. //------------------------------------------------------------------------------
  3836. procedure TMainForm.NodeIconButtonClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  3837. var
  3838. RealICQUser: TRealICQUser;
  3839. begin
  3840. if IconButtonType = itHeadImage then
  3841. begin
  3842. HideUserCardForm;
  3843. end;
  3844. if IconButtonType = itSNS then
  3845. begin
  3846. RealICQUser := Employee.Data;
  3847. RealICQUser.ClickedSNSIcon;
  3848. try
  3849. RealICQClientUserInformationReady(RealICQClient, RealICQUser);
  3850. //UpdateEmployeeNode(Employee, RealICQUser, True);
  3851. finally
  3852. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + SNSHomePage, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(RealICQUser.LoginName)])), '', SW_SHOWDEFAULT);
  3853. end;
  3854. end;
  3855. end;
  3856. //------------------------------------------------------------------------------
  3857. procedure TMainForm.NodeIconButtonDblClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  3858. var
  3859. TalkingForm: TTalkingForm;
  3860. iWaitTimes: Integer;
  3861. RealICQUser: TRealICQUser;
  3862. SMSForm: TSMSForm;
  3863. begin
  3864. HideUserCardForm;
  3865. if (pgcMainWorkArea.ActivePage = tsAddrBook) then
  3866. begin
  3867. SMSForm := OpenSMSForm('', True);
  3868. SMSForm.edMobiles.Text := Employee.Mobile;
  3869. Exit;
  3870. end;
  3871. if IconButtonType = itCamera then
  3872. begin
  3873. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3874. begin
  3875. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3876. Exit;
  3877. end;
  3878. TalkingForm := GetTalkingForm(Employee.LoginName);
  3879. if TalkingForm = nil then
  3880. begin
  3881. TalkingForm := OpenTalkingForm(Employee.LoginName, True);
  3882. end;
  3883. iWaitTimes := 0;
  3884. while not TalkingForm.CanWriteMessage do
  3885. begin
  3886. Application.ProcessMessages;
  3887. Inc(iWaitTimes);
  3888. if iWaitTimes > 1000 then
  3889. break;
  3890. Sleep(10);
  3891. end;
  3892. TalkingForm.actVideo.Execute;
  3893. end;
  3894. if IconButtonType = itHeadImage then
  3895. begin
  3896. if pgcMainWorkArea.ActivePage = tsAddrBook then
  3897. Exit;
  3898. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3899. begin
  3900. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3901. Exit;
  3902. end;
  3903. OpenTalkingForm(Employee.LoginName, True);
  3904. end;
  3905. if IconButtonType = itSMS then
  3906. begin
  3907. OpenSMSForm(Employee.LoginName, True);
  3908. end;
  3909. if IconButtonType = itEmail then
  3910. begin
  3911. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(Employee.LoginName);
  3912. if (RealICQUser <> nil) and (RealICQUser.Email <> '') then
  3913. ShellExecute(handle, 'open', PChar('mailto:' + RealICQUser.Email), nil, nil, SW_SHOWNORMAL);
  3914. //AddWebBrowserToPageControl(Format('http://mail.lishui.gov.cn/web_email/module.phtml?module=mcomposef&to=%s', [RealICQUser.Email]), 999);
  3915. //AddWebBrowserToPageControl(Format('http://www.lxtalk.com/rd/', [RealICQUser.Email]), 999);
  3916. end;
  3917. if IconButtonType = itAddFriend then
  3918. begin
  3919. if AnsiSameText(MainForm.RealICQClient.LoginName, Employee.LoginName) then
  3920. begin
  3921. MessageBox(Handle, '不能添加自己为好友', '提示', MB_ICONINFORMATION);
  3922. Exit;
  3923. end;
  3924. ShowAddFriendWindow(Self, Employee.LoginName, Employee.DisplayName);
  3925. end;
  3926. if IconButtonType = itTel then
  3927. begin
  3928. { if not FPCAMessage.GetPCALoginStatus then Exit;
  3929. if (Employee.Mobile<>'') and (Employee.Tel<>'') then
  3930. begin
  3931. MenuItem:=ppSelCallTel.Items[0];
  3932. MenuItem.Hint:=Employee.Mobile+char(10)+Employee.DisplayName;
  3933. MenuItem:=ppSelCallTel.Items[1];
  3934. MenuItem.Hint:=Employee.Tel+char(10)+Employee.DisplayName;
  3935. ppSelCallTel.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y - 50);
  3936. Exit;
  3937. end;
  3938. if Employee.Mobile<>'' then CallNumber:=Employee.Mobile;
  3939. if Employee.Tel<>'' then CallNumber:=Employee.Tel;
  3940. FPCAMessage.SendCallTelOutPCAMessage(CallNumber,Employee.DisplayName);
  3941. }
  3942. end;
  3943. end;
  3944. //------------------------------------------------------------------------------
  3945. procedure TMainForm.miGoSpaceClick(Sender: TObject);
  3946. var
  3947. LoginName: string;
  3948. RealICQUser: TRealICQUser;
  3949. begin
  3950. LoginName := GetSelectedLoginName;
  3951. if LoginName <> '' then
  3952. begin
  3953. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  3954. RealICQUser.ClickedSNSIcon;
  3955. try
  3956. RealICQClientUserInformationReady(RealICQClient, RealICQUser);
  3957. finally
  3958. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + SNSHomePage, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(RealICQUser.LoginName)])), '', SW_SHOWDEFAULT);
  3959. end;
  3960. end;
  3961. end;
  3962. //------------------------------------------------------------------------------
  3963. procedure TMainForm.NodeOnline(Employee: TRealICQEmployee);
  3964. var
  3965. ARealICQUser: TRealICQUser;
  3966. begin
  3967. //MessageBox(Handle, '4', '4', MB_OK);
  3968. if RealICQClient.Me = nil then
  3969. Exit;
  3970. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  3971. Exit;
  3972. //MessageBox(Handle, '5', '5', MB_OK);
  3973. if Employee.Data <> nil then
  3974. begin
  3975. ARealICQUser := TRealICQUser(Employee.Data);
  3976. if ARealICQUser = RealICQClient.Me then
  3977. Exit;
  3978. if PlaySoundOnOnline then
  3979. PlayEventSound(OnlineEventSound);
  3980. if ShowHintOnOnline then
  3981. ShowOnOffAlertForm(ARealICQUser);
  3982. end;
  3983. //MessageBox(Handle, '6', '6', MB_OK);
  3984. end;
  3985. //------------------------------------------------------------------------------
  3986. procedure TMainForm.NodeOffline(Employee: TRealICQEmployee);
  3987. var
  3988. ARealICQUser: TRealICQUser;
  3989. begin
  3990. if RealICQClient.Me = nil then
  3991. Exit;
  3992. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  3993. Exit;
  3994. if Employee.Data <> nil then
  3995. begin
  3996. ARealICQUser := TRealICQUser(Employee.Data);
  3997. if ARealICQUser = RealICQClient.Me then
  3998. Exit;
  3999. if PlaySoundOnOffline then
  4000. PlayEventSound(OfflineEventSound);
  4001. if ShowHintOnOffline then
  4002. ShowOnOffAlertForm(ARealICQUser);
  4003. end;
  4004. end;
  4005. //------------------------------------------------------------------------------
  4006. procedure TMainForm.TimerForHideUserCardTimer(Sender: TObject);
  4007. var
  4008. Rect: TRect;
  4009. begin
  4010. TimerForHideUserCard.Enabled := False;
  4011. if Assigned(UserCardViewForm) then
  4012. begin
  4013. Rect.Left := UserCardViewForm.Left;
  4014. Rect.Top := UserCardViewForm.Top;
  4015. Rect.Right := UserCardViewForm.Left + UserCardViewForm.Width;
  4016. Rect.Bottom := UserCardViewForm.Top + UserCardViewForm.Height;
  4017. if PtInRect(Rect, Mouse.CursorPos) then
  4018. begin
  4019. UserCardViewForm.tmrForClose.Enabled := True;
  4020. Exit;
  4021. end;
  4022. end;
  4023. if not TimerForShowUserCard.Enabled then
  4024. FreeAndNil(UserCardViewForm);
  4025. // TimerForHideUserCard.Enabled := False;
  4026. //
  4027. // if Assigned(UserCardForm) then
  4028. // begin
  4029. // Rect.Left := UserCardForm.Left;
  4030. // Rect.Top := UserCardForm.Top;
  4031. // Rect.Right := UserCardForm.Left + UserCardForm.Width;
  4032. // Rect.Bottom := UserCardForm.Top + UserCardForm.Height;
  4033. // if PtInRect(Rect, Mouse.CursorPos) then
  4034. // begin
  4035. // UserCardForm.TimerForClose.Enabled := True;
  4036. // Exit;
  4037. // end;
  4038. // end;
  4039. // if not TimerForShowUserCard.Enabled then FreeAndNil(UserCardForm);
  4040. end;
  4041. //------------------------------------------------------------------------------
  4042. procedure TMainForm.NodeOnHeadImageMouseEnter(Employee: TRealICQEmployee);
  4043. var
  4044. Rect: TRect;
  4045. P: TPoint;
  4046. begin
  4047. Rect := Employee.Node.DisplayRect(False);
  4048. P.X := Rect.Left;
  4049. P.Y := Rect.Top;
  4050. P := Employee.Node.TreeView.ClientToScreen(P);
  4051. if UserCardForm <> nil then
  4052. begin
  4053. FNeedShowUserCardLoginName := Employee.LoginName;
  4054. FShowUserCardTargetTop := P.Y;
  4055. TimerForShowUserCardTimer(nil);
  4056. end
  4057. else
  4058. begin
  4059. ShowUserCardForm(Employee.LoginName, P.Y);
  4060. end;
  4061. end;
  4062. procedure TMainForm.NodeOnHeadImageMouseLeave(Employee: TRealICQEmployee);
  4063. begin
  4064. HideUserCardForm;
  4065. end;
  4066. procedure TMainForm.ItemOnHeadImageEnter(Item: TRealICQContacterListItem);
  4067. var
  4068. Rect: TRect;
  4069. P: TPoint;
  4070. begin
  4071. Rect := Item.ListView.ListBox.ItemRect(Item.ItemIndex);
  4072. P.X := Rect.Left;
  4073. P.Y := Rect.Top;
  4074. P := Item.ListView.ListBox.ClientToScreen(P);
  4075. if UserCardForm <> nil then
  4076. begin
  4077. FNeedShowUserCardLoginName := Item.LoginName;
  4078. FShowUserCardTargetTop := P.Y;
  4079. TimerForShowUserCardTimer(nil);
  4080. end
  4081. else
  4082. begin
  4083. ShowUserCardForm(Item.LoginName, P.Y);
  4084. end;
  4085. end;
  4086. procedure TMainForm.ItemOnHeadImageLeave(Item: TRealICQContacterListItem);
  4087. begin
  4088. HideUserCardForm;
  4089. end;
  4090. procedure TMainForm.imgHeadImageBorderMouseEnter(Sender: TObject);
  4091. var
  4092. P: TPoint;
  4093. begin
  4094. P.X := 0;
  4095. P.Y := 0;
  4096. P := imgHeadImageBorder.ClientToScreen(P);
  4097. if UserCardForm <> nil then
  4098. begin
  4099. FNeedShowUserCardLoginName := RealICQClient.LoginName;
  4100. FShowUserCardTargetTop := P.Y;
  4101. TimerForShowUserCardTimer(nil);
  4102. end
  4103. else
  4104. begin
  4105. ShowUserCardForm(RealICQClient.LoginName, P.Y);
  4106. end;
  4107. end;
  4108. procedure TMainForm.imgHeadImageBorderMouseLeave(Sender: TObject);
  4109. begin
  4110. HideUserCardForm;
  4111. end;
  4112. procedure TMainForm.ShowUserCardForm(ALoginName: string; ATargetTop: Integer);
  4113. begin
  4114. //FreeAndNil(UserCardForm);
  4115. FNeedShowUserCardLoginName := ALoginName;
  4116. FShowUserCardTargetTop := ATargetTop;
  4117. TimerForShowUserCard.Enabled := False;
  4118. TimerForShowUserCard.Enabled := True;
  4119. TimerForHideUserCard.Enabled := False;
  4120. end;
  4121. procedure TMainForm.HideUserCardForm;
  4122. begin
  4123. if TimerForHideUserCard <> nil then
  4124. begin
  4125. TimerForHideUserCard.Enabled := False;
  4126. TimerForHideUserCard.Enabled := True;
  4127. TimerForShowUserCard.Enabled := False;
  4128. end;
  4129. end;
  4130. //------------------------------------------------------------------------------
  4131. procedure TMainForm.NodeOnMouseEnter(Employee: TRealICQEmployee);
  4132. begin
  4133. end;
  4134. //------------------------------------------------------------------------------
  4135. procedure TMainForm.NodeOnMouseLeave(Employee: TRealICQEmployee);
  4136. begin
  4137. end;
  4138. //------------------------------------------------------------------------------
  4139. procedure TMainForm.ItemOnMouseEnter(Item: TRealICQContacterListItem);
  4140. begin
  4141. //
  4142. end;
  4143. //------------------------------------------------------------------------------
  4144. procedure TMainForm.ItemOnMouseLeave(Item: TRealICQContacterListItem);
  4145. begin
  4146. end;
  4147. //------------------------------------------------------------------------------
  4148. procedure TMainForm.ItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  4149. begin
  4150. if IconButtonType = ltHeadImage then
  4151. begin
  4152. if UserCardForm = nil then
  4153. UserCardForm := TUserCardForm.Create(Self);
  4154. if UserCardForm.Width - 10 >= Left then
  4155. UserCardForm.Left := Left + pnlWorkArea.Width + 20
  4156. else
  4157. UserCardForm.Left := Left - UserCardForm.Width + 10;
  4158. UserCardForm.Top := Mouse.CursorPos.Y - 50;
  4159. UserCardForm.LoginName := Item.LoginName;
  4160. Application.ProcessMessages;
  4161. UserCardForm.Show;
  4162. end;
  4163. end;
  4164. //------------------------------------------------------------------------------
  4165. procedure TMainForm.ItemIconButtonDblClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  4166. var
  4167. TalkingForm: TTalkingForm;
  4168. iWaitTimes: Integer;
  4169. RealICQUser: TRealICQUser;
  4170. // CallNumber:String;
  4171. // MenuItem:TMenuItem;
  4172. begin
  4173. if FSearchListViewInVisible then //设置查找输入框为初始状态
  4174. begin
  4175. edFilterKeyword.Text := '查找联系人...';
  4176. edFilterKeyword.Font.Color := clGray;
  4177. end;
  4178. if pnlSearchMoreUser.Visible then
  4179. begin
  4180. edtSearchMoreUser.Text := '查找联系人...';
  4181. edtSearchMoreUser.Font.Color := clGray;
  4182. end;
  4183. if IconButtonType = ltCamera then
  4184. begin
  4185. TalkingForm := GetTalkingForm(Item.LoginName);
  4186. if TalkingForm = nil then
  4187. begin
  4188. TalkingForm := OpenTalkingForm(Item.LoginName, True);
  4189. end;
  4190. iWaitTimes := 0;
  4191. while not TalkingForm.CanWriteMessage do
  4192. begin
  4193. Application.ProcessMessages;
  4194. Inc(iWaitTimes);
  4195. if iWaitTimes > 1000 then
  4196. break;
  4197. Sleep(10);
  4198. end;
  4199. TalkingForm.actVideo.Execute;
  4200. end;
  4201. if IconButtonType = ltHeadImage then
  4202. begin
  4203. if AnsiSameText(Item.LoginName, RealICQClient.Me.LoginName) then
  4204. begin
  4205. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  4206. Exit;
  4207. end;
  4208. OpenTalkingForm(Item.LoginName, True);
  4209. end;
  4210. if IconButtonType = ltSMS then
  4211. begin
  4212. OpenSMSForm(Item.LoginName, True);
  4213. end;
  4214. if IconButtonType = ltEmail then
  4215. begin
  4216. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(Item.LoginName);
  4217. if RealICQUser <> nil then
  4218. //AddWebBrowserToPageControl(Format('http://mail.lishui.gov.cn/web_email/module.phtml?module=mcomposef&to=%s', [RealICQUser.Email]), 999);
  4219. end;
  4220. if IconButtonType = ltAddFriend then
  4221. begin
  4222. if AnsiSameText(MainForm.RealICQClient.LoginName, Item.LoginName) then
  4223. begin
  4224. MessageBox(Handle, '不能添加自己为好友', '提示', MB_ICONINFORMATION);
  4225. Exit;
  4226. end;
  4227. ShowAddFriendWindow(Self, Item.LoginName, Item.DisplayName);
  4228. end;
  4229. if IconButtonType = ltTel then
  4230. begin
  4231. { if not FPCAMessage.GetPCALoginStatus then Exit;
  4232. if (Item.Mobile<>'') and (Item.Tel<>'') then
  4233. begin
  4234. MenuItem:=ppSelCallTel.Items[0];
  4235. MenuItem.Hint:=Item.Mobile+char(10)+Item.DisplayName;
  4236. MenuItem:=ppSelCallTel.Items[1];
  4237. MenuItem.Hint:=Item.Tel+char(10)+Item.DisplayName;
  4238. ppSelCallTel.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y - 50);
  4239. Exit;
  4240. end;
  4241. if Item.Mobile<>'' then CallNumber:=Item.Mobile;
  4242. if Item.Tel<>'' then CallNumber:=Item.Tel;
  4243. FPCAMessage.SendCallTelOutPCAMessage(CallNumber,Item.DisplayName);
  4244. }
  4245. end;
  4246. end;
  4247. //------------------------------------------------------------------------------
  4248. procedure TMainForm.ItemDoubleClick(Item: TRealICQContacterListItem);
  4249. var
  4250. ATeam: TRealICQTeam;
  4251. Branch: TRealICQBranch;
  4252. begin
  4253. if FSearchListViewInVisible then //设置查找输入框为初始状态
  4254. begin
  4255. edFilterKeyword.Text := '查找联系人...';
  4256. edFilterKeyword.Font.Color := clGray;
  4257. end;
  4258. if IsChild(Handle, Item.ListView.Handle) then
  4259. begin
  4260. if GetActiveTabSheetName = LVTeams then
  4261. begin
  4262. ATeam := TRealICQTeam(Item.Data);
  4263. OpenTeamTalkingForm(ATeam.TeamID);
  4264. Exit;
  4265. end;
  4266. end;
  4267. if (Item.StateIndex = 0) and (Item.Data <> nil) then //双击的是部门
  4268. begin
  4269. Branch := Item.Data;
  4270. Branch.Node.Selected := True;
  4271. end
  4272. else if (Item.Data <> nil) then
  4273. begin
  4274. if AnsiSameText(Item.LoginName, RealICQClient.Me.LoginName) then
  4275. begin
  4276. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  4277. Exit;
  4278. end;
  4279. OpenTalkingForm(Item.LoginName);
  4280. end;
  4281. if pnlSearchMoreUser.Visible then
  4282. begin
  4283. edtSearchMoreUser.Text := '查找联系人...';
  4284. end;
  4285. end;
  4286. //------------------------------------------------------------------------------
  4287. procedure TMainForm.ItemOnline(Item: TRealICQContacterListItem);
  4288. var
  4289. iIndex: Integer;
  4290. ARealICQUser: TRealICQUser;
  4291. begin
  4292. //MessageBox(Handle, '1', '1', MB_OK);
  4293. if RealICQClient.Me = nil then
  4294. Exit;
  4295. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  4296. Exit;
  4297. iIndex := FContacterListViews.IndexOfObject(Item.ListView);
  4298. if FContacterListViews[iIndex] = LVLatests then
  4299. exit;
  4300. //MessageBox(Handle, '2', '2', MB_OK);
  4301. if Item.Data <> nil then
  4302. begin
  4303. ARealICQUser := TRealICQUser(Item.Data);
  4304. if (TFriendsService.GetService.IsFriend(ARealICQUser.LoginName)) and (TWorkmatesService.GetService.IsWorkmate(ARealICQUser.LoginName)) then
  4305. begin
  4306. if PlaySoundOnOnline then
  4307. PlayEventSound(OnlineEventSound);
  4308. if ShowHintOnOnline then
  4309. ShowOnOffAlertForm(ARealICQUser);
  4310. end;
  4311. end;
  4312. //MessageBox(Handle, '3', '3', MB_OK);
  4313. end;
  4314. //------------------------------------------------------------------------------
  4315. procedure TMainForm.ItemOffline(Item: TRealICQContacterListItem);
  4316. var
  4317. iIndex: Integer;
  4318. ARealICQUser: TRealICQUser;
  4319. begin
  4320. if RealICQClient.Me = nil then
  4321. Exit;
  4322. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  4323. Exit;
  4324. iIndex := FContacterListViews.IndexOfObject(Item.ListView);
  4325. if FContacterListViews[iIndex] = LVLatests then
  4326. exit;
  4327. if Item.Data <> nil then
  4328. begin
  4329. ARealICQUser := TRealICQUser(Item.Data);
  4330. if (TFriendsService.GetService.IsFriend(ARealICQUser.LoginName)) and (TWorkmatesService.GetService.IsWorkmate(ARealICQUser.LoginName)) then
  4331. begin
  4332. if PlaySoundOnOffline then
  4333. PlayEventSound(OfflineEventSound);
  4334. if ShowHintOnOffline then
  4335. ShowOnOffAlertForm(ARealICQUser);
  4336. end;
  4337. end;
  4338. end;
  4339. //------------------------------------------------------------------------------
  4340. procedure TMainForm.lblLogsClick(Sender: TObject);
  4341. var
  4342. ANoticesRecord: TSystemNotices;
  4343. begin
  4344. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  4345. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(ReadMessageURL + ANoticesRecord.URL)])), '', SW_SHOWDEFAULT);
  4346. end;
  4347. procedure TMainForm.lblLogsMouseEnter(Sender: TObject);
  4348. begin
  4349. lblLogs.Font.Style := [fsUnderline];
  4350. TimerForShowSystemNotices.Enabled := False;
  4351. end;
  4352. procedure TMainForm.lblLogsMouseLeave(Sender: TObject);
  4353. begin
  4354. lblLogs.Font.Style := [];
  4355. TimerForShowSystemNotices.Enabled := FSystemNotices.Count > 0;
  4356. end;
  4357. procedure TMainForm.lblReConnectClick(Sender: TObject);
  4358. begin
  4359. RealICQClient.ReConnectAndLogin;
  4360. end;
  4361. //------------------------------------------------------------------------------
  4362. procedure TMainForm.lblRegisterMouseEnter(Sender: TObject);
  4363. begin
  4364. (Sender as TLabel).Font.Style := [fsUnderline];
  4365. end;
  4366. //------------------------------------------------------------------------------
  4367. procedure TMainForm.lblRegisterMouseLeave(Sender: TObject);
  4368. begin
  4369. (Sender as TLabel).Font.Style := [];
  4370. end;
  4371. //------------------------------------------------------------------------------
  4372. procedure TMainForm.ChangeUIColor(AColor: TColor);
  4373. var
  4374. iLoop: Integer;
  4375. IUIColor: IRealICQUIColor;
  4376. begin
  4377. inherited ChangeUIColor(AColor);
  4378. TMainFormController.GetController.ChangeUIColor(AColor);
  4379. spb360SD.ChangeUIColor(AColor);
  4380. spb360Safe.ChangeUIColor(AColor);
  4381. spbNetworkBackup.ChangeUIColor(AColor);
  4382. spbRefreshBranchUsers.ChangeUIColor(AColor);
  4383. btShowMiniPage.ChangeUIColor(AColor);
  4384. spbDisplayName.ChangeUIColor(AColor);
  4385. spbWatchword.ChangeUIColor(AColor);
  4386. shpWatchwordBorder.Pen.Color := ConvertColorToColor(shpWatchwordBorder.Pen.Color, AColor);
  4387. spbSelUIColor.ChangeUIColor(AColor);
  4388. spbHistroyMessage.ChangeUIColor(AColor);
  4389. spbAddFriend.ChangeUIColor(AColor);
  4390. spblock.ChangeUIColor(AColor);
  4391. btMainMenu.ChangeUIColor(AColor);
  4392. //btOA.ChangeUIColor(AColor);
  4393. //btSwap.ChangeUIColor(AColor);
  4394. spbShowNotReadMessage.ChangeUIColor(AColor);
  4395. spbWinMeet.ChangeUIColor(AColor);
  4396. spbAddFriend.Font.Color := ConvertColorToColor(spbAddFriend.Font.Color, AColor);
  4397. spbHistroyMessage.Font.Color := ConvertColorToColor(spbHistroyMessage.Font.Color, AColor);
  4398. spblock.Font.Color := ConvertColorToColor(spblock.Font.Color, AColor);
  4399. ConvertBitmapToColor(MyContacters.Picture.Bitmap, AColor);
  4400. ConvertBitmapToColor(SysMsg.Picture.Bitmap, AColor);
  4401. ConvertBitmapToColor(MyFriend.Picture.Bitmap, AColor);
  4402. ConvertBitmapToColor(MyTeam.Picture.Bitmap, AColor);
  4403. ConvertBitmapToColor(Latests.Picture.Bitmap, AColor);
  4404. ConvertBitmapToColor(MyContactersIcon.Picture.Bitmap, AColor);
  4405. ConvertBitmapToColor(SysMsgIcon.Picture.Bitmap, AColor);
  4406. ConvertBitmapToColor(MyFriendIcon.Picture.Bitmap, AColor);
  4407. ConvertBitmapToColor(MyTeamIcon.Picture.Bitmap, AColor);
  4408. ConvertBitmapToColor(LatestsIcon.Picture.Bitmap, AColor);
  4409. ConvertBitmapToColor(RealICQHoverImage1.Picture.Bitmap, AColor);
  4410. {通讯录}
  4411. ConvertBitmapToColor(imgAddrBookToolbarBack.Picture.Bitmap, AColor);
  4412. imgAddrBookToolbarBack.Invalidate;
  4413. spbAddGroupUser.ChangeUIColor(AColor);
  4414. spbAddGroup.ChangeUIColor(AColor);
  4415. spbImportGroupUser.ChangeUIColor(AColor);
  4416. {通讯录}
  4417. ShpHint.Pen.Color := ConvertColorToColor(ShpHint.Pen.Color, AColor);
  4418. btPrevLog.ChangeUIColor(AColor);
  4419. btNextLog.ChangeUIColor(AColor);
  4420. ConvertBitmapToColor(ImageForCustomerTop.Picture.Bitmap, AColor);
  4421. ImageForCustomerTop.Invalidate;
  4422. btCustomerLogin.ChangeUIColor(AColor);
  4423. btCustomerLogout.ChangeUIColor(AColor);
  4424. btCustomerDisplayName.ChangeUIColor(AColor);
  4425. ShpLeft.Pen.Color := ConvertColorToColor(ShpLeft.Pen.Color, AColor);
  4426. ShpBottom.Pen.Color := ConvertColorToColor(ShpBottom.Pen.Color, AColor);
  4427. ShpRight.Pen.Color := ConvertColorToColor(ShpRight.Pen.Color, AColor);
  4428. ShpSearchLeft.Pen.Color := ConvertColorToColor(ShpSearchLeft.Pen.Color, AColor);
  4429. ShpSearchBottom.Pen.Color := ConvertColorToColor(ShpSearchBottom.Pen.Color, AColor);
  4430. ShpSearchRight.Pen.Color := ConvertColorToColor(ShpSearchRight.Pen.Color, AColor);
  4431. spbEmail.ChangeUIColor(AColor);
  4432. sbpSMS.ChangeUIColor(AColor);
  4433. spbPersonManage.ChangeUIColor(AColor);
  4434. spbTelMeeting.ChangeUIColor(AColor);
  4435. pnlToolBar.Color := FormColor;
  4436. PnlTop.Color := FormColor;
  4437. pnlWorkArea.Color := FormColor;
  4438. pnlLogout.Color := FormColor;
  4439. pgcMainWorkArea.BackColor := FormColor;
  4440. pnlLocked.Color := FormColor;
  4441. btn_lock_DisplayName.ChangeUIColor(AColor);
  4442. btn_unlock.ChangeUIColor(AColor);
  4443. ConvertBitmapToColor(img_lockback_top.Picture.Bitmap, AColor);
  4444. //ConvertBitmapToColor(shp_lock_client.Picture.Bitmap, AColor);
  4445. //txt_locked.color:= FormColor;
  4446. pnlClient.Color := FormColor;
  4447. pnlNDToolBar.Color := FormColor;
  4448. pnlNDStateBar.Color := FormColor;
  4449. pnlMiddleClient.Color := FormColor;
  4450. pnlAddrBkStateBar.Color := FormColor;
  4451. pnlCustomerServiceStatus.Color := FormColor;
  4452. ConvertBitmapToColor(imgWebToolBack.Picture.Bitmap, AColor);
  4453. imgWebToolBack.Invalidate;
  4454. spbPrev.ChangeUIColor(AColor);
  4455. spbNext.ChangeUIColor(AColor);
  4456. spbStop.ChangeUIColor(AColor);
  4457. spbRefresh.ChangeUIColor(AColor);
  4458. spbAddToNA.ChangeUIColor(AColor);
  4459. spbGo.ChangeUIColor(AColor);
  4460. spbWebClose.ChangeUIColor(AColor);
  4461. sbpNewWebTab.ChangeUIColor(AColor);
  4462. TabSetMuiltWeb.BackgroundColor := ConvertColorToColor(TabSetMuiltWeb.BackgroundColor, AColor);
  4463. TabSetMuiltWeb.SelectedColor := ConvertColorToColor(TabSetMuiltWeb.SelectedColor, AColor);
  4464. shpWebStatus.Pen.Color := ConvertColorToColor(shpWebStatus.Pen.Color, AColor);
  4465. shpWebLeftBorder.Pen.Color := ConvertColorToColor(shpWebLeftBorder.Pen.Color, AColor);
  4466. ConvertBitmapToColor(imgNDToolbarBack.Picture.Bitmap, AColor);
  4467. imgNDToolbarBack.Invalidate;
  4468. ConvertBitmapToColor(imgLogoutBKTop.Picture.Bitmap, AColor);
  4469. imgLogoutBKTop.Invalidate;
  4470. ConvertBitmapToColor(imgLogoutBK.Picture.Bitmap, AColor);
  4471. imgLogoutBK.Invalidate;
  4472. spLoginNameBorder.Pen.Color := ConvertColorToColor(spLoginNameBorder.Pen.Color, AColor);
  4473. spbChangeLoginName.ChangeUIColor(AColor);
  4474. spPasswordBorder.Pen.Color := ConvertColorToColor(spPasswordBorder.Pen.Color, AColor);
  4475. pnlSelectServer.Color := FormColor;
  4476. spServerListBorder.Pen.Color := ConvertColorToColor(spServerListBorder.Pen.Color, AColor);
  4477. spbSelectServer.ChangeUIColor(AColor);
  4478. shpSearchMoreUser.Pen.Color := ConvertColorToColor(shpSearchMoreUser.Pen.Color, AColor);
  4479. spbCancelFilter.ChangeUIColor(AColor);
  4480. shpFilterBorder.Pen.Color := ConvertColorToColor(shpFilterBorder.Pen.Color, AColor);
  4481. spbLoginState.ChangeUIColor(AColor);
  4482. spbSavePassword.ChangeUIColor(AColor);
  4483. spbAutoLogin.ChangeUIColor(AColor);
  4484. btLogin.ChangeUIColor(AColor);
  4485. spbNDMoveUp.ChangeUIColor(AColor);
  4486. spbNDNewDir.ChangeUIColor(AColor);
  4487. spbNDDelete.ChangeUIColor(AColor);
  4488. shpNDDirBorder.Pen.Color := ConvertColorToColor(shpNDDirBorder.Pen.Color, AColor);
  4489. spbNDUpload.ChangeUIColor(AColor);
  4490. spbNDDownload.ChangeUIColor(AColor);
  4491. spbNDConnect.ChangeUIColor(AColor);
  4492. spbNDDisconnect.ChangeUIColor(AColor);
  4493. spbNDRefresh.ChangeUIColor(AColor);
  4494. spbNDCancelAll.ChangeUIColor(AColor);
  4495. TabSetNDMissions.SelectedColor := clWhite;
  4496. TabSetNDMissions.BackgroundColor := clWhite;
  4497. pnlNDMissions.Color := clWhite;
  4498. ConvertBitmapToColor(imgHeadImageBorder.Picture.Bitmap, AColor);
  4499. imgHeadImageBorder.Invalidate;
  4500. ConvertBitmapToColor(imgBottomMenu.Picture.Bitmap, AColor);
  4501. imgBottomMenu.Invalidate;
  4502. ConvertBitmapToColor(imgTitleBackMiddle.Picture.Bitmap, AColor);
  4503. imgTitleBackMiddle.Invalidate;
  4504. IUIColor := pgcMainWorkArea;
  4505. IUIColor.ChangeUIColor(AColor);
  4506. for iLoop := 0 to FContacterListViews.Count - 1 do
  4507. begin
  4508. IUIColor := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  4509. IUIColor.ChangeUIColor(AColor);
  4510. end;
  4511. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  4512. begin
  4513. IUIColor := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  4514. IUIColor.ChangeUIColor(AColor);
  4515. end;
  4516. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  4517. begin
  4518. IUIColor := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  4519. IUIColor.ChangeUIColor(AColor);
  4520. end;
  4521. if Assigned(FTVCustomerLatests) then
  4522. FTVCustomerLatests.ChangeUIColor(AColor);
  4523. // if Assigned(FLVCustomers) then FLVCustomers.ChangeUIColor(AColor);
  4524. if Assigned(FLVSystemMessage) then
  4525. FLVSystemMessage.ChangeUIColor(AColor);
  4526. if Assigned(FLVTeams) then
  4527. FLVTeams.ChangeUIColor(AColor);
  4528. if tsNetWorkDisk.Parent <> nil then
  4529. begin
  4530. FLVNetWorkDisk.ChangeUIColor(AColor);
  4531. FLVNetWorkDiskUploadingFiles.ChangeUIColor(AColor);
  4532. FLVNetWorkDiskDownloadingFiles.ChangeUIColor(AColor);
  4533. end;
  4534. btLogin.ChangeUIColor(AColor);
  4535. btLogin.Invalidate;
  4536. spbContacterViewStyle.ChangeUIColor(AColor);
  4537. spbCreateTeam.ChangeUIColor(AColor);
  4538. spbFindTeam.ChangeUIColor(AColor);
  4539. pnlTeams.Color := ConvertColorToColor(pnlTeams.Color, AColor);
  4540. if CreateTeamForm <> nil then
  4541. CreateTeamForm.ChangeUIColor(AColor);
  4542. if SearchForm <> nil then
  4543. SearchForm.ChangeUIColor(AColor);
  4544. if SearchTeamForm <> nil then
  4545. SearchTeamForm.ChangeUIColor(AColor);
  4546. if SelFaceForm <> nil then
  4547. SelFaceForm.ChangeUIColor(AColor);
  4548. if CustomFacesManagerForm <> nil then
  4549. CustomFacesManagerForm.ChangeUIColor(AColor);
  4550. if NotReadMessageBoxForm <> nil then
  4551. NotReadMessageBoxForm.ChangeUIColor(AColor);
  4552. ChangeAddFriendFormColor(AColor);
  4553. ChangeAddFriendRequestFormColor(AColor);
  4554. // ChangeSeeUserInformationFormColor(AColor);
  4555. ChangeTalkingFormColor(AColor);
  4556. ChangeSMSFormColor(AColor);
  4557. ChangeTeamOptionsFormColor(AColor);
  4558. ChangeSystemMessageFormsColor(AColor);
  4559. end;
  4560. //------------------------------------------------------------------------------
  4561. function TMainForm.GetListViewByLoginName(ALoginName: string; AOnlyInGroups: Boolean = False): TRealICQContacterListView;
  4562. var
  4563. GroupName: string;
  4564. iLoop, jLoop, iIndex, ContacterIndex: Integer;
  4565. GroupMembers: TStringList;
  4566. ListView: TRealICQContacterListView;
  4567. begin
  4568. Result := nil;
  4569. if not AOnlyInGroups then
  4570. begin
  4571. if (TFriendsService.GetService.IsFriend(ALoginName)) and (TWorkmatesService.GetService.IsWorkmate(ALoginName)) then
  4572. begin
  4573. ContacterIndex := FContacterListViews.IndexOf(LVFriends);
  4574. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4575. Result := ListView;
  4576. end
  4577. else if RealICQClient.Blacklists.IndexOf(ALoginName) >= 0 then
  4578. begin
  4579. ContacterIndex := FContacterListViews.IndexOf(LVBlacklists);
  4580. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4581. if ListView.Items.IndexOf(ALoginName) = -1 then
  4582. ListView.Items.Add(ALoginName);
  4583. Result := ListView;
  4584. exit;
  4585. end
  4586. else if RealICQClient.Strangers.IndexOf(ALoginName) >= 0 then
  4587. begin
  4588. ContacterIndex := FContacterListViews.IndexOf(LVStrangers);
  4589. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4590. if ListView.Items.IndexOf(ALoginName) = -1 then
  4591. ListView.Items.Add(ALoginName);
  4592. Result := ListView;
  4593. exit;
  4594. end;
  4595. end;
  4596. if FShowGroup then
  4597. begin
  4598. for iLoop := 0 to FGroups.Count - 1 do
  4599. begin
  4600. GroupName := FGroups[iLoop];
  4601. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  4602. for jLoop := 0 to GroupMembers.Count - 1 do
  4603. begin
  4604. if AnsiSameText(GroupMembers[jLoop], ALoginName) then
  4605. begin
  4606. iIndex := FContacterListViews.IndexOf(GroupName);
  4607. if iIndex >= 0 then
  4608. begin
  4609. ListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  4610. if ListView.Items.IndexOf(ALoginName) = -1 then
  4611. ListView.Items.Add(ALoginName);
  4612. Result := ListView;
  4613. end;
  4614. exit;
  4615. end;
  4616. end;
  4617. end;
  4618. end;
  4619. if Result <> nil then
  4620. if Result.Items.IndexOf(ALoginName) = -1 then
  4621. Result.Items.Add(ALoginName);
  4622. end;
  4623. //------------------------------------------------------------------------------
  4624. procedure TMainForm.ShowNavBarNumeric;
  4625. begin
  4626. //
  4627. end;
  4628. //-------------------显示好友列表---------------
  4629. procedure TMainForm.ShowFriendLists;
  4630. var
  4631. iLoop, itemIndex: Integer;
  4632. RealICQUser: TRealICQUser;
  4633. RealICQFriendTreeView: TRealICQContacterTreeView;
  4634. Friend: TRealICQEmployee;
  4635. begin
  4636. itemIndex := FContacterTreeViews.IndexOf(LvFriends);
  4637. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4638. for iLoop := FNotAddedEmployeeList.Count - 1 downto 0 do
  4639. begin
  4640. RealICQUser := FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  4641. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  4642. Continue;
  4643. if (RealICQFriendTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then
  4644. Continue;
  4645. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  4646. Friend.BranchID := LVFriends;
  4647. RealICQFriendTreeView.AddEmployee(Friend);
  4648. UpdateFriendNode(Friend, RealICQUser, False);
  4649. end;
  4650. end;
  4651. //------------------------------------------------------------------------------
  4652. procedure TMainForm.ShowGroupInterface;
  4653. var
  4654. GroupName, LoginName: string;
  4655. iLoop, jLoop, itemIndex: Integer;
  4656. RealICQUser: TRealICQUser;
  4657. RealICQFriendTreeView: TRealICQContacterTreeView;
  4658. Friend: TRealICQEmployee;
  4659. FriendGroup: TRealICQBranch;
  4660. GroupMembers: TStringList;
  4661. begin
  4662. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  4663. if ItemIndex >= 0 then
  4664. begin
  4665. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4666. try
  4667. RealICQFriendTreeView.Clear;
  4668. FreeAndNil(RealICQFriendTreeView);
  4669. FContacterTreeViews.Delete(ItemIndex);
  4670. except
  4671. end;
  4672. end;
  4673. ItemIndex := AddFriendTreeView(scrollBoxMyFriend, LVFriends);
  4674. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4675. RealICQFriendTreeView.AdjustPosition := False;
  4676. RealICQFriendTreeView.HideSystemScrollBar;
  4677. RealICQFriendTreeView.BeginUpdate;
  4678. SetFlashCaptionOnOnlineValue(False);
  4679. Screen.Cursor := crHourGlass;
  4680. try
  4681. //显示好友
  4682. ShowFriendLists;
  4683. //显示黑名单
  4684. //ShowBlacklists;
  4685. {$region '添加自定义分组'}
  4686. if FShowGroup then
  4687. begin
  4688. for iLoop := 0 to FGroups.Count - 1 do
  4689. begin
  4690. GroupName := FGroups[iLoop];
  4691. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  4692. FriendGroup := TRealICQBranch.Create(GroupName);
  4693. FriendGroup.BranchID := GroupName;
  4694. FriendGroup.ParentID := '';
  4695. FriendGroup.BranchName := GroupName;
  4696. RealICQFriendTreeView.AddBranch(FriendGroup);
  4697. RealICQFriendTreeView.MoveBranch(GroupName, LvFriends);
  4698. for jLoop := 0 to GroupMembers.Count - 1 do
  4699. begin
  4700. LoginName := GroupMembers[jLoop];
  4701. if (not TFriendsService.GetService.IsFriend(LoginName)) and (not TWorkmatesService.GetService.IsWorkmate(LoginName)) then
  4702. continue;
  4703. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  4704. continue;
  4705. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  4706. ItemIndex := RealICQFriendTreeView.EmployeeItems.IndexOf(LoginName);
  4707. if ItemIndex >= 0 then
  4708. RealICQFriendTreeView.EmployeeItems.Delete(ItemIndex);
  4709. Friend := TRealICQEmployee.Create(LoginName);
  4710. Friend.BranchID := FriendGroup.BranchName;
  4711. RealICQFriendTreeView.AddEmployee(Friend);
  4712. UpdateFriendNode(Friend, RealICQUser, False);
  4713. end;
  4714. end;
  4715. end;
  4716. {$endregion}
  4717. //展开好友列表
  4718. ItemIndex := RealICQFriendTreeView.BranchItems.IndexOf(LvFriends);
  4719. FriendGroup := RealICQFriendTreeView.BranchItems.Objects[itemIndex] as TRealICQBranch;
  4720. FriendGroup.Node.Expanded := True;
  4721. finally
  4722. //RealICQFriendTreeView.MoveFriendGroup(LvBlackLists,LvFriends);
  4723. PostMessage(RealICQFriendTreeView.Handle, WM_SIZE, 0, 0);
  4724. RealICQFriendTreeView.EndUpdate;
  4725. Screen.Cursor := crDefault;
  4726. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  4727. end;
  4728. end;
  4729. //------------------------------------------------------------------------------
  4730. function TMainForm.AddFriendTreeView(AOwner: TWinControl; GroupName: string): Integer;
  4731. var
  4732. RealICQFriendTreeView: TRealICQContacterTreeView;
  4733. Group: TRealICQBranch;
  4734. begin
  4735. RealICQFriendTreeView := TRealICQContacterTreeView.Create(AOwner);
  4736. RealICQFriendTreeView.Parent := AOwner;
  4737. RealICQFriendTreeView.Align := alClient;
  4738. RealICQFriendTreeView.Caption := '';
  4739. RealICQFriendTreeView.Color := clWhite;
  4740. RealICQFriendTreeView.ShowHint := True;
  4741. RealICQFriendTreeView.ParentFont := True;
  4742. RealICQFriendTreeView.ShowLine := False;
  4743. RealICQFriendTreeView.ShowBranchImage := False;
  4744. RealICQFriendTreeView.MustDrawButton := True;
  4745. RealICQFriendTreeView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4746. RealICQFriendTreeView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4747. RealICQFriendTreeView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4748. RealICQFriendTreeView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4749. RealICQFriendTreeView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4750. RealICQFriendTreeView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4751. RealICQFriendTreeView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4752. RealICQFriendTreeView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4753. RealICQFriendTreeView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4754. RealICQFriendTreeView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4755. RealICQFriendTreeView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4756. RealICQFriendTreeView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4757. RealICQFriendTreeView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4758. RealICQFriendTreeView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4759. RealICQFriendTreeView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4760. RealICQFriendTreeView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4761. RealICQFriendTreeView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4762. RealICQFriendTreeView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4763. RealICQFriendTreeView.ScrollBarButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarButtonPicture);
  4764. RealICQFriendTreeView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4765. RealICQFriendTreeView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4766. RealICQFriendTreeView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4767. RealICQFriendTreeView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4768. RealICQFriendTreeView.HeadImageBackColor := FLVHeadImageBackColor;
  4769. RealICQFriendTreeView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4770. RealICQFriendTreeView.DefaultPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4771. RealICQFriendTreeView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig44);
  4772. RealICQFriendTreeView.BranchClosedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + GroupClosedButtonPicture);
  4773. RealICQFriendTreeView.BranchOpenedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + GroupOpenedButtonPicture);
  4774. RealICQFriendTreeView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4775. RealICQFriendTreeView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4776. RealICQFriendTreeView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4777. RealICQFriendTreeView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4778. RealICQFriendTreeView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4779. RealICQFriendTreeView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4780. RealICQFriendTreeView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4781. RealICQFriendTreeView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4782. RealICQFriendTreeView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4783. RealICQFriendTreeView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4784. RealICQFriendTreeView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4785. RealICQFriendTreeView.ShowMobileButton := True;
  4786. RealICQFriendTreeView.ShowTelButton := False;
  4787. RealICQFriendTreeView.ShowCameraButton := True;
  4788. RealICQFriendTreeView.ShowHeadImageButton := False;
  4789. RealICQFriendTreeView.ShowEmailButton := False;
  4790. RealICQFriendTreeView.ShowSMSButton := True;
  4791. RealICQFriendTreeView.Style := FLVStyle;
  4792. RealICQFriendTreeView.CaptionStyle := FLVCaptionStyle;
  4793. RealICQFriendTreeView.ChangeUIColor(FUIMainColor);
  4794. RealICQFriendTreeView.PopupMenu := ppUserItemRightMenu;
  4795. RealICQFriendTreeView.OnItemOnline := NodeOnline;
  4796. RealICQFriendTreeView.OnItemOffline := NodeOffline;
  4797. RealICQFriendTreeView.OnItemDoubleClick := NodeDoubleClick;
  4798. RealICQFriendTreeView.OnItemIconButtonClick := NodeIconButtonClick;
  4799. RealICQFriendTreeView.OnItemIconButtonDblClick := NodeIconButtonDblClick;
  4800. RealICQFriendTreeView.OnItemMouseEnter := NodeOnMouseEnter;
  4801. RealICQFriendTreeView.OnItemMouseLeave := NodeOnMouseLeave;
  4802. Result := FContacterTreeViews.AddObject(GroupName, RealICQFriendTreeView);
  4803. RealICQFriendTreeView.AdjustPosition := False;
  4804. RealICQFriendTreeView.HideSystemScrollBar;
  4805. RealICQFriendTreeView.BeginUpdate;
  4806. try
  4807. Group := TRealICQBranch.Create(LVFriends);
  4808. Group.BranchID := LvFriends;
  4809. Group.ParentID := '0';
  4810. Group.BranchName := LvFriends;
  4811. RealICQFriendTreeView.AddBranch(Group);
  4812. finally
  4813. RealICQFriendTreeView.EndUpdate;
  4814. end;
  4815. end;
  4816. //------------------------------------------------------------------------------
  4817. function TMainForm.AddContacterTreeView(AOwner: TWinControl; GroupName: string): Integer;
  4818. var
  4819. RealICQContacterTreeView: TRealICQContacterTreeView;
  4820. begin
  4821. RealICQContacterTreeView := TRealICQContacterTreeView.Create(AOwner);
  4822. RealICQContacterTreeView.Parent := AOwner;
  4823. RealICQContacterTreeView.Align := alClient;
  4824. RealICQContacterTreeView.Caption := '';
  4825. RealICQContacterTreeView.Color := clWhite;
  4826. RealICQContacterTreeView.ShowHint := True;
  4827. RealICQContacterTreeView.ParentFont := True;
  4828. RealICQContacterTreeView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4829. RealICQContacterTreeView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4830. RealICQContacterTreeView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4831. RealICQContacterTreeView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4832. RealICQContacterTreeView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4833. RealICQContacterTreeView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4834. RealICQContacterTreeView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4835. RealICQContacterTreeView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4836. RealICQContacterTreeView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4837. RealICQContacterTreeView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4838. RealICQContacterTreeView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4839. RealICQContacterTreeView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4840. RealICQContacterTreeView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4841. RealICQContacterTreeView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4842. RealICQContacterTreeView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4843. RealICQContacterTreeView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4844. RealICQContacterTreeView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4845. RealICQContacterTreeView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4846. RealICQContacterTreeView.ScrollBarButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarButtonPicture);
  4847. RealICQContacterTreeView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4848. RealICQContacterTreeView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4849. RealICQContacterTreeView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4850. RealICQContacterTreeView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4851. RealICQContacterTreeView.HeadImageBackColor := FLVHeadImageBackColor;
  4852. RealICQContacterTreeView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4853. RealICQContacterTreeView.DefaultPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4854. RealICQContacterTreeView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig44);
  4855. RealICQContacterTreeView.BranchExpandedPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchExpandedPicture);
  4856. RealICQContacterTreeView.BranchCollapsedPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedPicture);
  4857. RealICQContacterTreeView.BranchClosedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchClosedButtonPicture);
  4858. RealICQContacterTreeView.BranchOpenedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchOpenedButtonPicture);
  4859. RealICQContacterTreeView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4860. RealICQContacterTreeView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4861. RealICQContacterTreeView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4862. RealICQContacterTreeView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4863. RealICQContacterTreeView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4864. RealICQContacterTreeView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4865. RealICQContacterTreeView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4866. RealICQContacterTreeView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4867. RealICQContacterTreeView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4868. RealICQContacterTreeView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4869. RealICQContacterTreeView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4870. RealICQContacterTreeView.AddFriendIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + AddFriendIcon);
  4871. RealICQContacterTreeView.NewSNSUpdateIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SNSIcon);
  4872. RealICQContacterTreeView.CheckFalsePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CheckFalse.bmp');
  4873. RealICQContacterTreeView.CheckTruePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CheckTrue.bmp');
  4874. RealICQContacterTreeView.ShowMobileButton := True;
  4875. RealICQContacterTreeView.ShowTelButton := False;
  4876. RealICQContacterTreeView.ShowCameraButton := True;
  4877. RealICQContacterTreeView.ShowHeadImageButton := False;
  4878. RealICQContacterTreeView.ShowEmailButton := False;
  4879. RealICQContacterTreeView.ShowSMSButton := True;
  4880. RealICQContacterTreeView.ShowNewSNSButton := True;
  4881. RealICQContacterTreeView.Style := FLVStyle;
  4882. RealICQContacterTreeView.CaptionStyle := FLVCaptionStyle;
  4883. RealICQContacterTreeView.ChangeUIColor(FUIMainColor);
  4884. RealICQContacterTreeView.PopupMenu := ppUserItemRightMenu;
  4885. if GroupName = LVMoreUsers then
  4886. begin
  4887. RealICQContacterTreeView.OnBranchClick := NodeBranchClick;
  4888. RealICQContacterTreeView.ShowAddFriendButton := True;
  4889. end;
  4890. if GroupName = LVAddrbook then
  4891. begin
  4892. RealICQContacterTreeView.OnBranchClick := NodeGroupClick;
  4893. end;
  4894. RealICQContacterTreeView.OnItemOnline := NodeOnline;
  4895. RealICQContacterTreeView.OnItemOffline := NodeOffline;
  4896. RealICQContacterTreeView.OnItemDoubleClick := NodeDoubleClick;
  4897. RealICQContacterTreeView.OnItemIconButtonClick := NodeIconButtonClick;
  4898. RealICQContacterTreeView.OnItemIconButtonDblClick := NodeIconButtonDblClick;
  4899. RealICQContacterTreeView.OnItemMouseEnter := NodeOnMouseEnter;
  4900. RealICQContacterTreeView.OnItemMouseLeave := NodeOnMouseLeave;
  4901. Result := FContacterTreeViews.AddObject(GroupName, RealICQContacterTreeView);
  4902. end;
  4903. procedure TMainForm.UpdateContacterListView(RealICQContacterListView: TRealICQContacterListView);
  4904. begin
  4905. RealICQContacterListView.Align := alClient;
  4906. RealICQContacterListView.Caption := '';
  4907. RealICQContacterListView.Color := clWhite;
  4908. RealICQContacterListView.ShowHint := True;
  4909. RealICQContacterListView.ParentFont := True;
  4910. RealICQContacterListView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4911. RealICQContacterListView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4912. RealICQContacterListView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4913. RealICQContacterListView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4914. RealICQContacterListView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4915. RealICQContacterListView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4916. RealICQContacterListView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4917. RealICQContacterListView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4918. RealICQContacterListView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4919. RealICQContacterListView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4920. RealICQContacterListView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4921. RealICQContacterListView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4922. RealICQContacterListView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4923. RealICQContacterListView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4924. RealICQContacterListView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4925. RealICQContacterListView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4926. RealICQContacterListView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4927. RealICQContacterListView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4928. RealICQContacterListView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4929. RealICQContacterListView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4930. RealICQContacterListView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4931. RealICQContacterListView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4932. RealICQContacterListView.HeadImageBackColor := FLVHeadImageBackColor;
  4933. RealICQContacterListView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4934. RealICQContacterListView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  4935. RealICQContacterListView.DefaultPictureMiddle.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureMiddle);
  4936. RealICQContacterListView.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4937. //RealICQContacterListView.DefaultPictureBigOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBigOffline);
  4938. //RealICQContacterListView.DefaultPictureMiddleOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureMiddleOffline);
  4939. //RealICQContacterListView.DefaultPictureSmallOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmallOffline);
  4940. RealICQContacterListView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4941. RealICQContacterListView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4942. RealICQContacterListView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4943. RealICQContacterListView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4944. RealICQContacterListView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4945. RealICQContacterListView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4946. RealICQContacterListView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4947. RealICQContacterListView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4948. RealICQContacterListView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4949. RealICQContacterListView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4950. RealICQContacterListView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4951. RealICQContacterListView.AddFriendIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + AddFriendIcon);
  4952. RealICQContacterListView.ShowAddFriendButton := False;
  4953. RealICQContacterListView.ShowMobileButton := True;
  4954. RealICQContacterListView.ShowTelButton := True;
  4955. RealICQContacterListView.ShowCameraButton := True;
  4956. RealICQContacterListView.ShowHeadImageButton := False;
  4957. RealICQContacterListView.ShowEmailButton := True;
  4958. RealICQContacterListView.ShowSMSButton := True;
  4959. RealICQContacterListView.Style := FLVStyle;
  4960. RealICQContacterListView.CaptionStyle := FLVCaptionStyle;
  4961. RealICQContacterListView.ChangeUIColor(FUIMainColor);
  4962. RealICQContacterListView.PopupMenu := ppUserItemRightMenu;
  4963. RealICQContacterListView.OnItemDoubleClick := ItemDoubleClick;
  4964. RealICQContacterListView.OnItemIconButtonClick := ItemIconButtonClick;
  4965. RealICQContacterListView.OnItemIconButtonDblClick := ItemIconButtonDblClick;
  4966. RealICQContacterListView.OnItemMouseEnter := nil; // ItemOnMouseEnter;
  4967. RealICQContacterListView.OnItemMouseLeave := nil; // ItemOnMouseLeave;
  4968. end;
  4969. //------------------------------------------------------------------------------
  4970. function TMainForm.AddContacterListView(AOwner: TWinControl; GroupName: string): Integer;
  4971. var
  4972. RealICQContacterListView: TRealICQContacterListView;
  4973. begin
  4974. RealICQContacterListView := TRealICQContacterListView.Create(AOwner);
  4975. RealICQContacterListView.Parent := AOwner;
  4976. UpdateContacterListView(RealICQContacterListView);
  4977. RealICQContacterListView.ShowAddFriendButton := GroupName = LVMoreUsers;
  4978. RealICQContacterListView.ShowMobileButton := not (GroupName = LVMoreUsers);
  4979. RealICQContacterListView.ShowTelButton := not (GroupName = LVMoreUsers);
  4980. RealICQContacterListView.ShowCameraButton := not (GroupName = LVMoreUsers);
  4981. RealICQContacterListView.ShowHeadImageButton := False; //not (GroupName=LVMoreUsers);
  4982. RealICQContacterListView.ShowEmailButton := False; // not (GroupName=LVMoreUsers);
  4983. RealICQContacterListView.ShowSMSButton := not (GroupName = LVMoreUsers);
  4984. if GroupName = LVMoreUsers then
  4985. begin
  4986. RealICQContacterListView.OnItemOnline := nil;
  4987. RealICQContacterListView.OnItemOffline := nil;
  4988. end
  4989. else
  4990. begin
  4991. RealICQContacterListView.OnItemOnline := ItemOnline;
  4992. RealICQContacterListView.OnItemOffline := ItemOffline;
  4993. end;
  4994. Result := FContacterListViews.AddObject(GroupName, RealICQContacterListView);
  4995. end;
  4996. //------------------------------------------------------------------------------
  4997. procedure TMainForm.ApplicationEventsDeactivate(Sender: TObject);
  4998. begin
  4999. if edWatchword.Visible then
  5000. edWatchwordExit(edWatchword);
  5001. FDblClickedTrayIcon := False;
  5002. end;
  5003. //------------------------------------------------------------------------------
  5004. procedure TMainForm.ApplicationEventsException(Sender: TObject; E: Exception);
  5005. var
  5006. LogFile: TextFile;
  5007. Log: string;
  5008. begin
  5009. Exit;
  5010. try
  5011. Log := DateTimeToStr(Now) + ':' + E.Message;
  5012. AssignFile(LogFile, ExtractFilePath(Application.ExeName) + 'Logs.txt');
  5013. try
  5014. try
  5015. Append(LogFile);
  5016. except
  5017. ReWrite(LogFile);
  5018. end;
  5019. Writeln(LogFile, Log);
  5020. finally
  5021. CloseFile(LogFile);
  5022. end;
  5023. except
  5024. end;
  5025. end;
  5026. procedure TMainForm.ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean);
  5027. var
  5028. classname: array[0..254] of char;
  5029. begin
  5030. if (Msg.message = WM_CLOSE) then
  5031. begin
  5032. getclassname(msg.hwnd, @classname, sizeof(classname)); //取类名
  5033. if classname = 'Shell Embedding' then
  5034. begin
  5035. PeekMessage(Msg, Msg.Hwnd, 0, 0, PM_REMOVE);
  5036. Handled := True; //该消息已处理,不再需要后续处理
  5037. end;
  5038. end;
  5039. if (Msg.message = WM_LBUTTONDOWN) or (Msg.message = WM_NCLBUTTONDOWN) then
  5040. begin
  5041. if IsChild(Handle, Msg.hwnd) then
  5042. begin
  5043. HideUserCardForm;
  5044. end;
  5045. end;
  5046. end;
  5047. procedure TMainForm.ppAddrBookListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5048. begin
  5049. ChangePPMenuColorMap(ppAddrBookList.PopupMenu);
  5050. end;
  5051. procedure TMainForm.ppAddrBookListPopup(Sender: TObject);
  5052. var
  5053. ItemIndex: Integer;
  5054. RealICQContacterTreeView: TRealICQContacterTreeView;
  5055. begin
  5056. ItemIndex := FContacterTreeViews.IndexOf(LVAddrBook);
  5057. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5058. miUpdateGroup.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5059. miDelGroup.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5060. miImportGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5061. miDelGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5062. miUpdateGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5063. miCut.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil) or (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5064. miPaste.Enabled := (FCutNode <> nil);
  5065. miSetRemark.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5066. end;
  5067. procedure TMainForm.ppChangeCustomerStateGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5068. begin
  5069. ChangePPMenuColorMap(ppChangeCustomerState.PopupMenu);
  5070. end;
  5071. procedure TMainForm.ppChangeStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5072. begin
  5073. ChangePPMenuColorMap(ppChangeStates.PopupMenu);
  5074. end;
  5075. //------------------------------------------------------------------------------
  5076. procedure TMainForm.ppChangeStatesPopup(Sender: TObject);
  5077. begin
  5078. end;
  5079. //------------------------------------------------------------------------------
  5080. procedure TMainForm.ppColorsGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5081. begin
  5082. ChangePPMenuColorMap(ppColors.PopupMenu);
  5083. end;
  5084. //------------------------------------------------------------------------------
  5085. procedure TMainForm.ppColorsPopup(Sender: TObject);
  5086. var
  5087. iLoop: Integer;
  5088. ColorStr: string;
  5089. MenuItem: TMenuItem;
  5090. Bitmap: TBitmap;
  5091. procedure FindSkins(APath: string);
  5092. var
  5093. DSearchRec: TSearchRec;
  5094. FindResult: Integer;
  5095. begin
  5096. FindResult := FindFirst(APath + '*.*', faDirectory, DSearchRec);
  5097. while FindResult = 0 do
  5098. begin
  5099. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  5100. if (DSearchRec.Attr and faDirectory) = faDirectory then
  5101. begin
  5102. MenuItem := TMenuItem.Create(miSkins);
  5103. MenuItem.Caption := DSearchRec.Name;
  5104. MenuItem.OnClick := miSkinClick;
  5105. MenuItem.Enabled := SkinName <> DSearchRec.Name;
  5106. MenuItem.Checked := SkinName = DSearchRec.Name;
  5107. miSkins.Insert(0, MenuItem);
  5108. end;
  5109. FindResult := FindNext(DSearchRec);
  5110. end;
  5111. end;
  5112. begin
  5113. ImgLstColors.Clear;
  5114. while ppColors.Items.Count > 4 do
  5115. ppColors.Items.Delete(0);
  5116. Bitmap := TBitmap.Create;
  5117. Bitmap.SetSize(16, 16);
  5118. try
  5119. for iLoop := ColorDialog.CustomColors.Count - 1 downto 0 do
  5120. begin
  5121. ColorStr := Copy(ColorDialog.CustomColors[iLoop], 8, 6);
  5122. if ColorStr = 'FFFFFF' then
  5123. continue;
  5124. ColorStr := '$00' + ColorStr;
  5125. Bitmap.Canvas.Pen.Color := clGray;
  5126. Bitmap.Canvas.Pen.Style := psSolid;
  5127. Bitmap.Canvas.Brush.Color := StrToInt(ColorStr);
  5128. Bitmap.Canvas.Brush.Style := bsSolid;
  5129. Bitmap.Canvas.Rectangle(0, 0, Width, Height);
  5130. ImgLstColors.Add(Bitmap, nil);
  5131. MenuItem := TMenuItem.Create(ppColors);
  5132. MenuItem.Caption := '颜色' + IntToStr(iLoop);
  5133. MenuItem.Tag := StrToInt(ColorStr);
  5134. MenuItem.ImageIndex := ImgLstColors.Count - 1;
  5135. MenuItem.OnClick := miColorClick;
  5136. MenuItem.Enabled := MenuItem.Tag <> UIMainColor;
  5137. MenuItem.Checked := MenuItem.Tag = UIMainColor;
  5138. if MenuItem.Checked then
  5139. MenuItem.ImageIndex := -1;
  5140. ppColors.Items.Insert(0, MenuItem);
  5141. end;
  5142. finally
  5143. Bitmap.Free;
  5144. end;
  5145. miSkins.Clear;
  5146. //FindSkins(ExtractFilePath(Application.ExeName) + 'Skins\');
  5147. FindSkins(ExtractFilePath(Application.ExeName) + SkinPath);
  5148. end;
  5149. //------------------------------------------------------------------------------
  5150. procedure TMainForm.ChangePPMenuColorMap(PopupMenuEx: TCustomActionPopupMenuEx);
  5151. begin
  5152. HideUserCardForm;
  5153. PopupMenuEx.ColorMap.Color := FormColor;
  5154. PopupMenuEx.ColorMap.SelectedColor := ConvertColorToColor(PopupMenuEx.ColorMap.SelectedColor, UIMainColor);
  5155. PopupMenuEx.ColorMap.BtnFrameColor := ConvertColorToColor(PopupMenuEx.ColorMap.BtnFrameColor, UIMainColor);
  5156. PopupMenuEx.Font.Name := '宋体';
  5157. PopupMenuEx.Font.Size := 9;
  5158. end;
  5159. //------------------------------------------------------------------------------
  5160. procedure TMainForm.ppContacterViewStyleGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5161. begin
  5162. ChangePPMenuColorMap(ppContacterViewStyle.PopupMenu);
  5163. end;
  5164. //------------------------------------------------------------------------------
  5165. procedure TMainForm.ppLoginedUsersGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5166. begin
  5167. ChangePPMenuColorMap(ppLoginedUsers.PopupMenu);
  5168. end;
  5169. //------------------------------------------------------------------------------
  5170. procedure TMainForm.ppLoginedUsersPopup(Sender: TObject);
  5171. var
  5172. iLoop: Integer;
  5173. MenuItem: TMenuItem;
  5174. begin
  5175. while ppLoginedUsers.Items.Count > 2 do
  5176. ppLoginedUsers.Items.Delete(0);
  5177. for iLoop := 0 to RealICQClient.LoginedUsers.Count - 1 do
  5178. begin
  5179. if iLoop >= 20 then
  5180. Break;
  5181. MenuItem := TMenuItem.Create(ppLoginedUsers);
  5182. MenuItem.AutoHotkeys := maManual;
  5183. MenuItem.AutoLineReduction := maManual;
  5184. MenuItem.Caption := RealICQClient.LoginedUsers[iLoop];
  5185. MenuItem.OnClick := miChangeLoginNameClick;
  5186. MenuItem.Tag := iLoop;
  5187. ppLoginedUsers.Items.Insert(0, MenuItem);
  5188. end;
  5189. end;
  5190. procedure TMainForm.ppLoginStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5191. begin
  5192. ChangePPMenuColorMap(ppLoginStates.PopupMenu);
  5193. end;
  5194. procedure TMainForm.ppMainMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5195. begin
  5196. ChangePPMenuColorMap(ppMainMenu.PopupMenu);
  5197. end;
  5198. //------------------------------------------------------------------------------
  5199. procedure TMainForm.ppNetWorkFileGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5200. begin
  5201. ChangePPMenuColorMap(ppNetWorkFile.PopupMenu);
  5202. end;
  5203. //------------------------------------------------------------------------------
  5204. procedure TMainForm.ppNetWorkFilePopup(Sender: TObject);
  5205. begin
  5206. NDSelectItemChanged(nil);
  5207. miNDNewDir.Enabled := spbNDNewDir.Enabled;
  5208. miNDDelete.Enabled := spbNDDelete.Enabled;
  5209. miNDDownload.Enabled := spbNDDownload.Enabled;
  5210. miNDRename.Enabled := (FLVNetWorkDisk.SelCount = 1) and (not pnlNDMissions.Visible);
  5211. end;
  5212. //------------------------------------------------------------------------------
  5213. procedure TMainForm.ppNetWorkMissonGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5214. begin
  5215. ChangePPMenuColorMap(ppNetWorkMisson.PopupMenu);
  5216. end;
  5217. //------------------------------------------------------------------------------
  5218. procedure TMainForm.ppNetWorkMissonPopup(Sender: TObject);
  5219. begin
  5220. if PageControlNDMission.ActivePageIndex = 0 then
  5221. miNDCancel.Enabled := FLVNetWorkDiskUploadingFiles.SelCount > 0
  5222. else
  5223. miNDCancel.Enabled := FLVNetWorkDiskDownloadingFiles.SelCount > 0;
  5224. end;
  5225. procedure TMainForm.ppSelCallTelGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5226. begin
  5227. ChangePPMenuColorMap(ppSelCallTel.PopupMenu);
  5228. end;
  5229. procedure TMainForm.ppServerListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5230. begin
  5231. ChangePPMenuColorMap(ppServerList.PopupMenu);
  5232. end;
  5233. procedure TMainForm.MeasureItem(Sender: TObject; ACanvas: TCanvas; var Width, Height: Integer);
  5234. begin
  5235. //在OnMeasureItem事件中改变菜单的宽度和高度
  5236. //改变菜单的宽度和高度以容纳文本
  5237. Width := edServerList.Width;
  5238. end;
  5239. procedure TMainForm.miChangeServerClick(Sender: TObject);
  5240. var
  5241. ServerInfo: TServerInfo;
  5242. ItemIndex: Integer;
  5243. RealICQContacterTreeView: TRealICQContacterTreeView;
  5244. begin
  5245. try
  5246. SetGetMoreUserEvent;
  5247. if Sender = nil then
  5248. begin
  5249. //RealICQClient.SendGetMoreBranch(FCurrentServerID);
  5250. RealICQClient.SendGetBranchs(FCurrentServerID, 0);
  5251. end
  5252. else
  5253. begin
  5254. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf((Sender as TMenuItem).Hint)] as TServerInfo;
  5255. if ServerInfo.ServerName = edServerList.Text then
  5256. Exit;
  5257. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  5258. if ItemIndex >= 0 then
  5259. begin
  5260. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5261. try
  5262. RealICQContacterTreeView.Clear;
  5263. FreeAndNil(RealICQContacterTreeView);
  5264. FContacterTreeViews.Delete(ItemIndex);
  5265. except
  5266. //Exit;
  5267. end;
  5268. end;
  5269. ImgLoadingMoreBranchs.Visible := True;
  5270. ScrollBoxMoreUser.Visible := False;
  5271. edServerList.Text := ServerInfo.ServerName;
  5272. //RealICQClient.SendGetMoreBranch(ServerInfo.ServerId);
  5273. RealICQClient.SendGetBranchs(ServerInfo.ServerId, 0);
  5274. FCurrentServerID := ServerInfo.ServerId;
  5275. end;
  5276. except
  5277. edServerList.Text := '';
  5278. end;
  5279. end;
  5280. //------------------------------------------------------------------------------
  5281. procedure TMainForm.ppTeamListViewGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5282. begin
  5283. ChangePPMenuColorMap(ppTeamListView.PopupMenu);
  5284. end;
  5285. //------------------------------------------------------------------------------
  5286. procedure TMainForm.ppTeamListViewPopup(Sender: TObject);
  5287. var
  5288. iLoop: Integer;
  5289. RealICQTeam: TRealICQTeam;
  5290. ListItem: TRealICQContacterListItem;
  5291. begin
  5292. actSendTeamMessage.Visible := FLVTeams.SelCount = 1;
  5293. actSeeTeamInformation.Visible := FLVTeams.SelCount = 1;
  5294. actShowTeamHistory.Visible := FLVTeams.SelCount = 1;
  5295. actQuitTeam.Visible := FLVTeams.SelCount = 1;
  5296. actDisbandTeam.Visible := FLVTeams.SelCount = 1;
  5297. actQuitOrDisbandTeams.Visible := FLVTeams.SelCount > 1;
  5298. self.miSendTeamSMS.Visible := FLVTeams.SelCount = 1;
  5299. if FLVTeams.SelCount = 1 then
  5300. begin
  5301. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  5302. begin
  5303. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  5304. if ListItem.Selected then
  5305. begin
  5306. RealICQTeam := ListItem.Data;
  5307. actDisbandTeam.Visible := AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName);
  5308. actQuitTeam.Visible := not actDisbandTeam.Visible;
  5309. if actDisbandTeam.Visible then
  5310. actSeeTeamInformation.Caption := '修改群组详细资料(&D)...'
  5311. else
  5312. actSeeTeamInformation.Caption := '查看群组详细资料(&D)...';
  5313. Break;
  5314. end;
  5315. end;
  5316. end;
  5317. end;
  5318. //------------------------------------------------------------------------------
  5319. procedure TMainForm.ppTrayIconGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5320. begin
  5321. ChangePPMenuColorMap(ppTrayIcon.PopupMenu);
  5322. end;
  5323. //------------------------------------------------------------------------------
  5324. procedure TMainForm.ppUserItemRightMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5325. begin
  5326. ChangePPMenuColorMap(ppUserItemRightMenu.PopupMenu);
  5327. end;
  5328. //------------------
  5329. function TMainForm.GetActiveTabSheetName: string;
  5330. //var ImageButton:TRealICQHoverImage;
  5331. begin
  5332. if ActiveButtonTag < 1 then
  5333. ActiveButtonTag := 1;
  5334. // ImageButton:=FToolBarButtonIconList.Objects[ActiveButtonTag-1] as TRealICQHoverImage;
  5335. Result := FToolBarButtonIconList[ActiveButtonTag - 1];
  5336. end;
  5337. //------------------------------------------------------------------------------
  5338. procedure TMainForm.ppUserItemRightMenuPopup(Sender: TObject);
  5339. var
  5340. iLoop, ItemIndex: Integer;
  5341. GroupName, TabSheetName: string;
  5342. Friend: TRealICQEmployee;
  5343. MenuItem: TMenuItem;
  5344. RealICQContacterTreeView: TRealICQContacterTreeView;
  5345. RealICQFriendTreeView: TRealICQContacterTreeView;
  5346. procedure SetMenuItemVisible;
  5347. begin
  5348. actSendMessage.Visible := actSendMessage.Enabled;
  5349. actSeeInformation.Visible := actSeeInformation.Enabled;
  5350. actShowHistory.Visible := actShowHistory.Enabled;
  5351. actChangeRemark.Visible := actChangeRemark.Enabled;
  5352. actDelFriend.Visible := actDelFriend.Enabled;
  5353. actRemoveUser.Visible := actRemoveUser.Enabled;
  5354. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5355. miGroup.Visible := miGroup.Enabled;
  5356. end;
  5357. begin
  5358. miGoSpace.Visible := ShowSNS;
  5359. RealICQContacterTreeView := nil;
  5360. RealICQFriendTreeView := nil;
  5361. TabSheetName := GetActiveTabSheetName;
  5362. //如果是在“最近联系人”中弹出右键菜单
  5363. if TabSheetName = LVLatests then
  5364. begin
  5365. actSendMessage.Enabled := FLVLatests.SelCount = 1;
  5366. actSeeInformation.Enabled := FLVLatests.SelCount = 1;
  5367. actShowHistory.Enabled := FLVLatests.SelCount = 1;
  5368. actChangeRemark.Enabled := False;
  5369. actDelFriend.Enabled := False;
  5370. actRemoveUser.Enabled := False;
  5371. miGroup.Enabled := False;
  5372. miManageGroup.Enabled := False;
  5373. miManageGroup.Visible := False;
  5374. menuItemShowGroup.Visible := False;
  5375. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5376. SetMenuItemVisible;
  5377. Exit;
  5378. end;
  5379. actSendMessage.Enabled := False;
  5380. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5381. actSeeInformation.Enabled := False;
  5382. ;
  5383. actShowHistory.Enabled := False;
  5384. actChangeRemark.Enabled := False;
  5385. actRemoveUser.Enabled := False;
  5386. actDelFriend.Enabled := False;
  5387. miGroup.Enabled := False;
  5388. miManageGroup.Enabled := False;
  5389. miManageGroup.Visible := False;
  5390. menuItemShowGroup.Visible := False;
  5391. if TabSheetName = LVMyContacters then
  5392. begin
  5393. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  5394. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5395. if (RealICQContacterTreeView.GetSelectedEmployee <> nil) then
  5396. begin
  5397. actSendMessage.Enabled := True;
  5398. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5399. actSeeInformation.Enabled := True;
  5400. actShowHistory.Enabled := True;
  5401. actChangeRemark.Enabled := True;
  5402. miGroup.Enabled := False;
  5403. actRemoveUser.Enabled := False;
  5404. actDelFriend.Enabled := False;
  5405. end;
  5406. SetMenuItemVisible;
  5407. Exit;
  5408. end;
  5409. if TabSheetName = LVMoreUsers then
  5410. begin
  5411. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  5412. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5413. if (RealICQContacterTreeView.GetSelectedEmployee <> nil) then
  5414. begin
  5415. actSendMessage.Enabled := True;
  5416. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5417. actSeeInformation.Enabled := True;
  5418. actShowHistory.Enabled := True;
  5419. actChangeRemark.Enabled := True;
  5420. miGroup.Enabled := False;
  5421. actRemoveUser.Enabled := False;
  5422. actDelFriend.Enabled := False;
  5423. end;
  5424. SetMenuItemVisible;
  5425. Exit;
  5426. end;
  5427. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  5428. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5429. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  5430. miManageGroup.Enabled := True;
  5431. miManageGroup.Visible := True;
  5432. menuItemShowGroup.Visible := True;
  5433. if Friend <> nil then
  5434. begin
  5435. GroupName := Friend.BranchID;
  5436. if GroupName = LvFriends then
  5437. actDelFriend.Enabled := True;
  5438. actSendMessage.Enabled := True;
  5439. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5440. actSeeInformation.Enabled := True;
  5441. actShowHistory.Enabled := True;
  5442. actChangeRemark.Enabled := True;
  5443. miGroup.Enabled := True and (not FSearchListViewInVisible);
  5444. actRemoveUser.Enabled := True;
  5445. SetMenuItemVisible;
  5446. end
  5447. else
  5448. begin
  5449. SetMenuItemVisible;
  5450. Exit;
  5451. end;
  5452. if AnsiSameStr(GroupName, LVFriends) then
  5453. begin
  5454. miGroup.Caption := '移动至组(&M)...';
  5455. actRemoveUser.Enabled := False;
  5456. end
  5457. else
  5458. begin
  5459. //在自定义组的用户列表控件上弹出右键菜单
  5460. actSendMessage.Enabled := True;
  5461. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5462. actSeeInformation.Enabled := True;
  5463. actShowHistory.Enabled := True;
  5464. actChangeRemark.Enabled := True;
  5465. miGroup.Enabled := True and (not FSearchListViewInVisible);
  5466. miGroup.Caption := '移动至组(&M)...';
  5467. end;
  5468. miGroup.Clear;
  5469. if FShowGroup then
  5470. begin
  5471. for iLoop := 0 to FGroups.Count - 1 do
  5472. begin
  5473. if GroupName = FGroups[iLoop] then
  5474. continue;
  5475. MenuItem := TMenuItem.Create(miGroup);
  5476. MenuItem.Caption := FGroups[iLoop];
  5477. MenuItem.OnClick := miMoveGroupClick;
  5478. MenuItem.Enabled := miGroup.Enabled;
  5479. miGroup.Add(MenuItem);
  5480. end;
  5481. MenuItem := TMenuItem.Create(miGroup);
  5482. MenuItem.Caption := '-';
  5483. miGroup.Add(MenuItem);
  5484. end;
  5485. miGroup.Enabled := miGroup.Count > 0;
  5486. end;
  5487. //------------------------------------------------------------------------------
  5488. procedure TMainForm.WMQueryEndSession(var message: TWMQUERYENDSESSION);
  5489. begin
  5490. try
  5491. try
  5492. //Dialogs.ShowMessage('关机');
  5493. FreeAndNil(NotReadMessageBoxForm);
  5494. Application.Terminate;
  5495. if RealICQClient.Logined then
  5496. RealICQClient.Logout;
  5497. except
  5498. end;
  5499. finally
  5500. message.Result := 1; //允许
  5501. end;
  5502. end;
  5503. //------------------------------------------------------------------------------
  5504. procedure TMainForm.WMPowerBroadcast(var message: TMessage);
  5505. begin
  5506. try
  5507. try
  5508. if message.wparam = 4 then //..休眠
  5509. begin
  5510. if RealICQClient.Logined then
  5511. RealICQClient.Logout;
  5512. end;
  5513. if message.wparam = 18 then // 休眠重起
  5514. begin
  5515. if RealICQClient.SavedPassword then
  5516. RealICQClient.LoginAsSaved;
  5517. end;
  5518. except
  5519. end;
  5520. finally
  5521. message.Result := 1; //允许
  5522. end;
  5523. end;
  5524. //------------------------------------------------------------------------------
  5525. procedure TMainForm.CMWininichange(var Message: TWMWinIniChange);
  5526. begin
  5527. ChangeUIColor(FUIMainColor);
  5528. DisableAlign;
  5529. try
  5530. PostMessage(Handle, WM_SIZE, 0, 0);
  5531. finally
  5532. EnableAlign;
  5533. end;
  5534. end;
  5535. //------------------------------------------------------------------------------
  5536. procedure TMainForm.SetSearchListViewVisible(AShow: Boolean);
  5537. begin
  5538. FSearchListViewInVisible := AShow;
  5539. if AShow then
  5540. begin
  5541. pnlSearch.Left := shpFilterBorder.Left + 9;
  5542. pnlSearch.Top := shpFilterBorder.Top + shpFilterBorder.Height + 28;
  5543. pnlSearch.Width := shpFilterBorder.Width;
  5544. pnlSearch.Visible := True;
  5545. end
  5546. else
  5547. begin
  5548. pnlSearch.Visible := False;
  5549. end;
  5550. end;
  5551. //------------------------------------------------------------------------------
  5552. procedure TMainForm.edFilterKeywordChange(Sender: TObject);
  5553. var
  5554. iLoop: Integer;
  5555. RealICQUser: TRealICQUser;
  5556. KeyWord, UserCaption: string;
  5557. ItemIndex: Integer;
  5558. ListItem: TRealICQContacterListItem;
  5559. AUsers: TStringList;
  5560. begin
  5561. KeyWord := Trim(edFilterKeyword.Text);
  5562. if (KeyWord = '查找联系人...') or (KeyWord = '') then
  5563. begin
  5564. if FSearchListViewInVisible then
  5565. SetSearchListViewVisible(False);
  5566. end
  5567. else
  5568. begin
  5569. if not FSearchListViewInVisible then
  5570. SetSearchListViewVisible(True);
  5571. if AnsiSameText(KeyWord, FLastSearchKeyWord) then
  5572. Exit;
  5573. //删除当前结果中不符合新的查询条件的记录
  5574. FLastSearchKeyWord := KeyWord;
  5575. for iLoop := FSearchListView.Items.Count - 1 downto 0 do
  5576. begin
  5577. if not AnsiSameText(Trim(edFilterKeyword.Text), KeyWord) then
  5578. Exit;
  5579. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  5580. RealICQUser := ListItem.Data;
  5581. UserCaption := RealICQUser.DisplayName + '' + RealICQUser.LoginName + '' + RealICQUser.Watchword;
  5582. if (AnsiPos(UpperCase(KeyWord), UpperCase(UserCaption)) = 0) and (AnsiPos(UpperCase(KeyWord), GetPYIndexString(RealICQUser.LoginName)) = 0) and (AnsiPos(UpperCase(KeyWord), GetPYIndexString(RealICQUser.DisplayName)) = 0) and (AnsiPos(UpperCase(KeyWord), GetPYIndexString(RealICQUser.Watchword)) = 0) then
  5583. FSearchListView.Items.Delete(iLoop);
  5584. Application.ProcessMessages;
  5585. end;
  5586. FSearchListView.FlashCaptionOnOnline := False;
  5587. //在好友列表中查找
  5588. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  5589. try
  5590. for iLoop := 0 to AUsers.Count - 1 do
  5591. begin
  5592. if not AnsiSameText(FLastSearchKeyWord, KeyWord) then
  5593. begin
  5594. Exit;
  5595. end;
  5596. RealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  5597. if (RealICQUser = RealICQClient.Me) then
  5598. continue;
  5599. UserCaption := RealICQUser.DisplayName + ' ' + RealICQUser.LoginName + ' ' + RealICQUser.Watchword;
  5600. if (AnsiPos(UpperCase(KeyWord), UpperCase(UserCaption)) > 0) or (AnsiPos(UpperCase(KeyWord), GetPYIndexString(RealICQUser.LoginName)) > 0) or (AnsiPos(UpperCase(KeyWord), GetPYIndexString(RealICQUser.DisplayName)) > 0) or (AnsiPos(UpperCase(KeyWord), GetPYIndexString(RealICQUser.Watchword)) > 0) then
  5601. begin
  5602. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  5603. if ItemIndex = -1 then
  5604. begin
  5605. ItemIndex := FSearchListView.Items.Add(RealICQUser.LoginName);
  5606. ListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  5607. BindUserDataToItem(ListItem, RealICQUser);
  5608. Application.ProcessMessages;
  5609. end;
  5610. end;
  5611. end;
  5612. finally
  5613. FreeAndNil(AUsers);
  5614. end;
  5615. FSearchListView.FlashCaptionOnOnline := FFlashCaptionOnOnline;
  5616. if FSearchListView.Items.Count <= 0 then
  5617. begin
  5618. ScrollBoxSearchUser.Visible := False;
  5619. lblSearchResult.Caption := #10 + #13 + ' 无搜索结果';
  5620. lblSearchResult.Visible := True;
  5621. end
  5622. else
  5623. begin
  5624. ScrollBoxSearchUser.Visible := True;
  5625. lblSearchResult.Visible := False;
  5626. end;
  5627. end;
  5628. end;
  5629. procedure TMainForm.edFilterKeywordClick(Sender: TObject);
  5630. var
  5631. KeyWord: string;
  5632. begin
  5633. KeyWord := Trim(edFilterKeyword.Text);
  5634. if KeyWord = '查找联系人...' then
  5635. edFilterKeyword.Text := '';
  5636. edFilterKeyword.Font.Color := clWindowText;
  5637. end;
  5638. //------------------------------------------------------------------------------
  5639. procedure TMainForm.edFilterKeywordExit(Sender: TObject);
  5640. var
  5641. KeyWord: string;
  5642. begin
  5643. KeyWord := Trim(edFilterKeyword.Text);
  5644. if KeyWord = '' then
  5645. edFilterKeyword.Text := '查找联系人...';
  5646. edFilterKeyword.Font.Color := clGray;
  5647. end;
  5648. //------------------------------------------------------------------------------
  5649. procedure TMainForm.SetLoginStateControlState;
  5650. const
  5651. CA_TEXT: string = '您选择了使用CA登录';
  5652. begin
  5653. if (FLoginState = stLeave) or (FLoginState = stBusy) then
  5654. spbLoginState.Caption := FLeaveMessage
  5655. else
  5656. spbLoginState.Caption := StateValues[Integer(FLoginState)];
  5657. RealICQClient.LoginState := FLoginState;
  5658. RealICQClient.LeaveMessage := FLeaveMessage;
  5659. if FSavePassword then
  5660. ImgLstCheckStates.GetIcon(1, spbSavePassword.Icon)
  5661. else
  5662. ImgLstCheckStates.GetIcon(0, spbSavePassword.Icon);
  5663. if RealICQClient.CALogin then
  5664. begin
  5665. ImgLstCheckStates.GetIcon(1, btnCaLogin.Icon);
  5666. edLoginName.Text := CA_TEXT;
  5667. edLoginName.Enabled := False;
  5668. edPassword.Enabled := False;
  5669. spbChangeLoginName.Enabled := False;
  5670. end
  5671. else
  5672. begin
  5673. ImgLstCheckStates.GetIcon(0, btnCaLogin.Icon);
  5674. if SameText(CA_TEXT, edLoginName.Text) then
  5675. edLoginName.Text := '';
  5676. edLoginName.Enabled := True;
  5677. edPassword.Enabled := True;
  5678. spbChangeLoginName.Enabled := True;
  5679. end;
  5680. FAutoLogin := FAutoLogin and FSavePassword;
  5681. spbAutoLogin.Enabled := FSavePassword;
  5682. if FAutoLogin then
  5683. ImgLstCheckStates.GetIcon(1, spbAutoLogin.Icon)
  5684. else
  5685. ImgLstCheckStates.GetIcon(0, spbAutoLogin.Icon);
  5686. end;
  5687. //------------------------------------------------------------------------------
  5688. procedure TMainForm.edLoginNameChange(Sender: TObject);
  5689. begin
  5690. if AnsiSameText(edLoginName.Text, RealICQClient.LoginName) and RealICQClient.SavedPassword then
  5691. begin
  5692. edPassword.Text := '保存的密码';
  5693. lblPasswordTitle.Enabled := False;
  5694. edPassword.Enabled := False;
  5695. spbSavePassword.Enabled := False;
  5696. FLoginAsSavePassword := True;
  5697. FLoginState := RealICQClient.LoginState;
  5698. FLeaveMessage := RealICQClient.LeaveMessage;
  5699. FSavePassword := RealICQClient.SavedPassword;
  5700. FAutoLogin := RealICQClient.AutoLogin;
  5701. SetLoginStateControlState;
  5702. end
  5703. else if FLoginAsSavePassword then
  5704. begin
  5705. edPassword.Text := '';
  5706. edPassword.Enabled := True;
  5707. lblPasswordTitle.Enabled := True;
  5708. spbSavePassword.Enabled := True;
  5709. FLoginAsSavePassword := False;
  5710. FLoginState := stOnline;
  5711. FLeaveMessage := '';
  5712. FSavePassword := False;
  5713. FAutoLogin := False;
  5714. SetLoginStateControlState;
  5715. end;
  5716. end;
  5717. //------------------------------------------------------------------------------
  5718. procedure TMainForm.edPasswordEnter(Sender: TObject);
  5719. begin
  5720. if not RealICQClient.CALogin then
  5721. begin
  5722. Self.FSavePassword := True;
  5723. // FAutoLogin := True;
  5724. RealICQClient.AutoLogin := FAutoLogin;
  5725. SetLoginStateControlState;
  5726. end;
  5727. end;
  5728. //------全市查找-----------------------------
  5729. procedure TMainForm.edtSearchMoreUserChange(Sender: TObject);
  5730. var
  5731. KeyWord: string;
  5732. iIndex, iLoop: Integer;
  5733. //FSearchMoreUserListView:TRealICQContacterListView;
  5734. begin
  5735. KeyWord := Trim((Sender as TEdit).Text);
  5736. iIndex := FContacterListViews.IndexOf(LVMoreUsers);
  5737. FSearchMoreUserListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  5738. FSearchMoreUserListView.Items.Clear;
  5739. if (KeyWord = '查找联系人...') or (KeyWord = '') then
  5740. begin
  5741. pnlSearchMoreUser.Visible := False;
  5742. Exit;
  5743. end
  5744. else
  5745. begin
  5746. RealICQClient.OnSearchUserResult := RealICQClientSearchUserResult;
  5747. RealICQClient.SendSearchMoreUser(KeyWord, FCurrentServerID);
  5748. pnlSearchMoreUser.Left := shpSearchMoreUser.Left;
  5749. pnlSearchMoreUser.Width := pnlSelectServer.Width - 22;
  5750. pnlSearchMoreUser.Top := shpSearchMoreUser.Top + shpSearchMoreUser.Height;
  5751. LblSearchHint.Caption := #10 + #10 + #10 + #10 + #10'正在查询,请稍侯。';
  5752. LblSearchHint.Visible := True;
  5753. ScrollBoxSearchMoreUser.Visible := False;
  5754. ImgLogining.Visible := True;
  5755. pnlSearchMoreUser.Visible := True;
  5756. pnlSearchMoreUser.BringToFront;
  5757. end;
  5758. end;
  5759. //--------------------------------------------------------
  5760. procedure TMainForm.edtSearchMoreUserClick(Sender: TObject);
  5761. var
  5762. KeyWord: string;
  5763. begin
  5764. KeyWord := Trim(edtSearchMoreUser.Text);
  5765. if KeyWord = '查找联系人...' then
  5766. edtSearchMoreUser.Text := '';
  5767. edtSearchMoreUser.Font.Color := clWindowText;
  5768. end;
  5769. procedure TMainForm.edtSearchMoreUserExit(Sender: TObject);
  5770. var
  5771. KeyWord: string;
  5772. begin
  5773. KeyWord := Trim(edtSearchMoreUser.Text);
  5774. if KeyWord = '' then
  5775. edtSearchMoreUser.Text := '查找联系人...';
  5776. edtSearchMoreUser.Font.Color := clGray;
  5777. end;
  5778. //------------------------------------------------------------------------------
  5779. procedure TMainForm.edWatchwordExit(Sender: TObject);
  5780. var
  5781. AWatchword: WideString;
  5782. begin
  5783. spbWatchword.Visible := True;
  5784. shpWatchwordBorder.Visible := False;
  5785. edWatchword.Visible := False;
  5786. if RealICQClient.Logined then
  5787. begin
  5788. if (not AnsiSameStr(Trim(edWatchword.Text), RealICQClient.Me.Watchword)) and (not AnsiSameStr(Trim(edWatchword.Text), '在此键入您的个性签名')) then
  5789. begin
  5790. AWatchword := Trim(edWatchword.Text);
  5791. spbWatchword.Hint := AWatchword;
  5792. spbWatchword.ShowHint := False;
  5793. //字符串长度过长时,截短字符串并在后面显示“...”
  5794. while spbWatchword.Canvas.TextWidth(AWatchword) > pnlTop.Width - 86 do
  5795. begin
  5796. if Length(AWatchword) > 3 then
  5797. begin
  5798. if Copy(AWatchword, Length(AWatchword) - 2, Length(AWatchword)) = '...' then
  5799. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 3);
  5800. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 1) + '...';
  5801. end
  5802. else
  5803. break;
  5804. spbWatchword.ShowHint := True;
  5805. end;
  5806. spbWatchword.Caption := edWatchword.Text;
  5807. RealICQClient.ChangeBaseInformation(RealICQClient.Me.DisplayName, Trim(edWatchword.Text));
  5808. end;
  5809. end;
  5810. end;
  5811. //------------------------------------------------------------------------------
  5812. procedure TMainForm.edWatchwordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  5813. begin
  5814. if Key = 13 then
  5815. edWatchwordExit(edWatchword);
  5816. end;
  5817. //------------------------------------------------------------------------------
  5818. procedure TMainForm.edWebSearchKeyWordEnter(Sender: TObject);
  5819. begin
  5820. //
  5821. end;
  5822. //------------------------------------------------------------------------------
  5823. procedure TMainForm.edWebSearchKeyWordExit(Sender: TObject);
  5824. begin
  5825. end;
  5826. //------------------------------------------------------------------------------
  5827. procedure TMainForm.edWebSearchKeyWordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  5828. begin
  5829. if Key = 13 then
  5830. spbWebSearchClick(nil);
  5831. end;
  5832. //------------------------------------------------------------------------------
  5833. procedure TMainForm.spbWatchwordClick(Sender: TObject);
  5834. begin
  5835. if not RealICQClient.Logined then
  5836. Exit;
  5837. spbWatchword.Visible := False;
  5838. shpWatchwordBorder.Left := spbWatchword.Left;
  5839. shpWatchwordBorder.Top := spbWatchword.Top;
  5840. shpWatchwordBorder.Width := pnlTop.Width - 66;
  5841. shpWatchwordBorder.Height := spbWatchword.Height;
  5842. edWatchword.Left := shpWatchwordBorder.Left + 2;
  5843. edWatchword.Top := shpWatchwordBorder.Top + (shpWatchwordBorder.Height - edWatchword.Height) div 2 + 1;
  5844. edWatchword.Width := shpWatchwordBorder.Width - 6;
  5845. edWatchword.Text := RealICQClient.Me.Watchword;
  5846. shpWatchwordBorder.Visible := True;
  5847. edWatchword.Visible := True;
  5848. edWatchword.SetFocus;
  5849. edWatchword.SelStart := 0;
  5850. edWatchword.SelLength := Length(edWatchword.Text);
  5851. shpWatchwordBorder.BringToFront;
  5852. edWatchword.BringToFront;
  5853. end;
  5854. //------------------------------------------------------------------------------
  5855. procedure TMainForm.spbWebSearchClick(Sender: TObject);
  5856. begin
  5857. //
  5858. end;
  5859. //------------------------------------------------------------------------------
  5860. procedure TMainForm.spbWinMeetClick(Sender: TObject);
  5861. var
  5862. WinMeetPath, Parameter: string;
  5863. Branch: TRealICQBranch;
  5864. ItemIndex: Integer;
  5865. RealICQContacterTreeView: TRealICQContacterTreeView;
  5866. begin
  5867. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  5868. if (ItemIndex < 0) then
  5869. Exit;
  5870. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5871. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(MainForm.RealICQClient.Me.BranchID);
  5872. if (ItemIndex < 0) then
  5873. Exit;
  5874. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  5875. while Branch.Node.Parent <> nil do
  5876. begin
  5877. Branch := TRealICQBranch(Branch.Node.Parent.Data);
  5878. end;
  5879. WinMeetPath := GetFilePahtFromRegedit('\Software\WinSoft\WinMeet', 'AppPath');
  5880. if Trim(WinMeetPath) = '' then
  5881. begin
  5882. ShowMessage('您还没有安装视频会议客户端!');
  5883. Exit;
  5884. end;
  5885. Parameter := ' ' + MainForm.RealICQClient.LoginName + ' ' + MD5En(RealICQClient.Password) + ' ' + Branch.BranchID;
  5886. ShellExecute(handle, 'open', PChar(WinMeetPath), PChar(Parameter), '', SW_SHOWNORMAL);
  5887. end;
  5888. //------------------------------------------------------------------------------
  5889. procedure TMainForm.CreateParams(var Params: TCreateParams);
  5890. begin
  5891. inherited;
  5892. with Params do
  5893. begin
  5894. Params.WndParent := 0;
  5895. end;
  5896. end;
  5897. //------------------------------------------------------------------------------
  5898. procedure TMainForm.WndProc(var Message: TMessage);
  5899. begin
  5900. inherited wndproc(message);
  5901. if message.msg = WM_DEVICECHANGE then
  5902. RealICQClient.CheckAVDevice;
  5903. if message.msg = CLOSEWINDOWS then
  5904. QuitWindows;
  5905. {if (message.msg = WM_PAINT) or (message.msg = WM_NCPAINT) then
  5906. begin
  5907. ActionMainMenuBar.Refresh;
  5908. end;}
  5909. end;
  5910. procedure TMainForm.spbAddToNAClick(Sender: TObject);
  5911. var
  5912. TabSheet: TTabSheet;
  5913. WebBrowser: TWebBrowser;
  5914. begin
  5915. MainForm.FormStyle := fsNormal;
  5916. try
  5917. try
  5918. TabSheet := pgcMultiWeb.ActivePage;
  5919. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  5920. AddToFavorite(WebBrowser);
  5921. except
  5922. end;
  5923. finally
  5924. // if MainForm.AlwaysOnTop then
  5925. // MainForm.FormStyle := fsStayOnTop
  5926. // else
  5927. // MainForm.FormStyle := fsNormal;
  5928. end;
  5929. end;
  5930. //------------------------------------------------------------------------------
  5931. procedure TMainForm.spbWebCloseClick(Sender: TObject);
  5932. var
  5933. TabSheet: TTabSheet;
  5934. WebBrowser: TWebBrowser;
  5935. begin
  5936. TabSheet := pgcMultiWeb.ActivePage;
  5937. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  5938. if pgcMultiWeb.PageCount > 1 then
  5939. begin
  5940. try
  5941. if WebBrowser.Busy then
  5942. WebBrowser.Stop;
  5943. except
  5944. end;
  5945. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  5946. TabSheet.PageControl := nil;
  5947. FreeAndNil(TabSheet);
  5948. end
  5949. else
  5950. begin
  5951. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  5952. WebBrowser.Navigate('about:blank');
  5953. end;
  5954. end;
  5955. procedure TMainForm.spbAutoLoginClick(Sender: TObject);
  5956. begin
  5957. FAutoLogin := not FAutoLogin;
  5958. RealICQClient.AutoLogin := FAutoLogin;
  5959. SetLoginStateControlState;
  5960. end;
  5961. //------------------------------------------------------------------------------
  5962. procedure TMainForm.HideMainForm;
  5963. var
  5964. BaseTop, BaseLeft: Integer;
  5965. begin
  5966. if FMovingMainForm then
  5967. Exit;
  5968. if RealICQClient.Logining then
  5969. begin
  5970. FDblClickedTrayIcon := True;
  5971. TimerForShowMainForm.Enabled := False;
  5972. TimerForShowMainForm.Enabled := True;
  5973. Exit;
  5974. end;
  5975. BaseTop := (Height - ClientHeight) div 2;
  5976. BaseLeft := (Width - ClientWidth) div 2;
  5977. DisableAlign;
  5978. try
  5979. if FHidePosition = hpTop then
  5980. begin
  5981. Top := -(Height - BaseTop * 2 - 2);
  5982. end;
  5983. if FHidePosition = hpLeft then
  5984. begin
  5985. Left := -(Width - BaseLeft * 2 - 2);
  5986. end;
  5987. if FHidePosition = hpRight then
  5988. begin
  5989. Left := Screen.WorkAreaWidth - BaseLeft - 4;
  5990. end;
  5991. finally
  5992. EnableAlign;
  5993. PostMessage(Handle, WM_KILLFOCUS, 0, 0);
  5994. FMainFormHidden := True;
  5995. end;
  5996. end;
  5997. //------------------------------------------------------------------------------
  5998. procedure TMainForm.ShowMainForm;
  5999. var
  6000. BaseTop, BaseLeft: Integer;
  6001. begin
  6002. if FMovingMainForm then
  6003. Exit;
  6004. BaseTop := (Height - ClientHeight) div 2;
  6005. BaseLeft := (Width - ClientWidth) div 2;
  6006. DisableAlign;
  6007. try
  6008. if FHidePosition = hpTop then
  6009. begin
  6010. Top := -BaseTop;
  6011. end;
  6012. if FHidePosition = hpLeft then
  6013. begin
  6014. Left := -BaseLeft;
  6015. end;
  6016. if FHidePosition = hpRight then
  6017. begin
  6018. Left := Screen.WorkAreaWidth - Width + BaseLeft;
  6019. end;
  6020. finally
  6021. EnableAlign;
  6022. PostMessage(Handle, WM_SETFOCUS, 0, 0);
  6023. FMainFormHidden := False;
  6024. end;
  6025. end;
  6026. //------------------------------------------------------------------------------
  6027. procedure TMainForm.TimerForShowMainFormTimer(Sender: TObject);
  6028. begin
  6029. FDblClickedTrayIcon := False;
  6030. TimerForShowMainForm.Enabled := False;
  6031. end;
  6032. //------------------------------------------------------------------------------
  6033. procedure TMainForm.TimerForHideMainFormTimer(Sender: TObject);
  6034. begin
  6035. if not FAutoHide then
  6036. begin
  6037. if FMainFormHidden then
  6038. ShowMainForm;
  6039. FHidePosition := hpNone;
  6040. TimerForHideMainForm.Enabled := False;
  6041. Exit;
  6042. end;
  6043. TimerForHideMainForm.Enabled := False;
  6044. try
  6045. if FMovingMainForm then
  6046. Exit;
  6047. if (Mouse.CursorPos.X >= Left) and (Mouse.CursorPos.X <= Left + Width) and (Mouse.CursorPos.Y >= Top) and (Mouse.CursorPos.Y <= Top + Height) then
  6048. begin
  6049. if FMainFormHidden then
  6050. ShowMainForm;
  6051. FDblClickedTrayIcon := False;
  6052. end
  6053. else
  6054. begin
  6055. if (not FMainFormHidden) and (not FDblClickedTrayIcon) then
  6056. HideMainForm;
  6057. end;
  6058. finally
  6059. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  6060. end;
  6061. end;
  6062. //------------------------------------------------------------------------------
  6063. procedure TMainForm.WMMove(var Msg: TMessage);
  6064. var
  6065. BaseTop: Integer;
  6066. begin
  6067. HideUserCardForm;
  6068. FMovingMainForm := False;
  6069. BaseTop := (Height - ClientHeight) div 2;
  6070. if (FHidePosition = hpLeft) or (FHidePosition = hpRight) then
  6071. Height := Screen.WorkAreaHeight + BaseTop * 2;
  6072. if TimerForHideMainForm <> nil then
  6073. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  6074. end;
  6075. //------------------------------------------------------------------------------
  6076. procedure TMainForm.WMSizing(var Msg: TMessage);
  6077. begin
  6078. inherited;
  6079. HideUserCardForm;
  6080. FMovingMainForm := True;
  6081. end;
  6082. //------------------------------------------------------------------------------
  6083. procedure TMainForm.WMSize(var Msg: TMessage);
  6084. begin
  6085. inherited;
  6086. HideUserCardForm;
  6087. FMovingMainForm := False;
  6088. CheckWindowPositon;
  6089. end;
  6090. //------------------------------------------------------------------------------
  6091. procedure TMainForm.WMMoving(var Msg: TMessage);
  6092. var
  6093. BaseTop, BaseLeft: Integer;
  6094. begin
  6095. HideUserCardForm;
  6096. FMovingMainForm := True;
  6097. BaseTop := (Height - ClientHeight) div 2;
  6098. BaseLeft := (Width - ClientWidth) div 2;
  6099. with PRECT(Msg.LParam)^ do
  6100. begin
  6101. if (Top < -BaseTop) then
  6102. begin
  6103. FHidePosition := hpTop;
  6104. Top := -BaseTop;
  6105. Bottom := Top + Height;
  6106. end
  6107. else if (Left < -BaseLeft) then
  6108. begin
  6109. FHidePosition := hpLeft;
  6110. Right := Right + (-BaseLeft - Left);
  6111. Top := -BaseTop;
  6112. Left := -BaseLeft;
  6113. Bottom := Screen.WorkAreaHeight + BaseTop * 2;
  6114. end
  6115. else if (Right > (Screen.WorkAreaWidth + BaseLeft)) then
  6116. begin
  6117. FHidePosition := hpRight;
  6118. Top := -BaseTop;
  6119. Right := Screen.WorkAreaWidth + BaseLeft;
  6120. Left := Right - Width;
  6121. Bottom := Screen.WorkAreaHeight + BaseTop * 2;
  6122. end
  6123. else if (Top > -BaseTop) and (Left > -BaseLeft) and (Right < (Screen.WorkAreaWidth + BaseLeft)) then
  6124. begin
  6125. FHidePosition := hpNone;
  6126. Bottom := Top + Height;
  6127. end;
  6128. end;
  6129. end;
  6130. //------------------------------------------------------------------------------
  6131. procedure TMainForm.spbTelMeetingClick(Sender: TObject);
  6132. begin
  6133. //
  6134. end;
  6135. procedure TMainForm.spbCancelFilterClick(Sender: TObject);
  6136. begin
  6137. edFilterKeyword.Text := '查找联系人...';
  6138. edFilterKeyword.Font.Color := clGray;
  6139. end;
  6140. procedure TMainForm.spbChangeLoginNameClick(Sender: TObject);
  6141. var
  6142. Point: TPoint;
  6143. begin
  6144. Point.X := 0;
  6145. Point.Y := spLoginNameBorder.Height + 1;
  6146. Point := spLoginNameBorder.ClientToScreen(Point);
  6147. ppLoginedUsers.Popup(Point.X, Point.Y);
  6148. end;
  6149. procedure TMainForm.spbContacterViewStyleClick(Sender: TObject);
  6150. var
  6151. Point: TPoint;
  6152. begin
  6153. Point.X := 0;
  6154. Point.Y := spbContacterViewStyle.Height + 1;
  6155. Point := spbContacterViewStyle.ClientToScreen(Point);
  6156. ppContacterViewStyle.Popup(Point.X, Point.Y);
  6157. end;
  6158. //------------------------------------------------------------------------------
  6159. procedure TMainForm.spbDisplayNameClick(Sender: TObject);
  6160. var
  6161. Point: TPoint;
  6162. begin
  6163. Point.X := 0;
  6164. Point.Y := spbDisplayName.Height + 1;
  6165. Point := spbDisplayName.ClientToScreen(Point);
  6166. ppChangeStates.Popup(Point.X, Point.Y);
  6167. end;
  6168. //------------------------------------------------------------------------------
  6169. procedure TMainForm.spbEmailClick(Sender: TObject);
  6170. begin
  6171. //AddWebBrowserToPageControl('http://www.lxtalk.com/rd/', 999);
  6172. end;
  6173. //------------------------------------------------------------------------------
  6174. procedure TMainForm.spbFindTeamClick(Sender: TObject);
  6175. begin
  6176. if SearchTeamForm <> nil then
  6177. begin
  6178. SearchTeamForm.BringToFront;
  6179. Exit;
  6180. end;
  6181. SearchTeamForm := TSearchTeamForm.Create(Application);
  6182. SearchTeamForm.Show;
  6183. end;
  6184. //------------------------------------------------------------------------------
  6185. procedure TMainForm.spbGoClick(Sender: TObject);
  6186. var
  6187. TabSheet: TTabSheet;
  6188. WebBrowser: TWebBrowser;
  6189. begin
  6190. TabSheet := pgcMultiWeb.ActivePage;
  6191. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6192. WebBrowser.Tag := -1;
  6193. try
  6194. if (WebBrowser.Busy) then
  6195. WebBrowser.Stop;
  6196. except
  6197. end;
  6198. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  6199. WebBrowser.Navigate(cbxURLInputer.Text);
  6200. end;
  6201. //------------------------------------------------------------------------------
  6202. procedure TMainForm.spbLoginStateClick(Sender: TObject);
  6203. var
  6204. Point: TPoint;
  6205. begin
  6206. Point.X := 0;
  6207. Point.Y := spbLoginState.Height + 1;
  6208. Point := spbLoginState.ClientToScreen(Point);
  6209. ppLoginStates.Popup(Point.X, Point.Y);
  6210. end;
  6211. //------------------------------------------------------------------------------
  6212. procedure TMainForm.spbNDCancelAllClick(Sender: TObject);
  6213. var
  6214. AMissionID: string;
  6215. UploadMission: TUploadMission;
  6216. ListItem: TRealICQContacterListItem;
  6217. begin
  6218. try
  6219. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count > 0) then
  6220. begin
  6221. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  6222. if Assigned(ListItem) then
  6223. begin
  6224. UploadMission := TUploadMission(ListItem.Data);
  6225. if Assigned(UploadMission) then
  6226. begin
  6227. AMissionID := UploadMission.FID;
  6228. try
  6229. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  6230. FreeAndNil(UploadMission);
  6231. except
  6232. end;
  6233. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  6234. end;
  6235. end;
  6236. end;
  6237. except
  6238. end;
  6239. try
  6240. if FLVNetWorkDiskUploadingFiles <> nil then
  6241. begin
  6242. FLVNetWorkDiskUploadingFiles.Items.Clear;
  6243. FLVNetWorkDiskUploadingFiles.ReDrawAll;
  6244. end;
  6245. except
  6246. end;
  6247. try
  6248. if FLVNetWorkDiskDownloadingFiles <> nil then
  6249. begin
  6250. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  6251. FLVNetWorkDiskDownloadingFiles.ReDrawAll;
  6252. end;
  6253. except
  6254. end;
  6255. ClearFileMissions;
  6256. pnlNDMissions.Visible := False;
  6257. SplitterNDMissions.Visible := False;
  6258. spbNDCancelAll.Enabled := False;
  6259. FConfirmReplaceResult := -1;
  6260. FLastDownloadDirectory := '';
  6261. CheckNDControlState;
  6262. end;
  6263. //------------------------------------------------------------------------------
  6264. procedure TMainForm.spbNDConnectClick(Sender: TObject);
  6265. var
  6266. LoginName: string;
  6267. begin
  6268. RealICQNetWorkDiskClient.TCPClient.RemoteAddress := RealICQClient.NetWorkDiskServerAddress;
  6269. RealICQNetWorkDiskClient.TCPClient.RemotePort := RealICQClient.NetWorkDiskServerPort;
  6270. RealICQNetWorkDiskClient.TCPClient.Proxy.Assign(RealICQClient.TCPClient.Proxy);
  6271. LoginName := RealICQClient.LoginName;
  6272. if Pos('+', RealICQClient.LoginName) > 0 then
  6273. LoginName := Copy(RealICQClient.LoginName, Pos('+', RealICQClient.LoginName) + 1, Length(RealICQClient.LoginName));
  6274. RealICQNetWorkDiskClient.Login(LoginName, RealICQClient.Password);
  6275. end;
  6276. //------------------------------------------------------------------------------
  6277. procedure TMainForm.spbSavePasswordClick(Sender: TObject);
  6278. begin
  6279. FSavePassword := not FSavePassword;
  6280. SetLoginStateControlState;
  6281. end;
  6282. //------------------------------------------------------------------------------
  6283. procedure TMainForm.spbSelectServerClick(Sender: TObject);
  6284. var
  6285. Point: TPoint;
  6286. begin
  6287. Point.X := 0;
  6288. Point.Y := spServerListBorder.Height;
  6289. Point := spServerListBorder.ClientToScreen(Point);
  6290. ppServerList.Popup(Point.X, Point.Y);
  6291. end;
  6292. procedure TMainForm.spbSelLanguageClick(Sender: TObject);
  6293. var
  6294. Point: TPoint;
  6295. begin
  6296. Point.X := 0;
  6297. Point.Y := (Sender as TRealICQSpeedButton).Height + 1;
  6298. Point := (Sender as TRealICQSpeedButton).ClientToScreen(Point);
  6299. ppLanguages.Popup(Point.X, Point.Y);
  6300. end;
  6301. procedure TMainForm.spbSelUIColorClick(Sender: TObject);
  6302. var
  6303. Point: TPoint;
  6304. begin
  6305. Point.X := 0;
  6306. Point.Y := (Sender as TRealICQSpeedButton).Height + 1;
  6307. Point := (Sender as TRealICQSpeedButton).ClientToScreen(Point);
  6308. ppColors.Popup(Point.X, Point.Y);
  6309. end;
  6310. procedure TMainForm.spbShowHideRightClick(Sender: TObject);
  6311. begin
  6312. //ShowOrHideMuiltiWeb;
  6313. end;
  6314. procedure TMainForm.spbStopClick(Sender: TObject);
  6315. var
  6316. TabSheet: TTabSheet;
  6317. WebBrowser: TWebBrowser;
  6318. begin
  6319. try
  6320. TabSheet := pgcMultiWeb.ActivePage;
  6321. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6322. if WebBrowser.Busy then
  6323. WebBrowser.Stop;
  6324. except
  6325. end;
  6326. end;
  6327. //------------------------------------------------------------------------------
  6328. procedure TMainForm.TabSetMuiltWebClick(Sender: TObject);
  6329. var
  6330. TabSheet: TTabSheet;
  6331. WebBrowser: TWebBrowser;
  6332. begin
  6333. pgcMultiWeb.ActivePageIndex := TabSetMuiltWeb.TabIndex;
  6334. try
  6335. TabSheet := pgcMultiWeb.ActivePage;
  6336. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6337. if not AnsiSameText(WebBrowser.LocationURL, 'about:blank') then
  6338. begin
  6339. with cbxURLInputer.ItemsEx.Add do
  6340. begin
  6341. Caption := WebBrowser.LocationURL;
  6342. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  6343. ImageIndex := 2
  6344. else if Copy(Caption, 1, 4) = 'ftp:' then
  6345. ImageIndex := 1
  6346. else
  6347. ImageIndex := 0;
  6348. end;
  6349. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  6350. end;
  6351. except
  6352. end;
  6353. end;
  6354. //------------------------------------------------------------------------------
  6355. procedure TMainForm.TabSetMuiltWebGetImageIndex(Sender: TObject; TabIndex: Integer; var ImageIndex: Integer);
  6356. var
  6357. TabSheet: TTabSheet;
  6358. WebBrowser: TWebBrowser;
  6359. AImageIndex: Integer;
  6360. begin
  6361. AImageIndex := 0;
  6362. try
  6363. TabSheet := pgcMultiWeb.Pages[TabIndex];
  6364. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6365. if not AnsiSameText(WebBrowser.LocationURL, 'about:blank') then
  6366. begin
  6367. with cbxURLInputer.ItemsEx.Add do
  6368. begin
  6369. Caption := WebBrowser.LocationURL;
  6370. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  6371. ImageIndex := 2
  6372. else if Copy(Caption, 1, 4) = 'ftp:' then
  6373. ImageIndex := 1
  6374. else
  6375. ImageIndex := 0;
  6376. AImageIndex := ImageIndex;
  6377. end;
  6378. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  6379. end;
  6380. except
  6381. end;
  6382. ImageIndex := AImageIndex;
  6383. end;
  6384. //------------------------------------------------------------------------------
  6385. procedure TMainForm.TabSetNDMissionsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
  6386. begin
  6387. PageControlNDMission.ActivePageIndex := TabSetNDMissions.TabIndex;
  6388. end;
  6389. //------------------------------------------------------------------------------
  6390. procedure TMainForm.TabSetNDMissionsClick(Sender: TObject);
  6391. begin
  6392. PageControlNDMission.ActivePageIndex := TabSetNDMissions.TabIndex;
  6393. end;
  6394. //------------------------------------------------------------------------------
  6395. procedure TMainForm.TimerForCheckDblClickTimer(Sender: TObject);
  6396. begin
  6397. TimerForCheckDblClick.Enabled := False;
  6398. //if AutoUpdateForm <> nil then Exit;
  6399. SetForegroundWindow(TrueHiddenMainForm.Handle);
  6400. if RealICQClient.Logined and RealICQClient.Connected then
  6401. ppChangeStates.Popup(FCursorPosX, Screen.WorkAreaHeight)
  6402. else
  6403. ppTrayIcon.Popup(FCursorPosX, Screen.WorkAreaHeight);
  6404. end;
  6405. //------------------------------------------------------------------------------
  6406. procedure TMainForm.TimerForCheckLogoutTimeoutTimer(Sender: TObject);
  6407. begin
  6408. TimerForCheckLogoutTimeout.Enabled := False;
  6409. RealICQClient.Logout;
  6410. SetUIState;
  6411. end;
  6412. //------------------------------------------------------------------------------
  6413. procedure TMainForm.TrayIconClick(Sender: TObject);
  6414. begin
  6415. FCursorPosX := Mouse.CursorPos.X;
  6416. TimerForCheckDblClick.Interval := GetDoubleClickTime();
  6417. if not TimerForCheckDblClick.Enabled then
  6418. TimerForCheckDblClick.Enabled := True;
  6419. end;
  6420. //------------------------------------------------------------------------------
  6421. procedure TMainForm.OpenNotReadMessage(iIndex: Integer);
  6422. var
  6423. nTeamID: string;
  6424. MessageID, SMSReceiver: string;
  6425. SystemMessage: TRealICQSystemMessage;
  6426. SMSForm: TSMSForm;
  6427. MessageList: TList;
  6428. NotReadMessage: TNotReadMessage;
  6429. begin
  6430. if (iIndex < 0) and (iIndex >= FNotReadMessages.Count) then
  6431. Exit;
  6432. if FNotReadMessages.Count = 0 then
  6433. actOpenMainForm.Execute
  6434. else
  6435. begin
  6436. MessageID := FNotReadMessages.Strings[iIndex];
  6437. if AnsiSameStr(Copy(MessageID, 1, Length(SMSMessageID)), SMSMessageID) then
  6438. begin
  6439. SMSReceiver := Copy(MessageID, Length(SMSMessageID) + 1, Length(MessageID) - Length(SMSMessageID));
  6440. // if SMSReceiver <> '' then
  6441. SMSForm := OpenSMSForm(SMSReceiver)
  6442. // else
  6443. // SMSForm := OpenSMSForm()
  6444. end
  6445. else if AnsiSameStr(Copy(MessageID, 1, Length(TeamMessageID)), TeamMessageID) then
  6446. begin
  6447. nTeamID := Copy(MessageID, Length(TeamMessageID) + 1, Length(MessageID) - Length(TeamMessageID));
  6448. OpenTeamTalkingForm(nTeamID);
  6449. end
  6450. else if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  6451. begin
  6452. try
  6453. SystemMessage := FNotReadMessages.Objects[iIndex] as TRealICQSystemMessage;
  6454. ShowSystemMessage(SystemMessage);
  6455. finally
  6456. FNotReadMessages.Delete(iIndex);
  6457. try
  6458. NotReadMessageBoxForm.ShowNotReadMessage;
  6459. NotReadMessageBoxForm.Height := 0;
  6460. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  6461. except
  6462. end;
  6463. end;
  6464. end
  6465. else
  6466. begin
  6467. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  6468. NotReadMessage := MessageList[0];
  6469. OpenTalkingForm(MessageID, True, NotReadMessage.FRealICQClient);
  6470. end;
  6471. end;
  6472. end;
  6473. //------------------------------------------------------------------------------
  6474. procedure TMainForm.TrayIconDblClick(Sender: TObject);
  6475. begin
  6476. TimerForCheckDblClick.Enabled := False;
  6477. OpenNotReadMessage(FNotReadMessages.Count - 1);
  6478. end;
  6479. //------------------------------------------------------------------------------
  6480. procedure TMainForm.TrayIconMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  6481. var
  6482. iTimes: Integer;
  6483. ANeedShow: Boolean;
  6484. rcTray: TRect;
  6485. hwndTray: hWnd;
  6486. hwndChild: hWnd;
  6487. begin
  6488. try
  6489. if not Assigned(NotReadMessageBoxForm) then
  6490. Exit;
  6491. ANeedShow := (FNotReadMessages <> nil) and (FNotReadMessages.Count > 0) and (MainForm.RealICQClient.Connected) and (TimerForFlashTrayIcon.Enabled);
  6492. if not ANeedShow then
  6493. begin
  6494. if NotReadMessageBoxForm.Visible then
  6495. begin
  6496. NotReadMessageBoxForm.Visible := False;
  6497. NotReadMessageBoxForm.Timer1.Enabled := False;
  6498. end;
  6499. Exit;
  6500. end;
  6501. if (not NotReadMessageBoxForm.Visible) and (NotReadMessageBoxForm.Tag = 1) then
  6502. begin
  6503. //TrayIcon.Hint := '';
  6504. NotReadMessageBoxForm.Tag := 0;
  6505. hwndTray := FindWindow('Shell_TrayWnd', nil);
  6506. hwndChild := FindWindowEx(hwndTray, 0, 'TrayNotifyWnd', nil);
  6507. GetWindowRect(hwndChild, rcTray);
  6508. FTrayIconRect.Left := X - 20;
  6509. FTrayIconRect.Top := rcTray.Top;
  6510. FTrayIconRect.Right := FTrayIconRect.Left + 40;
  6511. FTrayIconRect.Bottom := rcTray.Bottom;
  6512. NotReadMessageBoxForm.ShowNotReadMessage;
  6513. NotReadMessageBoxForm.Height := 0;
  6514. NotReadMessageBoxForm.FRect := FTrayIconRect;
  6515. //NotReadMessageBoxForm.Left := X - NotReadMessageBoxForm.Width div 2;
  6516. NotReadMessageBoxForm.Left := Screen.WorkAreaWidth - NotReadMessageBoxForm.Width;
  6517. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  6518. NotReadMessageBoxForm.FRect.Left := NotReadMessageBoxForm.FRect.Left;
  6519. NotReadMessageBoxForm.FRect.Top := NotReadMessageBoxForm.Top;
  6520. NotReadMessageBoxForm.FRect.Right := NotReadMessageBoxForm.FRect.Right;
  6521. NotReadMessageBoxForm.FRect.Bottom := NotReadMessageBoxForm.FRect.Bottom;
  6522. NotReadMessageBoxForm.Visible := True;
  6523. NotReadMessageBoxForm.Timer1.Enabled := True;
  6524. end;
  6525. //MessageBoxForm.Visible := FNotReadMessages.Count > 0;
  6526. except
  6527. end;
  6528. end;
  6529. procedure TMainForm.TrayIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  6530. begin
  6531. //if AutoUpdateForm <> nil then Exit;
  6532. if Button = mbRight then
  6533. begin
  6534. SetForegroundWindow(TrueHiddenMainForm.Handle);
  6535. ppTrayIcon.Popup(Mouse.CursorPos.X, Screen.WorkAreaHeight);
  6536. end;
  6537. end;
  6538. //------------------------------------------------------------------------------
  6539. {通讯录}
  6540. //------------------------------------------------------------------------------
  6541. procedure TMainForm.tsAddrBookShow(Sender: TObject);
  6542. begin
  6543. //
  6544. end;
  6545. //----保存联系人----------------------------------------------------- ---------
  6546. procedure TMainForm.SaveContacter(Name, Mobile, Tel, Email, Remark, BranchId: string);
  6547. var
  6548. MessageId, ParamValue: string;
  6549. begin
  6550. MessageId := IntToStr(GetTickCount);
  6551. CreateManageGroupMemberMessage('', Name, '', Mobile, Tel, Email, Remark, BranchId, MessageId);
  6552. //发送新增联系人消息
  6553. ParamValue := MessageId + #10 + '' + #10 + Name + #10 + Mobile + #10 + Tel + #10 + Email + #10 + Remark + #10 + '' + #10 + BranchId;
  6554. RealICQClient.SendAddrBookCommand(1, 1, ParamValue);
  6555. end;
  6556. //----修改备注名称--------------------------------------------------------------
  6557. procedure TMainForm.miSendTeamSMSClick(Sender: TObject);
  6558. var
  6559. iLoop: Integer;
  6560. ListItem: TRealICQContacterListItem;
  6561. RealICQTeam: TRealICQTeam;
  6562. begin
  6563. if (not MainForm.RealICQClient.UserPermission.EnableMultiSendSms) or (not MainForm.RealICQClient.UserPermission.EnableSendSms) then
  6564. begin
  6565. ShowMessage('您没有群发手机短信的权限!');
  6566. Exit;
  6567. end;
  6568. if FLVTeams.SelCount = 1 then
  6569. begin
  6570. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  6571. begin
  6572. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  6573. if ListItem.Selected then
  6574. begin
  6575. RealICQTeam := ListItem.Data;
  6576. OpenTeamSMSForm(RealICQTeam.TeamID);
  6577. Break;
  6578. end;
  6579. end;
  6580. end;
  6581. end;
  6582. procedure TMainForm.miSetRemarkClick(Sender: TObject);
  6583. var
  6584. LoginName: string;
  6585. Remark, MessageId, ParamValue: string;
  6586. RealICQUser: TRealICQUser;
  6587. Employee: TRealICQEmployee;
  6588. RealICQContacterTreeView: TRealICQContacterTreeView;
  6589. ItemIndex: Integer;
  6590. begin
  6591. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6592. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6593. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6594. LoginName := Employee.LoginName;
  6595. if LoginName <> '' then
  6596. begin
  6597. RealICQUser := GetAddrBookUser(Employee.BranchID, LoginName);
  6598. if RealICQUser = nil then
  6599. Exit;
  6600. Remark := RealICQUser.Remark;
  6601. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  6602. if not AnsiSameStr(Remark, RealICQUser.Remark) then//发送修改备注
  6603. begin
  6604. MessageId := IntToStr(GetTickCount);
  6605. CreateManageGroupMemberMessage(RealICQUser.LoginName, RealICQUser.DisplayName, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, Remark, Employee.BranchID, MessageId);
  6606. //发送修改联系人消息
  6607. RealICQUser.Remark := Remark;
  6608. LoginName := Employee.LoginName;
  6609. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6610. ParamValue := MessageId + #10 + LoginName + #10 + RealICQUser.DisplayName + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Watchword + #10 + Remark + #10 + Employee.BranchId;
  6611. MainForm.RealICQClient.SendAddrBookCommand(6, 1, ParamValue);
  6612. end;
  6613. end;
  6614. end;
  6615. //------------------------------------------------------------------------------
  6616. procedure TMainForm.miAddGroupClick(Sender: TObject);
  6617. var
  6618. ItemIndex, iLoop: Integer;
  6619. RealICQContacterTreeView: TRealICQContacterTreeView;
  6620. TmpBranch: TRealICQBranchInfo;
  6621. Branch: TRealICQBranch;
  6622. GroupName, ResultStr, SelBranchName: string;
  6623. ParamValue: string;
  6624. MessageId: string;
  6625. BranchNames, TmpList: TStringList;
  6626. Employee: TRealICQEmployee;
  6627. begin
  6628. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6629. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6630. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6631. if Branch = nil then
  6632. begin
  6633. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6634. if Employee <> nil then
  6635. Branch := Employee.Node.Parent.Data;
  6636. end;
  6637. if Branch <> nil then
  6638. SelBranchName := Branch.BranchName
  6639. else
  6640. SelBranchName := '我的通讯录';
  6641. BranchNames := TStringList.Create;
  6642. try
  6643. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6644. begin
  6645. TmpBranch := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6646. GroupName := '';
  6647. GetParentGroupNameList(TmpBranch, GroupName);
  6648. BranchNames.AddObject(GroupName, TmpBranch);
  6649. if TmpBranch.ID = Branch.BranchID then
  6650. SelBranchName := GroupName;
  6651. end;
  6652. ResultStr := ShowAddrGroupInputBox('新建组', SelBranchName, BranchNames);
  6653. if ResultStr = '' then
  6654. exit;
  6655. TmpList := SplitString(ResultStr, #10);
  6656. GroupName := TmpList[1];
  6657. if BranchNames.IndexOf(TmpList[0] + GroupName + '\') >= 0 then
  6658. begin
  6659. ShowMessage('已存在相同名称的组!');
  6660. Exit;
  6661. end;
  6662. TmpBranch := BranchNames.Objects[BranchNames.IndexOf(TmpList[0])] as TRealICQBranchInfo;
  6663. //发送添加通讯录组消息
  6664. MessageId := IntToStr(GetTickCount);
  6665. CreateManageGroupMessage(TmpBranch.ID, GroupName, TmpBranch.ParentID, MessageId);
  6666. ParamValue := MessageId + #10 + GroupName + #10 + '0' + #10 + TmpBranch.ID + #10 + MainForm.RealICQClient.Me.LoginName;
  6667. MainForm.RealICQClient.SendAddrBookCommand(1, 0, ParamValue);
  6668. finally
  6669. BranchNames.Free;
  6670. end;
  6671. end;
  6672. //---修改组----------------------------------------------------------
  6673. procedure TMainForm.miUpdateGroupClick(Sender: TObject);
  6674. var
  6675. ItemIndex: Integer;
  6676. RealICQContacterTreeView: TRealICQContacterTreeView;
  6677. Branch: TRealICQBranch;
  6678. GroupName, MessageId, ParamValue: string;
  6679. begin
  6680. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6681. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6682. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6683. if Branch <> nil then
  6684. begin
  6685. GroupName := Branch.BranchName;
  6686. if GroupName = '我的通讯录' then
  6687. begin
  6688. ShowMessage('默认组不允许修改!');
  6689. Exit;
  6690. end;
  6691. end
  6692. else
  6693. begin
  6694. ShowMessage('请选择要修改的组!');
  6695. Exit;
  6696. end;
  6697. GroupName := ShowMyInputBox('修改组', '组名称', GroupName, 500);
  6698. if (GroupName <> Branch.BranchName) and (GroupName <> '') then
  6699. begin
  6700. //发送修改通讯录组名消息
  6701. MessageId := IntToStr(GetTickCount);
  6702. CreateManageGroupMessage(Branch.BranchID, GroupName, Branch.ParentID, MessageId);
  6703. ParamValue := MessageId + #10 + GroupName + #10 + Branch.BranchID + #10 + Branch.ParentID + #10 + MainForm.RealICQClient.Me.LoginName;
  6704. MainForm.RealICQClient.SendAddrBookCommand(2, 0, ParamValue);
  6705. end;
  6706. end;
  6707. //-----删除通讯录组----------------------------------------------------
  6708. procedure TMainForm.miDelGroupClick(Sender: TObject);
  6709. var
  6710. ItemIndex: Integer;
  6711. RealICQContacterTreeView: TRealICQContacterTreeView;
  6712. Branch: TRealICQBranch;
  6713. GroupId: string;
  6714. ParamValue: string;
  6715. MessageId: string;
  6716. begin
  6717. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6718. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6719. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6720. GroupId := '';
  6721. if Branch <> nil then
  6722. begin
  6723. if Branch.ParentID = '0' then
  6724. begin
  6725. ShowMessage('默认组不可以删除');
  6726. Exit;
  6727. end;
  6728. if MessageBox(Handle, '确定要将选中的组删除吗?', '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  6729. Exit;
  6730. //发送删除通讯录组消息
  6731. MessageId := IntToStr(GetTickCount);
  6732. GetChildsGroupId(Branch.BranchID, GroupId);
  6733. CreateManageGroupMessage(GroupId, Branch.BranchName, Branch.ParentID, MessageId);
  6734. ParamValue := MessageId + #10 + GroupId + #10 + Branch.BranchID + #10 + Branch.ParentID + #10 + MainForm.RealICQClient.Me.LoginName;
  6735. MainForm.RealICQClient.SendAddrBookCommand(3, 0, ParamValue);
  6736. end
  6737. else
  6738. ShowMessage('请选择要删除的组!');
  6739. end;
  6740. //-----新增用户到通讯录---------------------------------------
  6741. procedure TMainForm.miAddGroupUserClick(Sender: TObject);
  6742. var
  6743. MessageId, ParamValue, BranchID: string;
  6744. Branch: TRealICQBranch;
  6745. TmpBranch: TRealICQBranchInfo;
  6746. Employee: TRealICQEmployee;
  6747. RealICQUser: TRealICQUser;
  6748. Node: TTreeNode;
  6749. ItemIndex, iLoop: Integer;
  6750. BranchNames: TStringList;
  6751. BranchName, GroupName: string;
  6752. RealICQContacterTreeView: TRealICQContacterTreeView;
  6753. begin
  6754. BranchName := '我的通讯录\';
  6755. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6756. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6757. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6758. if Branch = nil then
  6759. begin
  6760. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6761. if Employee <> nil then
  6762. begin
  6763. Node := Employee.Node.Parent;
  6764. Branch := Node.Data;
  6765. end;
  6766. end;
  6767. if Branch <> nil then
  6768. begin
  6769. if Branch.BranchName = '我的通讯录' then
  6770. begin
  6771. ShowMessage('默认组下面不允许添加联系人!');
  6772. Exit;
  6773. end;
  6774. BranchID := Branch.BranchID;
  6775. end;
  6776. if (GetGroupUserCount + 1) > MainForm.RealICQClient.UserPermission.AddrBookSize then
  6777. begin
  6778. ShowMessage('您的通讯录已满或者没有添加联系人的权限!' + #13 + '请联系系统管理员。');
  6779. Exit;
  6780. end;
  6781. BranchNames := TStringList.Create;
  6782. try
  6783. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6784. begin
  6785. TmpBranch := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6786. GroupName := '';
  6787. GetParentGroupNameList(TmpBranch, GroupName);
  6788. if TmpBranch.ID = BranchID then
  6789. BranchNames.InsertObject(0, GroupName, TmpBranch)
  6790. else
  6791. BranchNames.AddObject(GroupName, TmpBranch);
  6792. end;
  6793. //弹出新增联系人窗体
  6794. RealICQUser := TRealICQUser.Create('', RealICQClient);
  6795. if not ShowAddrUserInputBox('新增联系人', RealICQUser, BranchNames) then
  6796. Exit;
  6797. if Trim(RealICQUser.Nickname) = '' then
  6798. Exit;
  6799. MessageId := IntToStr(GetTickCount);
  6800. CreateManageGroupMemberMessage('', RealICQUser.Nickname, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, RealICQUser.Remark1, BranchID, MessageId);
  6801. //发送新增联系人消息
  6802. ParamValue := MessageId + #10 + '' + #10 + RealICQUser.Nickname + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Remark1 + #10 + RealICQUser.Remark + #10 + BranchID;
  6803. RealICQClient.SendAddrBookCommand(1, 1, ParamValue);
  6804. finally
  6805. BranchNames.Free;
  6806. end;
  6807. end;
  6808. procedure TMainForm.miBusyClick(Sender: TObject);
  6809. begin
  6810. FLoginState := stBusy;
  6811. FLeaveMessage := '忙碌';
  6812. SetLoginStateControlState;
  6813. end;
  6814. //-----------------------------------------------------------------
  6815. procedure TMainForm.miUpdateGroupUserClick(Sender: TObject);
  6816. var
  6817. ItemIndex, iLoop: Integer;
  6818. RealICQContacterTreeView: TRealICQContacterTreeView;
  6819. Employee: TRealICQEmployee;
  6820. BranchNames: TStringList;
  6821. Branch: TRealICQBranch;
  6822. RealICQUser: TRealICQUser;
  6823. LoginName: string;
  6824. ParamValue: string;
  6825. MessageId: string;
  6826. ParentNode: TTreeNode;
  6827. begin
  6828. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6829. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6830. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6831. if Employee <> nil then
  6832. begin
  6833. //弹出修改窗体
  6834. BranchNames := TStringList.Create;
  6835. try
  6836. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  6837. begin
  6838. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  6839. if Branch.BranchID = Employee.BranchID then
  6840. BranchNames.Insert(0, Branch.BranchName)
  6841. else
  6842. BranchNames.Add(Branch.BranchName);
  6843. end;
  6844. ParentNode := Employee.Node.Parent;
  6845. Branch := ParentNode.Data;
  6846. RealICQUser := GetAddrBookUser(Employee.BranchID, Employee.LoginName);
  6847. if not ShowAddrUserInputBox('查看/编辑联系人', RealICQUser, BranchNames) then
  6848. Exit;
  6849. MessageId := IntToStr(GetTickCount);
  6850. CreateManageGroupMemberMessage(RealICQUser.LoginName, RealICQUser.DisplayName, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, RealICQUser.Remark1, Employee.BranchID, MessageId);
  6851. //发送修改联系人消息
  6852. LoginName := Employee.LoginName;
  6853. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6854. ParamValue := MessageId + #10 + LoginName + #10 + RealICQUser.Nickname + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Remark1 + #10 + RealICQUser.Remark + #10 + Employee.BranchId;
  6855. MainForm.RealICQClient.SendAddrBookCommand(2, 1, ParamValue);
  6856. finally
  6857. BranchNames.Free;
  6858. end;
  6859. end
  6860. else
  6861. ShowMessage('请选择要修改的联系人!');
  6862. end;
  6863. //----删除联系人-------------------------------------------------------------
  6864. procedure TMainForm.miDelGroupUserClick(Sender: TObject);
  6865. var
  6866. ItemIndex: Integer;
  6867. RealICQContacterTreeView: TRealICQContacterTreeView;
  6868. Employee: TRealICQEmployee;
  6869. ParamValue: string;
  6870. MessageId, LoginName: string;
  6871. begin
  6872. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6873. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6874. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6875. if Employee = nil then
  6876. begin
  6877. ShowMessage('请选择要删除的联系人');
  6878. Exit
  6879. end;
  6880. //发送删除通讯录组联系人消息
  6881. MessageId := IntToStr(GetTickCount);
  6882. CreateManageGroupMemberMessage(Employee.LoginName, Employee.DisplayName, '', Employee.Mobile, '', '', '', Employee.BranchID, MessageId);
  6883. LoginName := Employee.LoginName;
  6884. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6885. ParamValue := MessageId + #10 + LoginName + #10 + Employee.DisplayName + #10 + Employee.Mobile + #10 + '' + #10 + '' + #10 + '' + #10 + '' + #10 + Employee.BranchId;
  6886. MainForm.RealICQClient.SendAddrBookCommand(3, 1, ParamValue);
  6887. end;
  6888. procedure TMainForm.spbExportGroupUserClick(Sender: TObject);
  6889. var
  6890. ItemIndex, iLoop, jLoop, IIndex: Integer;
  6891. RealICQContacterTreeView: TRealICQContacterTreeView;
  6892. Branch: TRealICQBranch;
  6893. RealICQUser: TRealICQUser;
  6894. BranchInfo: TRealICQBranchInfo;
  6895. GroupId: string;
  6896. begin
  6897. SD.Title := '导出通讯录另存为';
  6898. SD.Filter := 'CSV(*.csv)|*.csv';
  6899. CsvLines := TStringList.Create;
  6900. CommaStr := TStringList.Create;
  6901. CommaStr.CommaText := '姓名 手机 电话 电子邮箱 备注';
  6902. CsvLines.Add(CommaStr.CommaText);
  6903. MainForm.RealICQClient.OnGettedAddrBookUsers := GettedAddrBookUsers1;
  6904. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6905. if (ItemIndex < 0) then
  6906. Exit;
  6907. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6908. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6909. if Branch = nil then
  6910. begin
  6911. ShowMessage('请在通讯录中选择组!');
  6912. Exit;
  6913. end;
  6914. if Branch.BranchName = '我的通讯录' then
  6915. begin
  6916. ShowMessage('默认组下面不允许导出联系人!');
  6917. Exit;
  6918. end;
  6919. SD.FileName := Branch.BranchName + '.csv';
  6920. GetChildsGroupId(Branch.BranchID, GroupId);
  6921. MainForm.RealICQClient.ExAddrBookUsers.Clear;
  6922. while Pos(',', GroupId) > 0 do
  6923. begin
  6924. IIndex := Pos(',', GroupId);
  6925. MainForm.RealICQClient.SendGetAddrbookUser(Copy(GroupId, 1, IIndex - 1));
  6926. sleep(200);
  6927. Delete(GroupId, 1, IIndex);
  6928. end;
  6929. MainForm.RealICQClient.SendGetAddrbookUser(GroupId);
  6930. if SD.Execute then
  6931. begin
  6932. CsvLines.SaveToFile(SD.FileName);
  6933. end;
  6934. CsvLines.Free;
  6935. CommaStr.Free;
  6936. end;
  6937. procedure TMainForm.GettedAddrBookUsers1(Sender: TObject);
  6938. var
  6939. iLoop: integer;
  6940. RealICQUser: TRealICQUser;
  6941. BranchInfo: TRealICQBranchInfo;
  6942. begin
  6943. for iLoop := MainForm.RealICQClient.ExAddrBookUsers.Count - 1 downto 0 do
  6944. begin
  6945. RealICQUser := MainForm.RealICQClient.ExAddrBookUsers.Objects[iLoop] as TRealICQUser;
  6946. CommaStr.CommaText := AnsiRePlaceStr(RealICQUser.DisplayName, ' ', '') + ',' + RealICQUser.Mobile + ',' + RealICQUser.Tel + ',' + RealICQUser.Email + ',' + RealICQUser.Remark1;
  6947. CsvLines.Add(CommaStr.CommaText);
  6948. end;
  6949. MainForm.RealICQClient.ExAddrBookUsers.Clear;
  6950. end;
  6951. //-----导入联系人---------------------------------
  6952. procedure TMainForm.spbImportGroupUserClick(Sender: TObject);
  6953. var
  6954. ItemIndex: Integer;
  6955. RealICQContacterTreeView: TRealICQContacterTreeView;
  6956. Branch: TRealICQBranch;
  6957. begin
  6958. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6959. if (ItemIndex < 0) then
  6960. Exit;
  6961. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6962. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6963. if Branch = nil then
  6964. begin
  6965. ShowMessage('请在通讯录中选择组!');
  6966. Exit;
  6967. end;
  6968. if ImportGuideFrom = nil then
  6969. ImportGuideFrom := TImportGuideFrom.Create(self);
  6970. ImportGuideFrom.SelBranch := Branch;
  6971. ImportGuideFrom.Show;
  6972. ForceForeGroundWindow(ImportGuideFrom.Handle);
  6973. end;
  6974. //-----得到指定通讯录组的所有子节点ID----------------------------------
  6975. procedure TMainForm.GetChildsGroupId(GroupId: string; var Groups: string);
  6976. var
  6977. iLoop: Integer;
  6978. BranchInfo: TRealICQBranchInfo;
  6979. begin
  6980. if Groups <> '' then
  6981. Groups := Groups + ',';
  6982. Groups := Groups + GroupId;
  6983. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6984. begin
  6985. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6986. if BranchInfo.ParentID = GroupId then
  6987. GetChildsGroupId(BranchInfo.ID, Groups);
  6988. end;
  6989. end;
  6990. //----剪切-----------------------------------------------------------
  6991. procedure TMainForm.miCutClick(Sender: TObject);
  6992. var
  6993. ItemIndex: Integer;
  6994. Employee: TRealICQEmployee;
  6995. Branch: TRealICQBranch;
  6996. RealICQContacterTreeView: TRealICQContacterTreeView;
  6997. begin
  6998. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6999. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7000. if FCutNode <> nil then
  7001. begin
  7002. if FCutNode.StateIndex = 0 then
  7003. begin
  7004. Branch := FCutNode.Data;
  7005. Branch.IsCutState := False;
  7006. Branch.Update;
  7007. end
  7008. else
  7009. begin
  7010. Employee := FCutNode.Data;
  7011. Employee.IsCutState := False;
  7012. Employee.Update;
  7013. end;
  7014. end;
  7015. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7016. if Employee <> nil then
  7017. begin
  7018. Employee.IsCutState := True;
  7019. Employee.Update;
  7020. FCutNode := Employee.Node;
  7021. Exit;
  7022. end;
  7023. Branch := RealICQContacterTreeView.GetSelectedBranch;
  7024. if Branch <> nil then
  7025. begin
  7026. if Branch.BranchName = '我的通讯录' then
  7027. begin
  7028. ShowMessage('默认组不允许剪切!');
  7029. Exit;
  7030. end;
  7031. Branch.IsCutState := True;
  7032. Branch.Update;
  7033. FCutNode := Branch.Node;
  7034. end;
  7035. end;
  7036. //---粘贴------------------------------------------------------------
  7037. procedure TMainForm.miPasteClick(Sender: TObject);
  7038. var
  7039. ItemIndex, EmployeeCount, iLoop: Integer;
  7040. MessageId, ParamValue, LoginName: string;
  7041. Employee, TmpEmployee: TRealICQEmployee;
  7042. SelBranch, TmpBranch, Branch: TRealICQBranch;
  7043. RealICQContacterTreeView: TRealICQContacterTreeView;
  7044. ParentNode: TTreeNode;
  7045. RealICQUser: TRealICQUser;
  7046. begin
  7047. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7048. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7049. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7050. if Employee <> nil then
  7051. begin
  7052. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(Employee.BranchID);
  7053. SelBranch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7054. end
  7055. else
  7056. SelBranch := RealICQContacterTreeView.GetSelectedBranch;
  7057. if SelBranch = nil then
  7058. Exit;
  7059. if FCutNode.StateIndex = 0 then
  7060. begin
  7061. TmpBranch := FCutNode.Data;
  7062. //判断同一级别是否存在相同的部门
  7063. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  7064. begin
  7065. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  7066. if (Branch.ParentID = SelBranch.BranchID) and (Branch.BranchName = TmpBranch.BranchName) then
  7067. begin
  7068. ShowMessage('已存在名称相同的组!');
  7069. TmpBranch.IsCutState := False;
  7070. TmpBranch.Update;
  7071. FCutNode := nil;
  7072. Exit;
  7073. end;
  7074. end;
  7075. ParentNode := TmpBranch.Node.Parent;
  7076. TmpBranch.Node.MoveTo(SelBranch.Node, naAddChild);
  7077. TmpBranch.ParentID := SelBranch.BranchID;
  7078. TmpBranch.Node.Selected := True;
  7079. TmpBranch.IsCutState := False;
  7080. TmpBranch.Update;
  7081. MessageId := IntToStr(GetTickCount);
  7082. CreateManageGroupMessage(TmpBranch.BranchID, TmpBranch.BranchName, SelBranch.BranchID, MessageId);
  7083. //发送修改组的父级ID
  7084. ParamValue := MessageId + #10 + TmpBranch.BranchName + #10 + TmpBranch.BranchID + #10 + SelBranch.BranchID + #10 + MainForm.RealICQClient.Me.LoginName;
  7085. MainForm.RealICQClient.SendAddrBookCommand(4, 0, ParamValue);
  7086. EmployeeCount := TmpBranch.EmployeeCount;
  7087. while ParentNode <> nil do
  7088. begin
  7089. TmpBranch := ParentNode.Data;
  7090. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount - EmployeeCount;
  7091. TmpBranch.Update;
  7092. ParentNode := TmpBranch.Node.Parent;
  7093. end;
  7094. ParentNode := SelBranch.Node;
  7095. while ParentNode <> nil do
  7096. begin
  7097. TmpBranch := ParentNode.Data;
  7098. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount + EmployeeCount;
  7099. TmpBranch.Update;
  7100. ParentNode := TmpBranch.Node.Parent;
  7101. end;
  7102. end
  7103. else
  7104. begin
  7105. TmpEmployee := FCutNode.Data;
  7106. if GetAddrBookUserIndex(SelBranch.BranchID, TmpEmployee.LoginName) >= 0 then
  7107. begin
  7108. ShowMessage('已存在名称相同的联系人!');
  7109. TmpEmployee.IsCutState := False;
  7110. TmpEmployee.Update;
  7111. FCutNode := nil;
  7112. Exit;
  7113. end;
  7114. MessageId := IntToStr(GetTickCount);
  7115. CreateManageGroupMemberMessage(TmpEmployee.LoginName, TmpEmployee.DisplayName, '', TmpEmployee.Mobile, TmpEmployee.Tel, TmpEmployee.EmailHint, '', SelBranch.BranchID, MessageId);
  7116. //发送修改联系人所属组消息
  7117. LoginName := TmpEmployee.LoginName;
  7118. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  7119. ParamValue := MessageId + #10 + LoginName + #10 + TmpEmployee.DisplayName + #10 + TmpEmployee.Mobile + #10 + '' + #10 + '' + #10 + TmpEmployee.BranchID + #10 + '' + #10 + SelBranch.BranchId;
  7120. MainForm.RealICQClient.SendAddrBookCommand(5, 1, ParamValue);
  7121. end;
  7122. end;
  7123. //----得到父级的所有组名称---------------------------------------------
  7124. procedure TMainForm.GetParentGroupNameList(BranchInfo: TRealICQBranchInfo; var Groups: string);
  7125. var
  7126. iLoop: Integer;
  7127. TmpBranchInfo: TRealICQBranchInfo;
  7128. begin
  7129. Groups := BranchInfo.BranchName + '\' + Groups;
  7130. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7131. begin
  7132. TmpBranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7133. if BranchInfo.ParentID = TmpBranchInfo.ID then
  7134. GetParentGroupNameList(TmpBranchInfo, Groups);
  7135. end;
  7136. end;
  7137. //----创建管理组消息
  7138. procedure TMainForm.CreateManageGroupMessage(GroupId, GroupName, ParentId, MessageId: string);
  7139. var
  7140. ManageGroupMessage: TManageGroupMessage;
  7141. begin
  7142. ManageGroupMessage := TManageGroupMessage.Create;
  7143. ManageGroupMessage.MessageId := MessageId;
  7144. ManageGroupMessage.FGroupID := GroupId;
  7145. ManageGroupMessage.FGroupName := GroupName;
  7146. ManageGroupMessage.FParentID := ParentId;
  7147. FManageGroupMsgList.AddObject(ManageGroupMessage.MessageId, ManageGroupMessage);
  7148. end;
  7149. //----创建管理联系人消息
  7150. procedure TMainForm.CreateManageGroupMemberMessage(ID, DisplayName, NickName, Mobile, Tel, Email, Remark, GroupId, MessageId: string);
  7151. var
  7152. ManageGroupMemberMessage: TManageGroupMemberMessage;
  7153. begin
  7154. ManageGroupMemberMessage := TManageGroupMemberMessage.Create;
  7155. ManageGroupMemberMessage.MessageId := MessageId;
  7156. ManageGroupMemberMessage.FID := Id;
  7157. ManageGroupMemberMessage.FDisplayName := DisplayName;
  7158. ManageGroupMemberMessage.FNickName := NickName;
  7159. ManageGroupMemberMessage.FMobile := Mobile;
  7160. ManageGroupMemberMessage.FTel := Tel;
  7161. ManageGroupMemberMessage.FEmail := Email;
  7162. ManageGroupMemberMessage.FRemark := Remark;
  7163. ManageGroupMemberMessage.FGroupId := GroupId;
  7164. FManageGroupMemberMsgList.AddObject(ManageGroupMemberMessage.MessageId, ManageGroupMemberMessage);
  7165. end;
  7166. //----------------------------------------------------------
  7167. procedure TMainForm.GettedManageAddrBookResult(Sender: TObject; OperatModal: Integer; OperatCommand: Integer; RetValue, MessageId: Cardinal);
  7168. var
  7169. Branch: TRealICQBranch;
  7170. RealICQBranch: TRealICQBranchInfo;
  7171. RealICQUser, TmpRealICQUser: TRealICQUser;
  7172. TreeViewIndex, ItemIndex, iLoop, i, jLoop: Integer;
  7173. RealICQContacterTreeView: TRealICQContacterTreeView;
  7174. ManageGroupMessage: TManageGroupMessage;
  7175. ManageGroupMemberMsg: TManageGroupMemberMessage;
  7176. TmpList, TmpDelUsers: TStringList;
  7177. Employee, TmpEmployee: TRealICQEmployee;
  7178. ErrMsg, TmpUsers: string;
  7179. begin
  7180. try
  7181. TreeViewIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7182. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[TreeViewIndex] as TRealICQContacterTreeView;
  7183. if RetValue = -1 then
  7184. begin
  7185. case OperatCommand of
  7186. 1:
  7187. ErrMsg := '新建';
  7188. 2:
  7189. ErrMsg := '修改';
  7190. 3:
  7191. ErrMsg := '删除';
  7192. 4:
  7193. ErrMsg := '批量添加';
  7194. end;
  7195. if OperatModal = 0 then
  7196. begin
  7197. if OperatCommand = 4 then
  7198. ErrMsg := '粘贴';
  7199. ErrMsg := ErrMsg + '组失败';
  7200. end
  7201. else
  7202. begin
  7203. ErrMsg := ErrMsg + '联系人失败';
  7204. if OperatCommand = 5 then
  7205. ErrMsg := '粘贴联系人失败';
  7206. if OperatCommand = 6 then
  7207. ErrMsg := '修改联系人备注失败';
  7208. end;
  7209. ShowMessage(ErrMsg);
  7210. Exit;
  7211. end;
  7212. if OperatModal = 0 then //对组操作
  7213. begin
  7214. i := FManageGroupMsgList.IndexOf(IntToStr(MessageId));
  7215. ManageGroupMessage := FManageGroupMsgList.Objects[i] as TManageGroupMessage;
  7216. case OperatCommand of
  7217. 1:
  7218. begin //增加组
  7219. Branch := TRealICQBranch.Create(ManageGroupMessage.FGroupName);
  7220. Branch.BranchID := IntToStr(RetValue);
  7221. Branch.ParentID := ManageGroupMessage.FGroupID;
  7222. RealICQBranch := TRealICQBranchInfo.Create;
  7223. RealICQBranch.ID := IntToStr(RetValue);
  7224. RealICQBranch.ParentID := ManageGroupMessage.FGroupID;
  7225. RealICQBranch.BranchName := ManageGroupMessage.FGroupName;
  7226. RealICQContacterTreeView.AddBranch(Branch);
  7227. MainForm.RealICQClient.AddrBookGroups.AddObject(RealICQBranch.ID, RealICQBranch);
  7228. Branch.Node.Selected := True;
  7229. end;
  7230. 2:
  7231. begin //修改组
  7232. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(ManageGroupMessage.FGroupID);
  7233. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7234. Branch.BranchName := ManageGroupMessage.FGroupName;
  7235. Branch.Update;
  7236. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(ManageGroupMessage.FGroupID);
  7237. RealICQBranch := MainForm.RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7238. RealICQBranch.BranchName := ManageGroupMessage.FGroupName;
  7239. end;
  7240. 3:
  7241. begin //删除组
  7242. try
  7243. TmpList := SplitString(ManageGroupMessage.FGroupID, ',');
  7244. for iLoop := 0 to TmpList.Count - 1 do
  7245. begin
  7246. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(TmpList[iLoop]);
  7247. if ItemIndex >= 0 then
  7248. begin
  7249. MainForm.RealICQClient.AddrBookGroups.Delete(ItemIndex);
  7250. ItemIndex := GetGroupUsers(TmpList[iLoop]);
  7251. while ItemIndex >= 0 do
  7252. begin
  7253. MainForm.RealICQClient.AddrBookUsers.Delete(ItemIndex);
  7254. ItemIndex := GetGroupUsers(TmpList[iLoop]);
  7255. end;
  7256. end;
  7257. end;
  7258. RealICQContacterTreeView.Clear;
  7259. FreeAndNil(RealICQContacterTreeView);
  7260. MainForm.ContacterTreeViews.Delete(TreeViewIndex);
  7261. MainForm.AddContacterTreeView(ScrollBoxAddrBook, LVAddrBook);
  7262. LoadAddrBook(ManageGroupMessage.FParentId);
  7263. TreeViewIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7264. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[TreeViewIndex] as TRealICQContacterTreeView;
  7265. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(ManageGroupMessage.FParentID);
  7266. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7267. while Branch.ParentID <> '0' do
  7268. begin
  7269. NodeGroupClick(nil, Branch);
  7270. Branch := Branch.Node.Parent.Data;
  7271. end;
  7272. finally
  7273. if TmpList <> nil then
  7274. TmpList.Free;
  7275. if TmpDelUsers <> nil then
  7276. TmpDelUsers.Free;
  7277. end;
  7278. end;
  7279. 4:
  7280. begin //剪切粘贴
  7281. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(ManageGroupMessage.FGroupID);
  7282. RealICQBranch := MainForm.RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7283. RealICQBranch.ParentID := ManageGroupMessage.FParentID;
  7284. end;
  7285. end;
  7286. FManageGroupMsgList.Delete(i);
  7287. end
  7288. else //对联系人操作
  7289. begin
  7290. i := FManageGroupMemberMsgList.IndexOf(IntToStr(MessageId));
  7291. ManageGroupMemberMsg := FManageGroupMemberMsgList.Objects[i] as TManageGroupMemberMessage;
  7292. case OperatCommand of
  7293. 1:
  7294. begin //新增联系人
  7295. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7296. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7297. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + 1;
  7298. //---------------------------------------------
  7299. RealICQUser := TRealICQUser.Create(IntToStr(RetValue), MainForm.RealICQClient);
  7300. RealICQUser.LoginName := IntToStr(RetValue);
  7301. RealICQUser.DisplayName := ManageGroupMemberMsg.FDisplayName;
  7302. RealICQUser.Remark := ManageGroupMemberMsg.FNickName;
  7303. RealICQUser.Mobile := ManageGroupMemberMsg.FMobile;
  7304. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7305. RealICQUser.Tel := ManageGroupMemberMsg.FTel;
  7306. RealICQUser.Email := ManageGroupMemberMsg.FEmail;
  7307. RealICQUser.Remark1 := ManageGroupMemberMsg.FRemark;
  7308. MainForm.RealICQClient.AddrBookUsers.AddObject(RealICQUser.LoginName, RealICQUser);
  7309. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7310. Employee.BranchID := RealICQUser.BranchID;
  7311. Employee.DisplayName := RealICQUser.DisplayName;
  7312. Employee.Mobile := RealICQUser.Mobile;
  7313. Employee.HasSMS := (Length(RealICQUser.Mobile) > 0);
  7314. Employee.SMSHint := RealICQUser.Mobile;
  7315. Employee.HasEmail := False;
  7316. Employee.HasAddFreindButton := False;
  7317. RealICQContacterTreeView.AddEmployee(Employee);
  7318. Employee.Node.Selected := True;
  7319. end;
  7320. 2:
  7321. begin //修改联系人
  7322. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7323. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7324. Employee.DisplayName := ManageGroupMemberMsg.FDisplayName;
  7325. Employee.Mobile := ManageGroupMemberMsg.FMobile;
  7326. Employee.SMSHint := ManageGroupMemberMsg.FMobile;
  7327. Employee.HasSMS := (Length(ManageGroupMemberMsg.FMobile) > 0);
  7328. Employee.Update;
  7329. end;
  7330. 3:
  7331. begin //删除联系人
  7332. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7333. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7334. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount - 1;
  7335. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7336. if ItemIndex >= 0 then
  7337. begin
  7338. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7339. RealICQUser := GetAddrBookUser(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7340. RealICQClient.AddrBookUsers.Delete(RealICQClient.AddrBookUsers.IndexOfObject(RealICQUser));
  7341. end;
  7342. end;
  7343. 4:
  7344. begin //批量添加联系人
  7345. TmpList := SplitString(ManageGroupMemberMsg.FId, ',');
  7346. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7347. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7348. RealICQBranch.IsGetUserList := True;
  7349. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + TmpList.Count;
  7350. for iLoop := 0 to TmpList.Count - 1 do
  7351. begin
  7352. if GetAddrBookUser(ManageGroupMemberMsg.FGroupId, TmpList[iLoop]) = nil then
  7353. begin
  7354. ItemIndex := MainForm.RealICQClient.MoreUsers.IndexOf(TmpList[iLoop]);
  7355. if ItemIndex >= 0 then
  7356. RealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser
  7357. else
  7358. begin
  7359. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(TmpList[iLoop]);
  7360. end;
  7361. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7362. Employee.BranchID := ManageGroupMemberMsg.FGroupId;
  7363. Employee.DisplayName := RealICQUser.DisplayName;
  7364. Employee.Mobile := RealICQUser.Mobile;
  7365. Employee.HasSMS := (Length(RealICQUser.Mobile) > 0);
  7366. Employee.EmailHint := RealICQUser.Email;
  7367. Employee.SMSHint := RealICQUser.Mobile;
  7368. Employee.HasEmail := False;
  7369. Employee.HasAddFreindButton := False;
  7370. RealICQContacterTreeView.AddEmployee(Employee);
  7371. Employee.Node.Selected := True;
  7372. end;
  7373. end;
  7374. for iLoop := TmpList.Count - 1 downto 0 do
  7375. begin
  7376. ItemIndex := MainForm.RealICQClient.MoreUsers.IndexOf(TmpList[iLoop]);
  7377. if ItemIndex >= 0 then
  7378. RealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser
  7379. else
  7380. begin
  7381. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(TmpList[iLoop]);
  7382. end;
  7383. TmpRealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser;
  7384. RealICQUser := TRealICQUser.Create(TmpList[iLoop], RealICQClient);
  7385. RealICQUser.LoginName := TmpRealICQUser.LoginName;
  7386. RealICQUser.DisplayName := TmpRealICQUser.DisplayName;
  7387. RealICQUser.Mobile := TmpRealICQUser.Mobile;
  7388. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7389. RealICQUser.Tel := TmpRealICQUser.Tel;
  7390. //RealICQUser.Email:=RealICQUser.EmailHint;
  7391. MainForm.RealICQClient.AddrBookUsers.AddObject(RealICQUser.LoginName, RealICQUser);
  7392. end;
  7393. end;
  7394. 5:
  7395. begin
  7396. TmpEmployee := FCutNode.Data;
  7397. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7398. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7399. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + 1;
  7400. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(TmpEmployee.BranchID);
  7401. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7402. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount - 1;
  7403. ItemIndex := GetAddrBookUserIndex(TmpEmployee.BranchID, TmpEmployee.LoginName);
  7404. Employee := TRealICQEmployee.Create(TmpEmployee.LoginName);
  7405. Employee.BranchID := ManageGroupMemberMsg.FGroupId;
  7406. Employee.DisplayName := TmpEmployee.DisplayName;
  7407. Employee.Tel := TmpEmployee.Tel;
  7408. Employee.Mobile := TmpEmployee.Mobile;
  7409. RealICQContacterTreeView.AddEmployee(Employee);
  7410. RealICQUser := GetAddrBookUser(TmpEmployee.BranchID, TmpEmployee.LoginName);
  7411. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7412. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7413. Employee.Node.Selected := True;
  7414. end;
  7415. 6:
  7416. begin
  7417. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7418. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7419. if Employee <> nil then
  7420. begin
  7421. Employee.DisplayName := ManageGroupMemberMsg.FRemark;
  7422. Employee.Update;
  7423. end;
  7424. end;
  7425. end;
  7426. FManageGroupMemberMsgList.Delete(i);
  7427. end;
  7428. finally
  7429. if FCutNode <> nil then
  7430. FCutNode := nil;
  7431. end;
  7432. end;
  7433. //------得到联系人-----------------------------
  7434. function TMainForm.GetAddrBookUser(GroupId, LoginName: string): TRealICQUser;
  7435. var
  7436. iLoop: Integer;
  7437. RealICQUser: TRealICQUser;
  7438. begin
  7439. Result := nil;
  7440. for iLoop := 0 to MainForm.RealICQClient.AddrBookUsers.Count - 1 do
  7441. begin
  7442. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7443. if (RealICQUser.BranchID = GroupId) and (RealICQUser.LoginName = LoginName) then
  7444. begin
  7445. Result := RealICQUser;
  7446. Break;
  7447. end;
  7448. end;
  7449. end;
  7450. //------得到联系人的下标------------------------------
  7451. function TMainForm.GetAddrBookUserIndex(GroupId, LoginName: string): Integer;
  7452. var
  7453. iLoop: Integer;
  7454. Employee: TRealICQEmployee;
  7455. RealICQContacterTreeView: TRealICQContacterTreeView;
  7456. begin
  7457. Result := -1;
  7458. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[MainForm.ContacterTreeViews.IndexOf(LVAddrBook)] as TRealICQContacterTreeView;
  7459. for iLoop := 0 to RealICQContacterTreeView.EmployeeItems.Count - 1 do
  7460. begin
  7461. Employee := RealICQContacterTreeView.EmployeeItems.Objects[iLoop] as TRealICQEmployee;
  7462. if (Employee.BranchID = GroupId) and (Employee.LoginName = LoginName) then
  7463. begin
  7464. Result := iLoop;
  7465. break;
  7466. end;
  7467. end;
  7468. end;
  7469. //-----得到联系人总的人数------------------
  7470. function TMainForm.GetGroupUserCount: Integer;
  7471. var
  7472. iLoop, ItemIndex: Integer;
  7473. TmpBranch: TRealICQBranch;
  7474. RealICQContacterTreeView: TRealICQContacterTreeView;
  7475. begin
  7476. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7477. if ItemIndex < 0 then
  7478. Exit;
  7479. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7480. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  7481. begin
  7482. TmpBranch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  7483. if TmpBranch.ParentID = '0' then
  7484. begin
  7485. Result := TmpBranch.EmployeeCount;
  7486. break;
  7487. end;
  7488. end;
  7489. end;
  7490. //-------------------------显示联系人-------
  7491. procedure TMainForm.GettedAddrBookUsers(Sender: TObject);
  7492. var
  7493. iLoop, ItemIndex: Integer;
  7494. RealICQContacterTreeView: TRealICQContacterTreeView;
  7495. RealICQUser: TRealICQUser;
  7496. TmpBranch: TRealICQBranch;
  7497. Employee: TRealICQEmployee;
  7498. ParentNode: TTreeNode;
  7499. BranchInfo: TRealICQBranchInfo;
  7500. begin
  7501. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7502. if ItemIndex < 0 then
  7503. Exit;
  7504. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7505. RealICQContacterTreeView.AdjustPosition := False;
  7506. RealICQContacterTreeView.HideSystemScrollBar;
  7507. RealICQContacterTreeView.BeginUpdate;
  7508. TmpBranch := nil;
  7509. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载联系人');
  7510. if ItemIndex >= 0 then
  7511. begin
  7512. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7513. TmpBranch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(Employee.BranchID)] as TRealICQBranch;
  7514. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7515. BranchInfo := RealICQClient.AddrBookGroups.Objects[RealICQClient.AddrBookGroups.IndexOf(TmpBranch.BranchID)] as TRealICQBranchInfo;
  7516. BranchInfo.IsGetUserList := True;
  7517. end;
  7518. {$region '添加联系人'}
  7519. for iLoop := MainForm.RealICQClient.AddrBookUsers.Count - 1 downto 0 do
  7520. begin
  7521. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7522. if GetAddrBookUserIndex(RealICQUser.BranchID, RealICQUser.LoginName) >= 0 then
  7523. Continue;
  7524. if RealICQUser.BranchID <> TmpBranch.BranchID then
  7525. Continue;
  7526. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7527. Employee.BranchID := RealICQUser.BranchID;
  7528. Employee.Mobile := RealICQUser.Mobile;
  7529. Employee.HasSMS := Length(RealICQUser.Mobile) > 0;
  7530. Employee.SMSHint := RealICQUser.Mobile;
  7531. Employee.HasEmail := False;
  7532. if Trim(RealICQUser.Remark) <> '' then
  7533. Employee.DisplayName := RealICQUser.Remark
  7534. else
  7535. Employee.DisplayName := RealICQUser.DisplayName;
  7536. Employee.HasAddFreindButton := False;
  7537. RealICQContacterTreeView.AddEmployee(Employee);
  7538. end;
  7539. {$endregion}
  7540. if TmpBranch <> nil then
  7541. begin
  7542. ParentNode := TmpBranch.Node;
  7543. while ParentNode <> nil do
  7544. begin
  7545. ParentNode.Expanded := True;
  7546. ParentNode := ParentNode.Parent;
  7547. end;
  7548. TmpBranch.Node.Selected := True;
  7549. TmpBranch.IsGetUserList := True;
  7550. end;
  7551. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  7552. RealICQContacterTreeView.MoveScrollBarToTop;
  7553. RealICQContacterTreeView.EndUpdate;
  7554. end;
  7555. //----------显示组-------------------------
  7556. procedure TMainForm.GettedAddrBookGroups(Sender: TObject);
  7557. begin
  7558. LoadAddrBook('0');
  7559. end;
  7560. //-------------------------------------------------------------------------
  7561. procedure TMainForm.LoadAddrBook(ExpandGroupId: string);
  7562. var
  7563. iLoop, ItemIndex: Integer;
  7564. RealICQContacterTreeView: TRealICQContacterTreeView;
  7565. RealICQUser: TRealICQUser;
  7566. BranchInfo: TRealICQBranchInfo;
  7567. Branch, TmpBranch: TRealICQBranch;
  7568. Employee: TRealICQEmployee;
  7569. ParentNode: TTreeNode;
  7570. BranchId: string;
  7571. OnlineEmployee, EmployeeCount: Integer;
  7572. begin
  7573. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7574. if ItemIndex < 0 then
  7575. Exit;
  7576. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7577. RealICQContacterTreeView.OnItemOnline := nil;
  7578. RealICQContacterTreeView.OnItemOffline := nil;
  7579. RealICQContacterTreeView.OnItemIconButtonClick := nil;
  7580. RealICQContacterTreeView.OnItemMouseEnter := nil;
  7581. RealICQContacterTreeView.OnItemMouseLeave := nil;
  7582. RealICQContacterTreeView.ShowOnlineNumber := False;
  7583. RealICQContacterTreeView.ShowLoginState := False;
  7584. RealICQContacterTreeView.PopupMenu := ppAddrbookList;
  7585. RealICQContacterTreeView.AdjustPosition := False;
  7586. RealICQContacterTreeView.HideSystemScrollBar;
  7587. RealICQContacterTreeView.BeginUpdate;
  7588. TmpBranch := nil;
  7589. {$region '添加组'}
  7590. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7591. begin
  7592. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7593. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  7594. Continue;
  7595. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  7596. Branch.BranchID := BranchInfo.ID;
  7597. Branch.ParentID := BranchInfo.ParentID;
  7598. Branch.IsGetUserList := False;
  7599. OnlineEmployee := 0;
  7600. EmployeeCount := 0;
  7601. GetBranchEmpOnlineAndSum(RealICQClient.AddrBookGroups, BranchInfo, OnlineEmployee, EmployeeCount);
  7602. Branch.EmployeeCount := EmployeeCount;
  7603. Branch.OnlineEmployee := 0;
  7604. RealICQContacterTreeView.AddBranch(Branch);
  7605. if ExpandGroupId = '0' then
  7606. begin
  7607. BranchId := Branch.ParentID;
  7608. end
  7609. else
  7610. BranchId := Branch.BranchID;
  7611. if BranchId = ExpandGroupId then
  7612. begin
  7613. TmpBranch := Branch;
  7614. end;
  7615. end;
  7616. RealICQContacterTreeView.ReAlignBranchs;
  7617. {$endregion}
  7618. if TmpBranch <> nil then
  7619. begin
  7620. ParentNode := TmpBranch.Node;
  7621. while ParentNode <> nil do
  7622. begin
  7623. ParentNode.Expanded := True;
  7624. ParentNode := ParentNode.Parent;
  7625. end;
  7626. TmpBranch.Node.Selected := True;
  7627. end;
  7628. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  7629. RealICQContacterTreeView.MoveScrollBarToTop;
  7630. RealICQContacterTreeView.EndUpdate;
  7631. ScrollBoxAddrBook.Visible := True;
  7632. end;
  7633. //----------------------------------------------
  7634. procedure TMainForm.NodeGroupClick(Sender: TObject; Group: TRealICQBranch);
  7635. var
  7636. RealICQContacterTreeView: TRealICQContacterTreeView;
  7637. ItemIndex: Integer;
  7638. Employee: TRealICQEmployee;
  7639. BranchInfo: TRealICQBranchInfo;
  7640. begin
  7641. //-------获取指定部门下的用户------------------------------------------------
  7642. if (not Group.IsGetUserList) and (Group.Node.Parent <> nil) then
  7643. begin
  7644. MainForm.RealICQClient.OnGettedAddrBookUsers := GettedAddrBookUsers;
  7645. ItemIndex := FContacterTreeViews.IndexOf(LVAddrBook);
  7646. if ItemIndex < 0 then
  7647. exit;
  7648. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7649. if RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载联系人') < 0 then
  7650. begin
  7651. RealICQContacterTreeView.ReCalculateEmployeeCount(Group);
  7652. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[MainForm.RealICQClient.AddrBookGroups.IndexOf(Group.BranchID)] as TRealICQBranchInfo;
  7653. Employee := TRealICQEmployee.Create('正在下载联系人');
  7654. Employee.BranchID := Group.BranchID;
  7655. RealICQContacterTreeView.AddEmployee(Employee);
  7656. if (BranchInfo.IsGetUserList) then
  7657. begin
  7658. GettedAddrBookUsers(nil);
  7659. end
  7660. else
  7661. begin
  7662. MainForm.RealICQClient.SendGetAddrbookUser(Group.BranchID);
  7663. end;
  7664. end;
  7665. Group.Node.Expanded := True;
  7666. end;
  7667. end;
  7668. //---------------------------------------------------------------------------
  7669. function TMainForm.GetGroupUsers(GroupId: string): Integer;
  7670. var
  7671. iLoop: Integer;
  7672. RealICQUser: TRealICQUser;
  7673. begin
  7674. Result := -1;
  7675. for iLoop := 0 to MainForm.RealICQClient.AddrBookUsers.Count - 1 do
  7676. begin
  7677. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7678. if RealICQUser.BranchID = GroupId then
  7679. begin
  7680. Result := iLoop;
  7681. end;
  7682. end;
  7683. end;
  7684. {通讯录}
  7685. procedure TMainForm.tsCustomerServiceContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
  7686. begin
  7687. end;
  7688. //------------
  7689. procedure TMainForm.tsNetWorkDiskShow(Sender: TObject);
  7690. begin
  7691. if RealICQClient.NetWorkDiskServerPort <= 0 then
  7692. begin
  7693. lblNDState.Caption := '没有服务器';
  7694. end
  7695. else
  7696. begin
  7697. if (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) then
  7698. begin
  7699. spbNDConnectClick(spbNDConnect);
  7700. end
  7701. else if not AnsiSameText(RealICQNetWorkDiskClient.LoginName, RealICQClient.LoginName) then
  7702. begin
  7703. RealICQNetWorkDiskClient.Logout;
  7704. spbNDConnectClick(spbNDConnect);
  7705. end;
  7706. end;
  7707. end;
  7708. //------------------------------------------------------------------------------
  7709. procedure TMainForm.WebBrowserAddrBookBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7710. begin
  7711. //
  7712. end;
  7713. procedure TMainForm.WebBrowserAddrBookDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  7714. begin
  7715. //
  7716. end;
  7717. procedure TMainForm.WebBrowserForAdvertisementBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7718. begin
  7719. if not AnsiSameText(URL, MainForm.RealICQClient.MainFormAdversement.URL) then
  7720. begin
  7721. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar('"' + string(URL) + '"'), '', SW_SHOWNORMAL);
  7722. Cancel := True;
  7723. end;
  7724. end;
  7725. //------------------------------------------------------------------------------
  7726. procedure TMainForm.WebBrowserForAdvertisementDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  7727. begin
  7728. try
  7729. WebBrowserForAdvertisement.OnDocumentComplete := nil;
  7730. WebBrowserForAdvertisement.OnBeforeNavigate2 := WebBrowserForAdvertisementBeforeNavigate2;
  7731. SetDomStyle(WebBrowserForAdvertisement.Document as IHtmlDocument2);
  7732. except
  7733. end;
  7734. pnlForHideWebBrowser.Visible := False;
  7735. pnlAdvertisement.Top := pnlWebSearch.Top - 1;
  7736. pnlAdvertisement.Height := RealICQClient.MainFormAdversement.Height + 2;
  7737. pnlWebSearch.Top := pnlAdvertisement.Top + pnlAdvertisement.Height + 1;
  7738. ClearMemory;
  7739. end;
  7740. //------------------------------------------------------------------------------
  7741. procedure TMainForm.WebBrowserForContactersBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7742. var
  7743. NewUrl: string;
  7744. Args: string;
  7745. ArgList: TStringList;
  7746. AForm: TForm;
  7747. index: Integer;
  7748. begin
  7749. NewUrl := URL;
  7750. if AnsiSameText(Copy(NewUrl, 1, 18), 'OpenTalkingForm://') then
  7751. begin
  7752. Cancel := True;
  7753. Args := Copy(NewUrl, 19, Length(NewUrl) - 19);
  7754. if AnsiSameText(Args, RealICQClient.Me.LoginName) then
  7755. begin
  7756. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  7757. Exit;
  7758. end;
  7759. OpenTalkingForm(Args, True);
  7760. Exit;
  7761. end;
  7762. if AnsiSameText(Copy(NewUrl, 1, 12), 'AddFriend://') then
  7763. begin
  7764. Cancel := True;
  7765. Args := Copy(NewUrl, 13, Length(NewUrl) - 13);
  7766. if AnsiSameText(Args, RealICQClient.Me.LoginName) then
  7767. begin
  7768. MessageBox(Handle, '对不起,不可以加自己为好友!', '提示', MB_ICONINFORMATION);
  7769. Exit;
  7770. end;
  7771. if TUsersService.GetUsersService.IsWorkmateOrFriend(Args) then
  7772. begin
  7773. MessageBox(Handle, PChar('用户 ' + Args + ' 已在您的好友列表中!'), '提示', MB_ICONINFORMATION);
  7774. Exit;
  7775. end;
  7776. ShowAddFriendWindow(Self, Args, '');
  7777. Exit;
  7778. end;
  7779. end;
  7780. //------------------------------------------------------------------------------
  7781. procedure TMainForm.ppLanguagesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  7782. begin
  7783. ChangePPMenuColorMap(ppLanguages.PopupMenu);
  7784. end;
  7785. //------------------------------------------------------------------------------
  7786. procedure TMainForm.miLanguageClick(Sender: TObject);
  7787. var
  7788. MenuItem: TMenuItem;
  7789. begin
  7790. MenuItem := Sender as TMenuItem;
  7791. ChangeLanguage(ExtractFilePath(Application.ExeName) + 'Languages\' + AnsiReplaceStr(MenuItem.Caption, '&', '') + '.ini');
  7792. end;
  7793. procedure TMainForm.miLeaveClick(Sender: TObject);
  7794. begin
  7795. FLoginState := stLeave;
  7796. FLeaveMessage := '离开';
  7797. SetLoginStateControlState;
  7798. end;
  7799. //------------------------------------------------------------------------------
  7800. procedure TMainForm.ppLanguagesPopup(Sender: TObject);
  7801. var
  7802. MenuItem: TMenuItem;
  7803. procedure FindLanguages(APath: string);
  7804. var
  7805. DSearchRec: TSearchRec;
  7806. FindResult: Integer;
  7807. begin
  7808. ppLanguages.Items.Clear;
  7809. FindResult := FindFirst(APath + '*.ini', faAnyFile, DSearchRec);
  7810. while FindResult = 0 do
  7811. begin
  7812. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  7813. if (DSearchRec.Attr and faDirectory) <> faDirectory then
  7814. begin
  7815. MenuItem := TMenuItem.Create(ppLanguages);
  7816. MenuItem.AutoHotkeys := maManual;
  7817. MenuItem.AutoLineReduction := maManual;
  7818. MenuItem.Caption := AnsiReplaceText(DSearchRec.Name, '.ini', '') + '&';
  7819. MenuItem.OnClick := miLanguageClick;
  7820. MenuItem.RadioItem := True;
  7821. MenuItem.AutoCheck := True;
  7822. MenuItem.Enabled := Language <> AnsiReplaceText(DSearchRec.Name, '.ini', '');
  7823. MenuItem.Checked := Language = AnsiReplaceText(DSearchRec.Name, '.ini', '');
  7824. ppLanguages.Items.Insert(0, MenuItem);
  7825. end;
  7826. FindResult := FindNext(DSearchRec);
  7827. end;
  7828. end;
  7829. begin
  7830. FindLanguages(ExtractFilePath(Application.ExeName) + 'Languages\');
  7831. end;
  7832. //------------------------------------------------------------------------------
  7833. procedure TMainForm.Post(stURL, stPostData: string; var wbWebBrowser: TWebBrowser);
  7834. var
  7835. vWebAddr, vPostData, vFlags, vFrame, vHeaders: OleVariant;
  7836. iLoop: Integer;
  7837. begin
  7838. {Are we posting data to this Url?}
  7839. if Length(stPostData) > 0 then
  7840. begin
  7841. {头信息当PostData使.}
  7842. vHeaders := 'Content-Type: application/x-www-form-urlencoded' + #10#13#0;
  7843. vPostData := VarArrayCreate([0, Length(stPostData)], varByte);
  7844. for iLoop := 0 to Length(stPostData) - 1 do
  7845. begin
  7846. vPostData[iLoop] := Ord(stPostData[iLoop + 1]);
  7847. end;
  7848. {结束字符}
  7849. vPostData[Length(stPostData)] := 0;
  7850. {Set the type of Variant, cast}
  7851. TVarData(vPostData).vType := varArray;
  7852. end;
  7853. vWebAddr := stURL;
  7854. wbWebBrowser.Navigate2(vWebAddr, vFlags, vFrame, vPostData, vHeaders);
  7855. end;
  7856. //------------------------------------------------------------------------------
  7857. procedure TMainForm.ChangeLanguage(ALanguageIniFile: string);
  7858. var
  7859. IniFile: TIniFile;
  7860. iLoop: Integer;
  7861. OldLVAddrbook, OldLVSystemMessage, OldLVMyContacters, OldLVMoreUsers, OldLVFriends, OldLVStrangers, OldLVBlacklists, OldLVLatests, OldLVTeams, OldLVSearch: string;
  7862. begin
  7863. inherited ChangeLanguage(ALanguageIniFile);
  7864. RealICQClient.ChangeLanguage(ALanguageIniFile);
  7865. IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Languages\' + Language + '.ini');
  7866. try
  7867. {$region}
  7868. with IniFile do
  7869. begin
  7870. OldLVSystemMessage := LVSystemMessage;
  7871. OldLVMyContacters := LVMyContacters;
  7872. OldLVFriends := LVFriends;
  7873. OldLVStrangers := LVStrangers;
  7874. OldLVBlacklists := LVBlacklists;
  7875. OldLVLatests := LVLatests;
  7876. OldLVTeams := LVTeams;
  7877. OldLVSearch := LVSearch;
  7878. OldLVMoreUsers := LVMoreUsers;
  7879. OldLVAddrbook := LvAddrbook;
  7880. LVSystemMessage := FilterStr(ReadString(string(Self.ClassName), 'LVSystemMessage', ''));
  7881. LVMyContacters := FilterStr(ReadString(string(Self.ClassName), 'LVMyContacters', ''));
  7882. LVMoreUsers := FilterStr(ReadString(string(Self.ClassName), 'LVMoreUser', ''));
  7883. LVFriends := FilterStr(ReadString(string(Self.ClassName), 'LVFriends', ''));
  7884. LVStrangers := FilterStr(ReadString(string(Self.ClassName), 'LVStrangers', ''));
  7885. LVBlacklists := FilterStr(ReadString(string(Self.ClassName), 'LVBlacklists', ''));
  7886. LVLatests := FilterStr(ReadString(string(Self.ClassName), 'LVLatests', ''));
  7887. LVTeams := FilterStr(ReadString(string(Self.ClassName), 'LVTeams', ''));
  7888. LVSearch := FilterStr(ReadString(string(Self.ClassName), 'LVSearch', ''));
  7889. LVAddrbook := FilterStr(ReadString(string(Self.ClassName), 'LVAddrbook', ''));
  7890. end;
  7891. {$endregion}
  7892. finally
  7893. FreeAndNil(IniFile);
  7894. end;
  7895. edWebSearchKeyWordExit(nil);
  7896. for iLoop := 0 to FContacterListViews.Count - 1 do
  7897. begin
  7898. if AnsiSameStr(OldLVSystemMessage, FContacterListViews.Strings[iLoop]) then
  7899. FContacterListViews.Strings[iLoop] := LVSystemMessage;
  7900. if AnsiSameStr(OldLVMyContacters, FContacterListViews.Strings[iLoop]) then
  7901. FContacterListViews.Strings[iLoop] := LVMyContacters;
  7902. if AnsiSameStr(OldLVFriends, FContacterListViews.Strings[iLoop]) then
  7903. FContacterListViews.Strings[iLoop] := LVFriends;
  7904. if AnsiSameStr(OldLVStrangers, FContacterListViews.Strings[iLoop]) then
  7905. FContacterListViews.Strings[iLoop] := LVStrangers;
  7906. if AnsiSameStr(OldLVAddrbook, FContacterListViews.Strings[iLoop]) then
  7907. FContacterListViews.Strings[iLoop] := LVAddrbook;
  7908. //if AnsiSameStr(OldLVBlacklists, FContacterListViews.Strings[iLoop]) then
  7909. // FContacterListViews.Strings[iLoop] := LVBlacklists;
  7910. if AnsiSameStr(OldLVLatests, FContacterListViews.Strings[iLoop]) then
  7911. FContacterListViews.Strings[iLoop] := LVLatests;
  7912. if AnsiSameStr(OldLVTeams, FContacterListViews.Strings[iLoop]) then
  7913. FContacterListViews.Strings[iLoop] := LVTeams;
  7914. if AnsiSameStr(OldLVSearch, FContacterListViews.Strings[iLoop]) then
  7915. FContacterListViews.Strings[iLoop] := LVSearch;
  7916. end;
  7917. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  7918. begin
  7919. if AnsiSameStr(OldLVMyContacters, FContacterTreeViews.Strings[iLoop]) then
  7920. FContacterTreeViews.Strings[iLoop] := LVMyContacters;
  7921. if AnsiSameStr(OldLVFriends, FContacterTreeViews.Strings[iLoop]) then
  7922. FContacterTreeViews.Strings[iLoop] := LVFriends;
  7923. if AnsiSameStr(OldLVMoreUsers, FContacterTreeViews.Strings[iLoop]) then
  7924. FContacterTreeViews.Strings[iLoop] := LVMoreUsers;
  7925. if AnsiSameStr(OldLVAddrbook, FContacterTreeViews.Strings[iLoop]) then
  7926. FContacterTreeViews.Strings[iLoop] := LVAddrbook;
  7927. end;
  7928. if (RealICQClient.Logined and RealICQClient.Connected and pnlWorkArea.Visible) then
  7929. begin
  7930. ShowGroupInterface;
  7931. end;
  7932. edFilterKeyword.Text := '';
  7933. edFilterKeywordExit(edFilterKeyword);
  7934. SetUIState;
  7935. end;
  7936. //------------------------------------------------------------------------------
  7937. procedure TMainForm.SetLoginControlsVisible(Value: Boolean);
  7938. begin
  7939. lblLoginNameTitle.Visible := Value;
  7940. spLoginNameBorder.Visible := Value;
  7941. spbChangeLoginName.Visible := Value;
  7942. edLoginName.Visible := Value;
  7943. lblPasswordTitle.Visible := Value;
  7944. spPasswordBorder.Visible := Value;
  7945. edPassword.Visible := Value;
  7946. lblLoginStateTitle.Visible := Value;
  7947. spbLoginState.Visible := Value;
  7948. spbSavePassword.Visible := Value;
  7949. spbAutoLogin.Visible := Value;
  7950. btnCALogin.Visible := GetCaConfig.GetEnable and Value;
  7951. btLogin.Visible := Value;
  7952. lblRemoveMyLoginInfo.Visible := Value and RealICQClient.SavedPassword;
  7953. lblPasswordTitle.Enabled := not lblRemoveMyLoginInfo.Visible;
  7954. edPassword.Enabled := not lblRemoveMyLoginInfo.Visible;
  7955. //lblForgotPassword.Visible := Value;
  7956. lblNetworkConfig.Visible := Value;
  7957. //lblHelper.Visible := Value;
  7958. //lblNetworkConfig.Top:=Height-100;
  7959. //lblHelper.Top:=Height-80;
  7960. //lblRegister.Visible := Value;
  7961. end;
  7962. //------------------------------------------------------------------------------
  7963. procedure TMainForm.RealICQClientDisconnected(Sender: TObject);
  7964. begin
  7965. ScrollBoxMoreUser.Tag := 0;
  7966. try
  7967. if FSearchListViewInVisible then
  7968. spbCancelFilterClick(nil);
  7969. //ToDo
  7970. if pnlMiddleRight.Visible then
  7971. ShowOrHideMuiltiWeb;
  7972. if Assigned(AGuideViewForm) then
  7973. FreeAndNil(AGuideViewForm);
  7974. finally
  7975. lblLoginState.Caption := '正在注销...';
  7976. SetLoginControlsVisible(False);
  7977. pnlWorkArea.Visible := False;
  7978. pnlLogout.Visible := True;
  7979. //WebBrowserForEMail.Navigate('http://mail.lishui.gov.cn/web_email/modules/i_logout.phtml');
  7980. TimerForCheckLogoutTimeout.Enabled := True;
  7981. TimerForGetBranchOnlineStates.Enabled := False;
  7982. pnlForTopMessage.Visible := False;
  7983. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  7984. { TODO -olqq -c : 退出时,重置Log的登录名 2014/12/14 10:59:28 }
  7985. LoggerImport.LoginName := '';
  7986. TTeamsAdapter.Stop;
  7987. TMessagesHander.GetHander.Uninstall;
  7988. TMainFormController.GetController.LogoutFromAppCentre;
  7989. FDBHistory.DBFileName := '';
  7990. end;
  7991. end;
  7992. //------------------------------------------------------------------------------
  7993. procedure TMainForm.SetUIState;
  7994. var
  7995. iLoop: Integer;
  7996. RealICQContacterListView: TRealICQContacterListView;
  7997. RealICQContacterTreeView: TRealICQContacterTreeView;
  7998. RealICQFriendTreeView: TRealICQContacterTreeView;
  7999. GroupMembers: TStringList;
  8000. TabSheet: TTabSheet;
  8001. SystemMessage: TRealICQSystemMessage;
  8002. NotReadMessageObject: TObject;
  8003. MessageList: TList;
  8004. Employee: TRealICQEmployee;
  8005. RealICQUser: TRealICQUser;
  8006. VisibleValue: Boolean;
  8007. iIndex: Integer;
  8008. GroupName, MessageID: string;
  8009. SysMsgInterface: TSysMsgInterface;
  8010. begin
  8011. if OptionsForm <> nil then
  8012. OptionsForm.GetSets;
  8013. {$region '根据状态显示登录界面上的按钮等界面元素的内容和行为'}
  8014. TimerForLogining.Enabled := RealICQClient.Logining;
  8015. if True then
  8016. edLoginName.Text := RealICQClient.InputLoginName;
  8017. if RealICQClient.Logining then
  8018. begin
  8019. actLoginAs.Enabled := False;
  8020. lblLoginState.Caption := '正在登录...';
  8021. lblLoginState.Refresh;
  8022. SetLoginControlsVisible(False);
  8023. btLogin.Enabled := True;
  8024. btLogin.Visible := True;
  8025. btLogin.Caption := '取消(&C)';
  8026. btLogin.Refresh;
  8027. Application.ProcessMessages;
  8028. end
  8029. else if RealICQClient.SavedPassword and (not RealICQClient.Logined) then
  8030. begin
  8031. edPassword.Text := '保存的密码';
  8032. lblPasswordTitle.Enabled := False;
  8033. edPassword.Enabled := False;
  8034. FLoginAsSavePassword := True;
  8035. actLoginAs.Enabled := (not RealICQClient.Logined or not RealICQClient.Connected) and (not RealICQClient.Logining);
  8036. actLoginAs.Caption := '作为 ' + RealICQClient.LoginName + ' 登录(&S)';
  8037. btLogin.Enabled := True;
  8038. btLogin.Visible := True;
  8039. btLogin.Caption := '登录(&S)';
  8040. btLogin.Refresh;
  8041. lblLoginState.Caption := '';
  8042. SetLoginControlsVisible(True);
  8043. end
  8044. else if (not RealICQClient.Logined) then
  8045. begin
  8046. edPassword.Text := '';
  8047. lblPasswordTitle.Enabled := True;
  8048. edPassword.Enabled := True;
  8049. FLoginAsSavePassword := False;
  8050. actLoginAs.Enabled := False;
  8051. actLoginAs.Caption := '作为 ... 登录(&S)';
  8052. btLogin.Enabled := True;
  8053. btLogin.Visible := True;
  8054. btLogin.Caption := '登录(&S)';
  8055. btLogin.Refresh;
  8056. lblLoginState.Caption := '';
  8057. SetLoginControlsVisible(True);
  8058. end;
  8059. {$endregion}
  8060. {$region '设置控件的Enabled属性'}
  8061. actReg.Enabled := (not RealICQClient.Logining) and (not RealICQClient.Reging);
  8062. actOptions.Enabled := (not RealICQClient.Logining) and (not RealICQClient.Reging);
  8063. actConnectSet.Enabled := actOptions.Enabled;
  8064. actLogout.Enabled := (not (not RealICQClient.Logined or not RealICQClient.Connected) and (not RealICQClient.Logining) and (not RealICQClient.Reging)) and RealICQClient.Connected;
  8065. actOpenRecvFileDir.Enabled := actLogout.Enabled;
  8066. btLogin.Default := not actLogout.Enabled;
  8067. actOnline.Enabled := actLogout.Enabled;
  8068. actHidden.Enabled := actLogout.Enabled;
  8069. actOffline.Enabled := actLogout.Enabled;
  8070. actBusy.Enabled := actLogout.Enabled;
  8071. actMute.Enabled := actLogout.Enabled;
  8072. actLeave.Enabled := actLogout.Enabled;
  8073. actPhone.Enabled := actLogout.Enabled;
  8074. actRepast.Enabled := actLogout.Enabled;
  8075. actMeeting.Enabled := actLogout.Enabled;
  8076. actOtherState.Enabled := actLogout.Enabled;
  8077. actOfflieAutoResponse.Enabled := actLogout.Enabled;
  8078. actPersonalSet.Enabled := actLogout.Enabled;
  8079. actChangePass.Enabled := actLogout.Enabled;
  8080. actFindUsers.Enabled := actLogout.Enabled;
  8081. actShowLoginName.Enabled := actLogout.Enabled;
  8082. actShowDisplayName.Enabled := actLogout.Enabled;
  8083. actShowAllName.Enabled := actLogout.Enabled;
  8084. actShowRemark.Enabled := actLogout.Enabled;
  8085. actShowBigHeadImage.Enabled := actLogout.Enabled;
  8086. actShowMiddleHeadImage.Enabled := actLogout.Enabled;
  8087. actShowSmallHeadImage.Enabled := actLogout.Enabled;
  8088. actShowNormalHeadImage.Enabled := actLogout.Enabled;
  8089. actShowGroup.Enabled := actLogout.Enabled;
  8090. actGroupManager.Enabled := actLogout.Enabled;
  8091. actShowStrangers.Enabled := actLogout.Enabled;
  8092. actShowBlacklists.Enabled := actLogout.Enabled;
  8093. actShowTeams.Enabled := actLogout.Enabled;
  8094. actShowLatests.Enabled := actLogout.Enabled;
  8095. actShowGIFInMailForm.Enabled := actLogout.Enabled;
  8096. actShowGIFInTalkingForm.Enabled := actLogout.Enabled;
  8097. actCustomFacesManager.Enabled := actLogout.Enabled;
  8098. actMsgManager.Enabled := actLogout.Enabled;
  8099. actAVSet.Enabled := actLogout.Enabled;
  8100. RealICQNetWorkDiskClientConnectStateChanged(Self.RealICQNetWorkDiskClient);
  8101. SetLoginStateMenuChecked;
  8102. SetStyleMenuChecked;
  8103. {$endregion}
  8104. {$region '设置控件的Visible属性'}
  8105. lblReConnect.Visible := False;
  8106. actLoginAs.Visible := actLoginAs.Enabled;
  8107. if (RealICQClient.WorkingMode = wmCorporation) then
  8108. begin
  8109. actShowBigHeadImage.Visible := False;
  8110. actShowMiddleHeadImage.Visible := False;
  8111. actShowStrangers.Visible := False;
  8112. actShowBlacklists.Visible := False;
  8113. actReg.Visible := False;
  8114. //actFindUsers.Visible := False;
  8115. actShowTree.Visible := False;
  8116. end
  8117. else
  8118. begin
  8119. actShowBigHeadImage.Visible := not actShowTree.Checked;
  8120. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  8121. actShowStrangers.Visible := True;
  8122. actShowBlacklists.Visible := True;
  8123. actReg.Visible := True;
  8124. //actFindUsers.Visible := True;
  8125. actShowTree.Visible := True;
  8126. end;
  8127. VisibleValue := RealICQClient.Logined and RealICQClient.Connected;
  8128. ActionManager.ActionBars.ActionBars[1].Items[1].Visible := VisibleValue;
  8129. ActionManager.ActionBars.ActionBars[1].Items[2].Visible := VisibleValue;
  8130. //spbShowHideRight.Visible := VisibleValue;
  8131. {$endregion}
  8132. {$region '根据登录/连接状态,显示登录界面或联系人界面'}
  8133. if RealICQClient.Logined and RealICQClient.Connected then
  8134. begin
  8135. pnlWorkArea.Visible := True;
  8136. pnlLogout.Visible := False;
  8137. SetAllTakingFormEnabledState(True);
  8138. SetAllSMSFormEnabledState(True);
  8139. if not TLimitCondition.UserInfoCheck(MainForm.RealICQClient.Me) then
  8140. MainForm.actPersonalSetExecute(nil)
  8141. else if TLimitCondition.FirstLoginComfirm then
  8142. begin
  8143. ShowMessage('请确认或修改您的用户信息,确保您的信息正确');
  8144. MainForm.actPersonalSetExecute(nil);
  8145. end;
  8146. end
  8147. else
  8148. begin
  8149. pnlWorkArea.Visible := False;
  8150. pnlLogout.Visible := True;
  8151. tsCustomerService.PageControl := nil;
  8152. tsCustomers.PageControl := pgcMainWorkArea;
  8153. RealICQNetWorkDiskClient.Logout;
  8154. if VideoForm <> nil then
  8155. FreeAndNil(VideoForm);
  8156. if CreateTeamForm <> nil then
  8157. FreeAndNil(CreateTeamForm);
  8158. if SearchForm <> nil then
  8159. FreeAndNil(SearchForm);
  8160. if SearchTeamForm <> nil then
  8161. FreeAndNil(SearchTeamForm);
  8162. if SelFaceForm <> nil then
  8163. FreeAndNil(SelFaceForm);
  8164. if CustomFacesManagerForm <> nil then
  8165. FreeAndNil(CustomFacesManagerForm);
  8166. if MessagesManagerForm <> nil then
  8167. FreeAndNil(MessagesManagerForm);
  8168. if AddFaceForm <> nil then
  8169. FreeAndNil(AddFaceForm);
  8170. try
  8171. CloseAllTeamOptionsForms;
  8172. except
  8173. end;
  8174. try
  8175. WebBrowserForAdvertisement.OnDocumentComplete := nil;
  8176. WebBrowserForAdvertisement.OnBeforeNavigate2 := nil;
  8177. pnlAdvertisement.Height := 0;
  8178. if WebBrowserForAdvertisement.Busy then
  8179. WebBrowserForAdvertisement.Stop;
  8180. WebBrowserForAdvertisement.Navigate('about:blank');
  8181. except
  8182. end;
  8183. try
  8184. // CloseAllSeeUserInformationForms;
  8185. except
  8186. end;
  8187. try
  8188. CloseAllChangeSystemMessageForms;
  8189. except
  8190. end;
  8191. try
  8192. SetAllTakingFormEnabledState(False);
  8193. SetAllSMSFormEnabledState(False);
  8194. except
  8195. end;
  8196. TimerForFlashTrayIcon.Enabled := False;
  8197. if Assigned(NotReadMessageBoxForm) then
  8198. NotReadMessageBoxForm.Visible := False;
  8199. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  8200. TrayIcon.SetDefaultIcon;
  8201. TrayIcon.Hint := Application.Title + ' - 未登录';
  8202. {$region '删除WEB标签'}
  8203. try
  8204. for iLoop := 0 to FWebTabs.Count - 1 do
  8205. begin
  8206. TabSheet := FWebTabs[iLoop];
  8207. TabSheet.PageControl := nil;
  8208. FreeAndNil(TabSheet);
  8209. end;
  8210. except
  8211. end;
  8212. FWebTabs.Clear;
  8213. {$endregion}
  8214. {$region '删除未处理的系统消息'}
  8215. try
  8216. for iLoop := 0 to FSystemMessages.Count - 1 do
  8217. begin
  8218. SystemMessage := FSystemMessages[iLoop];
  8219. FreeAndNil(SystemMessage);
  8220. end;
  8221. except
  8222. end;
  8223. FSystemMessages.Clear;
  8224. {$endregion}
  8225. {$region '清除还未读的消息'}
  8226. for iLoop := 0 to FNotReadMessages.Count - 1 do
  8227. begin
  8228. MessageID := FNotReadMessages[iLoop];
  8229. if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  8230. begin
  8231. try
  8232. NotReadMessageObject := FNotReadMessages.Objects[iLoop];
  8233. FreeAndNil(NotReadMessageObject);
  8234. except
  8235. end;
  8236. end
  8237. else
  8238. begin
  8239. MessageList := FNotReadMessages.Objects[iLoop] as TList;
  8240. while MessageList.Count > 0 do
  8241. begin
  8242. try
  8243. NotReadMessageObject := TObject(MessageList[0]);
  8244. FreeAndNil(NotReadMessageObject);
  8245. except
  8246. end;
  8247. MessageList.Delete(0);
  8248. end;
  8249. FreeAndNil(MessageList);
  8250. end;
  8251. end;
  8252. FNotReadMessages.Clear;
  8253. {$endregion}
  8254. {try
  8255. for iLoop :=FNotAddedEmployeeList.Count-1 Downto 0 do
  8256. begin
  8257. try
  8258. RealICQUser:= FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  8259. if Assigned(RealICQUser) then FreeAndNil(RealICQUser);
  8260. except
  8261. end;
  8262. end;
  8263. finally
  8264. FNotAddedEmployeeList.Clear;
  8265. end; }
  8266. if FNotAddedEmployeeList.Count > 0 then
  8267. FNotAddedEmployeeList.Clear;
  8268. if Assigned(FLVSystemMessage) then
  8269. FLVSystemMessage.Items.Clear;
  8270. if Assigned(FLVTeams) then
  8271. FLVTeams.Items.Clear;
  8272. if Assigned(FLVCustomers) then
  8273. FLVCustomers.Items.Clear;
  8274. {$region '删除用于显示用户列表对象'}
  8275. for iLoop := FContacterListViews.Count - 1 downto 0 do
  8276. begin
  8277. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  8278. try
  8279. RealICQContacterListView.Items.Clear;
  8280. except
  8281. end;
  8282. GroupName := FContacterListViews[iLoop];
  8283. if AnsiSameText(GroupName, LVFriends) or AnsiSameText(GroupName, LVStrangers) or
  8284. {AnsiSameText(GroupName, LVBlacklists) or}
  8285. (FGroups.IndexOf(GroupName) >= 0) then
  8286. begin
  8287. try
  8288. FreeAndNil(RealICQContacterListView);
  8289. except
  8290. end;
  8291. FContacterListViews.Delete(iLoop);
  8292. end;
  8293. end;
  8294. for iLoop := FContacterTreeViews.Count - 1 downto 0 do
  8295. begin
  8296. try
  8297. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  8298. try
  8299. RealICQContacterTreeView.Clear;
  8300. except
  8301. end;
  8302. finally
  8303. try
  8304. FreeAndNil(RealICQContacterTreeView);
  8305. except
  8306. end;
  8307. FContacterTreeViews.Delete(iLoop);
  8308. end;
  8309. end;
  8310. for iLoop := FContacterTreeViews.Count - 1 downto 0 do
  8311. begin
  8312. try
  8313. RealICQFriendTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  8314. try
  8315. RealICQFriendTreeView.Clear;
  8316. except
  8317. end;
  8318. finally
  8319. try
  8320. FreeAndNil(RealICQFriendTreeView);
  8321. except
  8322. end;
  8323. FContacterTreeViews.Delete(iLoop);
  8324. end;
  8325. end;
  8326. {$endregion}
  8327. for iLoop := 0 to RealICQClient.SysMsgInterfaces.Count - 1 do
  8328. begin
  8329. SysMsgInterface := RealICQClient.SysMsgInterfaces.Objects[iLoop] as TSysMsgInterface;
  8330. FreeAndNil(SysMsgInterface);
  8331. end;
  8332. RealICQClient.SysMsgInterfaces.Clear;
  8333. for iLoop := 0 to FGroups.Count - 1 do
  8334. begin
  8335. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  8336. GroupMembers.Clear;
  8337. GroupMembers.Free;
  8338. end;
  8339. FGroups.Clear;
  8340. end;
  8341. {$endregion}
  8342. PostMessage(Handle, WM_SIZE, 0, 0);
  8343. Application.ProcessMessages;
  8344. if not TrayIcon.Visible then
  8345. begin
  8346. TrayIcon.Visible := True;
  8347. end;
  8348. end;
  8349. //------------------------------------------------------------------------------
  8350. procedure TMainForm.AddMessageHistory(ASystemMessageType: TSystemMessageType; ASimpleMessage: string; ASystemMessage: TRealICQSystemMessage);
  8351. var
  8352. ItemIndex: Integer;
  8353. ListItem: TRealICQContacterListItem;
  8354. ID: string;
  8355. begin
  8356. ID := '';
  8357. case ASystemMessageType of
  8358. smSimple:
  8359. begin
  8360. ID := IntToStr(GetTickCount);
  8361. while FLVSystemMessage.Items.IndexOf(ID) >= 0 do
  8362. begin
  8363. ID := IntToStr(GetTickCount);
  8364. Sleep(10);
  8365. Application.ProcessMessages;
  8366. end;
  8367. end;
  8368. smSystemMessage:
  8369. ID := IntToStr(ASystemMessage.MessageID);
  8370. end;
  8371. FLVSystemMessage.ShowHeadImageButton := False;
  8372. ItemIndex := FLVSystemMessage.Items.Add(ID);
  8373. ListItem := FLVSystemMessage.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  8374. with ListItem do
  8375. begin
  8376. DisplayName := TimeToStr(Now);
  8377. LoginState := stOnline;
  8378. case ASystemMessageType of
  8379. smSimple:
  8380. begin
  8381. Watchword := ASimpleMessage;
  8382. try
  8383. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + SimpleMessagePicture);
  8384. except
  8385. end;
  8386. end;
  8387. smSystemMessage:
  8388. begin
  8389. Watchword := ASystemMessage.Title;
  8390. try
  8391. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  8392. except
  8393. end;
  8394. end;
  8395. end;
  8396. ReDrawItem;
  8397. end;
  8398. FLVSystemMessage.TopIndex := ItemIndex;
  8399. end;
  8400. //------------------------------------------------------------------------------
  8401. constructor TMainForm.Create(AOwner: TComponent);
  8402. begin
  8403. MainForm := Self;
  8404. inherited Create(AOwner);
  8405. end;
  8406. //------------------------------------------------------------------------------
  8407. procedure TMainForm.FormCreate(Sender: TObject);
  8408. function URLDecode(const S: string): string;
  8409. var
  8410. Idx: Integer; // loops thru chars in string
  8411. Hex: string; // string of hex characters
  8412. Code: Integer; // hex character code (-1 on error)
  8413. begin
  8414. // Intialise result and string index
  8415. Result := '';
  8416. Idx := 1;
  8417. // Loop thru string decoding each character
  8418. while Idx <= Length(S) do
  8419. begin
  8420. case S[Idx] of
  8421. '%':
  8422. begin
  8423. // % should be followed by two hex digits - exception otherwise
  8424. if Idx <= Length(S) - 2 then
  8425. begin
  8426. // there are sufficient digits - try to decode hex digits
  8427. Hex := S[Idx + 1] + S[Idx + 2];
  8428. Code := SysUtils.StrToIntDef('$' + Hex, -1);
  8429. Inc(Idx, 2);
  8430. end
  8431. else
  8432. // insufficient digits - error
  8433. Code := -1;
  8434. // check for error and raise exception if found
  8435. if Code = -1 then
  8436. raise SysUtils.EConvertError.Create('Invalid hex digit in URL');
  8437. // decoded OK - add character to result
  8438. Result := Result + Chr(Code);
  8439. end;
  8440. '+':
  8441. // + is decoded as a space
  8442. Result := Result + ' ' else
  8443. // All other characters pass thru unchanged
  8444. Result := Result + S[Idx];
  8445. end;
  8446. Inc(Idx);
  8447. end;
  8448. end;
  8449. function UserIsLogined(user: string): Boolean;
  8450. var
  8451. hWndStart, hwndLike: HWND;
  8452. WndCaption: array[0..254] of char;
  8453. WndClassName: array[0..254] of char;
  8454. ActiveTimes: Integer;
  8455. begin
  8456. Result := False;
  8457. try
  8458. ActiveTimes := 0;
  8459. hWndStart := GetDesktopWindow;
  8460. hwndLike := GetWindow(hWndStart, GW_CHILD);
  8461. while hwndLike <> 0 do
  8462. begin
  8463. GetWindowText(hwndLike, @WndCaption, 254);
  8464. GetClassName(hwndLike, @WndClassName, 254);
  8465. if (pos(user, StrPas(WndCaption)) <> 0) and (pos('TrueHiddenMainForm', StrPas(WndClassName)) <> 0) then
  8466. begin
  8467. Result := True;
  8468. ShowWindow(hwndLike, SW_SHOW);
  8469. ForceForeGroundWindow(hwndLike);
  8470. Inc(ActiveTimes);
  8471. if ActiveTimes >= 2 then
  8472. Break;
  8473. end;
  8474. hwndLike := GetWindow(hwndLike, GW_HWNDNEXT);
  8475. end;
  8476. except
  8477. on E: Exception do
  8478. begin
  8479. Error(E.Message, 'TMainForm.UserIsLogined(' + user + ')');
  8480. end;
  8481. end;
  8482. end;
  8483. var
  8484. iIndex, i: Integer;
  8485. gif: TGIFImage;
  8486. ca: string;
  8487. IdHttp: TIdHTTP;
  8488. ResponeStr: string;
  8489. Sends: TStrings;
  8490. jo, ja: ISuperObject;
  8491. CALoginName, CAPassWord: string;
  8492. icon: TIcon; //cmg
  8493. begin
  8494. try
  8495. TAuthority.SetDropFileAuthority;
  8496. TrayIcon.Visible := False;
  8497. if FileExists(ExtractFilePath(paramstr(0)) + LoginingGif) then
  8498. begin
  8499. gif := TGIFImage.Create;
  8500. try
  8501. gif.LoadFromFile(ExtractFilePath(paramstr(0)) + LoginingGif);
  8502. gif.Animate := True;
  8503. ImgLoadingMoreBranchs.Picture.Assign(gif);
  8504. finally
  8505. gif.Free;
  8506. end;
  8507. end;
  8508. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\0.ico', $ff00ff);
  8509. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\1.ico', $ff00ff);
  8510. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\2.ico', $ff00ff);
  8511. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\3.ico', $ff00ff);
  8512. //cmg
  8513. begin
  8514. Icon := Ticon.create;
  8515. try
  8516. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\3.ico');
  8517. i := ImgLstForLogining.addicon(Icon);
  8518. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\2.ico');
  8519. i := ImgLstForLogining.addicon(Icon);
  8520. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\1.ico');
  8521. i := ImgLstForLogining.addicon(Icon);
  8522. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\0.ico');
  8523. i := ImgLstForLogining.addicon(Icon);
  8524. finally
  8525. Icon.Free;
  8526. end;
  8527. end;
  8528. //注册自定义消息
  8529. CLOSEWINDOWS := RegisterWindowMessage('关闭窗口');
  8530. if FileExists(ExtractFilePath(Application.ExeName) + 'Images\Logo.gif') then
  8531. ImgLogo.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Logo.gif');
  8532. if FileExists(ExtractFilePath(Application.ExeName) + 'Images\AppCode.png') then
  8533. Image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\AppCode.png');
  8534. LoadMainTabImage;
  8535. LoadGroupConfig;
  8536. FDownFile := TDownFile.Create;
  8537. FDownFile.OnComplete := DownFileComplete;
  8538. //调用自动更新程序
  8539. FCheckedUpdate := True;
  8540. try
  8541. RegisterOleFile(ExtractFilePath(Application.ExeName) + IEContext_DLL_PACH, 1);
  8542. except
  8543. on E: Exception do
  8544. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(IEContext.dll)');
  8545. end;
  8546. try
  8547. RegisterOleFile(ExtractFilePath(Application.ExeName) + ImageX2_DLL_PACH, 1);
  8548. except
  8549. on E: Exception do
  8550. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(ImageX2.dll)');
  8551. end;
  8552. try
  8553. RegisterOleFile(ExtractFilePath(Application.ExeName) + AppCentreCom_DLL_PACH, 1);
  8554. except
  8555. on E: Exception do
  8556. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(AppCentreCom.dll)');
  8557. end;
  8558. if HookID <> 0 then
  8559. UnHookWindowsHookEx(HookID);
  8560. HookID := SetWindowsHookEx(WH_MOUSE, MouseProc, 0, GetCurrentThreadId());
  8561. MinButtonForClose := True;
  8562. FGettedTrayIconRect := False;
  8563. FMainFormHidden := False;
  8564. FHidePosition := hpNone;
  8565. SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
  8566. Caption := Application.Title;
  8567. actOpenMainForm.Caption := '打开 ' + Application.Title + ' 主界面(&O)';
  8568. btShowMiniPage.Visible := TCustomerConfig.GetConfig.ShowGuideViewBtn;
  8569. FIsLogout := False;
  8570. DoubleBuffered := True;
  8571. pnlTop.DoubleBuffered := True;
  8572. pnlClient.DoubleBuffered := True;
  8573. pnlWorkArea.DoubleBuffered := True;
  8574. pnlLogout.DoubleBuffered := True;
  8575. edFilterKeyword.DoubleBuffered := True;
  8576. pnlWebSearch.DoubleBuffered := True;
  8577. pnlWebSearchSplit.DoubleBuffered := True;
  8578. pnlTeams.DoubleBuffered := True;
  8579. pnlAll.DoubleBuffered := True;
  8580. edLoginName.DoubleBuffered := True;
  8581. edPassword.DoubleBuffered := True;
  8582. pnlNDToolBar.DoubleBuffered := True;
  8583. pnlNDStateBar.DoubleBuffered := True;
  8584. pnlNetWorkFiles.DoubleBuffered := True;
  8585. pnlMiddleClient.DoubleBuffered := True;
  8586. pgcMultiWeb.DoubleBuffered := True;
  8587. pnlToolBar.DoubleBuffered := True;
  8588. FHintWindow := TSingleBorderHintWindow.Create(Self);
  8589. FHintWindow.Visible := False;
  8590. FGetUsersTask := TStringList.Create;
  8591. //默认值
  8592. ActiveButtonTag := 1;
  8593. HotKeyID_ReadMessage := 0;
  8594. HotKeyID_CopyScreen := 0;
  8595. FShowGroup := False;
  8596. FFlashCaptionOnOnline := True;
  8597. FLVSelectedItemBorderColor := $00E9CAAD;
  8598. FLVSelectedItemBorderInnerColor := $00F7F7F7;
  8599. FLVSelectedItemBackColor := $00FEE9CE;
  8600. FLVHeadImageBorderColor := $00E9CAAD;
  8601. FLVHeadImageBackColor := clWhite;
  8602. FLVStyle := lsMiddleHeadImage;
  8603. FLVCaptionStyle := csDisplayName;
  8604. FShowTree := False;
  8605. LoadDefaultConfigs;
  8606. FFlashTrayIconIndex := 0;
  8607. FFlashTrayIconIndexAtLogining := 0;
  8608. FNotReadMessages := TStringList.Create;
  8609. FGroups := TStringList.Create;
  8610. FWebTabs := TList.Create;
  8611. FFaceList := TStringList.Create;
  8612. FTempFaceList := TStringList.Create;
  8613. FFaceCategory := TStringList.Create;
  8614. FInputFont := TFont.Create;
  8615. FContacterListViews := TStringList.Create;
  8616. FContacterTreeViews := TStringList.Create;
  8617. FContacterTreeViews := TStringList.Create;
  8618. FSystemMessages := TList.Create;
  8619. TMainFormController.GetController.ChangeStyle;
  8620. try
  8621. FDBHistory := TRealICQDBHistory.Create;
  8622. except
  8623. //ShowMessage('数据库创建失败');
  8624. on E: Exception do
  8625. begin
  8626. ShowMessage('异常类名称:' + E.ClassName + #13#10 + '异常信息:' + E.Message);
  8627. end;
  8628. end;
  8629. FWebPanels := TStringList.Create;
  8630. FOfflineAutoResponseTexts := TStringList.Create;
  8631. FNotAddedEmployeeList := TStringList.Create;
  8632. FSystemNotices := TList.Create;
  8633. FToolBarButtonList := TStringList.Create;
  8634. FToolBarButtonIconList := TStringList.Create;
  8635. FManageGroupMsgList := TStringList.Create;
  8636. FManageGroupMemberMsgList := TStringList.Create;
  8637. FFriendInfo := TStringList.Create;
  8638. FLoginAsSavePassword := False;
  8639. FSavePassword := False;
  8640. FAutoLogin := False;
  8641. FLoginState := stOnline;
  8642. FLeaveMessage := '';
  8643. FServerInfoList := TStringList.Create;
  8644. pnlMiddleClient.Align := alClient;
  8645. pnlMiddleRight.Align := alRight;
  8646. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  8647. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  8648. ChangeLanguage(ExtractFilePath(Application.ExeName) + 'Languages\简体中文.ini');
  8649. {$region '生成显示系统消息的ListView'}
  8650. AddContacterListView(pnlTemp, LVSystemMessage);
  8651. FLVSystemMessage := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8652. FContacterListViews.Delete(0);
  8653. FLVSystemMessage.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  8654. FLVSystemMessage.Style := lsSmallHeadImage;
  8655. FLVSystemMessage.CaptionStyle := csDisplayName;
  8656. FLVSystemMessage.PopupMenu := nil;
  8657. FLVSystemMessage.OnItemOnline := nil;
  8658. FLVSystemMessage.OnItemOffline := nil;
  8659. FLVSystemMessage.OnItemMouseEnter := nil;
  8660. FLVSystemMessage.OnItemMouseLeave := nil;
  8661. FLVSystemMessage.OnItemIconButtonClick := nil;
  8662. FLVSystemMessage.OnItemIconButtonDblClick := nil;
  8663. FLVSystemMessage.ShowMobileButton := False;
  8664. FLVSystemMessage.ShowTelButton := False;
  8665. FLVSystemMessage.ShowEmailButton := False;
  8666. FLVSystemMessage.ShowSMSButton := False;
  8667. FLVSystemMessage.ShowCameraButton := False;
  8668. FLVSystemMessage.ShowHeadImageButton := False;
  8669. FLVSystemMessage.ShowHint := False;
  8670. FLVSystemMessage.SelectedItemBackgroud.Graphic := nil;
  8671. FLVSystemMessage.HeadImageBorderColor := clWhite;
  8672. FLVSystemMessage.SelectedItemBorderInnerColor := clWhite;
  8673. FLVSystemMessage.SelectedItemBackColor := clWhite;
  8674. {$endregion}
  8675. {$region '生成显示群组列表的ListView'}
  8676. AddContacterListView(ScrollBoxTeam, LVTeams);
  8677. // navForContacters.Groups[3] := LVTeams;
  8678. FLVTeams := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8679. FContacterListViews.Delete(0);
  8680. FLVTeams.AdjustPosition := False;
  8681. FLVTeams.LeavePicture := nil;
  8682. FLVTeams.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  8683. FLVTeams.Style := lsSmallHeadImage;
  8684. FLVTeams.CaptionStyle := csDisplayName;
  8685. FLVTeams.PopupMenu := ppTeamListView;
  8686. FLVTeams.OnItemOnline := nil;
  8687. FLVTeams.OnItemOffline := nil;
  8688. FLVTeams.OnItemMouseEnter := nil;
  8689. FLVTeams.OnItemMouseLeave := nil;
  8690. FLVTeams.OnItemIconButtonClick := nil;
  8691. FLVTeams.OnItemIconButtonDblClick := nil;
  8692. FLVTeams.ShowMobileButton := False;
  8693. FLVTeams.ShowTelButton := False;
  8694. FLVTeams.ShowEmailButton := False;
  8695. FLVTeams.ShowSMSButton := False;
  8696. FLVTeams.ShowCameraButton := False;
  8697. FLVTeams.ShowHeadImageButton := False;
  8698. pnlTeams.Parent := ScrollBoxTeam;
  8699. pnlTeams.Align := alTop;
  8700. pnlTeams.ShowHint := False;
  8701. {$endregion}
  8702. {$region '生成显示网络硬盘文件的ListView'}
  8703. AddContacterListView(pnlNDFiles, '网络硬盘');
  8704. FLVNetWorkDisk := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8705. FLVNetWorkDisk.Align := alClient;
  8706. FContacterListViews.Delete(0);
  8707. FLVNetWorkDisk.LeavePicture := nil;
  8708. FLVNetWorkDisk.SelectedItemBackgroud.Graphic := nil;
  8709. FLVNetWorkDisk.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8710. FLVNetWorkDisk.Style := lsSmallHeadImage;
  8711. FLVNetWorkDisk.CaptionStyle := csDisplayName;
  8712. FLVNetWorkDisk.PopupMenu := ppNetWorkFile;
  8713. FLVNetWorkDisk.HeadImageBorderColor := clWhite;
  8714. FLVNetWorkDisk.SelectedItemBorderInnerColor := clWhite;
  8715. FLVNetWorkDisk.SelectedItemBackColor := clWhite;
  8716. FLVNetWorkDisk.OnItemOnline := nil;
  8717. FLVNetWorkDisk.OnItemOffline := nil;
  8718. FLVNetWorkDisk.OnItemMouseEnter := nil;
  8719. FLVNetWorkDisk.OnItemMouseLeave := nil;
  8720. FLVNetWorkDisk.OnItemIconButtonClick := nil;
  8721. FLVNetWorkDisk.OnItemIconButtonDblClick := nil;
  8722. FLVNetWorkDisk.ShowMobileButton := False;
  8723. FLVNetWorkDisk.ShowTelButton := False;
  8724. FLVNetWorkDisk.ShowEmailButton := False;
  8725. FLVNetWorkDisk.ShowSMSButton := False;
  8726. FLVNetWorkDisk.ShowCameraButton := False;
  8727. FLVNetWorkDisk.ShowHeadImageButton := False;
  8728. FLVNetWorkDisk.AdjustPosition := True;
  8729. FLVNetWorkDisk.OnItemShowHint := ItemShowHint;
  8730. FLVNetWorkDisk.OnItemDoubleClick := NDItemDoubleClick;
  8731. FLVNetWorkDisk.OnSelectItemChanged := NDSelectItemChanged;
  8732. FLVNetWorkDisk.OnItemClick := NDSelectItemChanged;
  8733. FLVNetWorkDisk.OnItemMouseEnter := NDSelectItemChanged;
  8734. FLVNetWorkDisk.OnDropFiles := NDMissionDropFiles;
  8735. FLVNetWorkDisk.OnItemMouseDown := NDItemMouseDown;
  8736. DragAcceptFiles(FLVNetWorkDisk.Handle, True);
  8737. {$endregion}
  8738. {$region '生成显示网络硬盘上传文件任务列表的ListView'}
  8739. AddContacterListView(tsUploadingFiles, '硬盘上传文件');
  8740. FLVNetWorkDiskUploadingFiles := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8741. FLVNetWorkDiskUploadingFiles.Align := alClient;
  8742. FContacterListViews.Delete(0);
  8743. FLVNetWorkDiskUploadingFiles.LeavePicture := nil;
  8744. FLVNetWorkDiskUploadingFiles.SelectedItemBackgroud.Graphic := nil;
  8745. FLVNetWorkDiskUploadingFiles.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8746. FLVNetWorkDiskUploadingFiles.Style := lsSmallHeadImage;
  8747. FLVNetWorkDiskUploadingFiles.CaptionStyle := csDisplayName;
  8748. FLVNetWorkDiskUploadingFiles.PopupMenu := ppNetWorkMisson;
  8749. FLVNetWorkDiskUploadingFiles.HeadImageBorderColor := clWhite;
  8750. FLVNetWorkDiskUploadingFiles.SelectedItemBorderInnerColor := clWhite;
  8751. FLVNetWorkDiskUploadingFiles.SelectedItemBackColor := clWhite;
  8752. FLVNetWorkDiskUploadingFiles.OnItemOnline := nil;
  8753. FLVNetWorkDiskUploadingFiles.OnItemOffline := nil;
  8754. FLVNetWorkDiskUploadingFiles.OnItemMouseEnter := nil;
  8755. FLVNetWorkDiskUploadingFiles.OnItemMouseLeave := nil;
  8756. FLVNetWorkDiskUploadingFiles.OnItemIconButtonClick := NDMissionItemIconButtonClick;
  8757. FLVNetWorkDiskUploadingFiles.OnItemIconButtonDblClick := nil;
  8758. FLVNetWorkDiskUploadingFiles.ShowMobileButton := False;
  8759. FLVNetWorkDiskUploadingFiles.ShowTelButton := False;
  8760. FLVNetWorkDiskUploadingFiles.ShowEmailButton := False;
  8761. FLVNetWorkDiskUploadingFiles.ShowSMSButton := False;
  8762. FLVNetWorkDiskUploadingFiles.ShowCameraButton := False;
  8763. FLVNetWorkDiskUploadingFiles.ShowHeadImageButton := False;
  8764. FLVNetWorkDiskUploadingFiles.AdjustPosition := False;
  8765. FLVNetWorkDiskUploadingFiles.OnItemShowHint := ItemShowHint;
  8766. FLVNetWorkDiskUploadingFiles.OnItemDoubleClick := nil;
  8767. FLVNetWorkDiskUploadingFiles.OnSelectItemChanged := nil;
  8768. FLVNetWorkDiskUploadingFiles.OnItemClick := nil;
  8769. FLVNetWorkDiskUploadingFiles.OnItemMouseEnter := nil;
  8770. FLVNetWorkDiskUploadingFiles.ShowSMSButton := True;
  8771. FLVNetWorkDiskUploadingFiles.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CancelIcon);
  8772. {$endregion}
  8773. {$region '生成显示网络硬盘下载文件任务列表的ListView'}
  8774. AddContacterListView(tsDownloadingFiles, '硬盘下载文件');
  8775. FLVNetWorkDiskDownloadingFiles := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8776. FLVNetWorkDiskDownloadingFiles.Align := alClient;
  8777. FContacterListViews.Delete(0);
  8778. FLVNetWorkDiskDownloadingFiles.LeavePicture := nil;
  8779. FLVNetWorkDiskDownloadingFiles.SelectedItemBackgroud.Graphic := nil;
  8780. FLVNetWorkDiskDownloadingFiles.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8781. FLVNetWorkDiskDownloadingFiles.Style := lsSmallHeadImage;
  8782. FLVNetWorkDiskDownloadingFiles.CaptionStyle := csDisplayName;
  8783. FLVNetWorkDiskDownloadingFiles.PopupMenu := ppNetWorkMisson;
  8784. FLVNetWorkDiskDownloadingFiles.HeadImageBorderColor := clWhite;
  8785. FLVNetWorkDiskDownloadingFiles.SelectedItemBorderInnerColor := clWhite;
  8786. FLVNetWorkDiskDownloadingFiles.SelectedItemBackColor := clWhite;
  8787. FLVNetWorkDiskDownloadingFiles.OnItemOnline := nil;
  8788. FLVNetWorkDiskDownloadingFiles.OnItemOffline := nil;
  8789. FLVNetWorkDiskDownloadingFiles.OnItemMouseEnter := nil;
  8790. FLVNetWorkDiskDownloadingFiles.OnItemMouseLeave := nil;
  8791. FLVNetWorkDiskDownloadingFiles.OnItemIconButtonClick := NDMissionItemIconButtonClick;
  8792. FLVNetWorkDiskDownloadingFiles.OnItemIconButtonDblClick := nil;
  8793. FLVNetWorkDiskDownloadingFiles.ShowMobileButton := False;
  8794. FLVNetWorkDiskDownloadingFiles.ShowTelButton := False;
  8795. FLVNetWorkDiskDownloadingFiles.ShowEmailButton := False;
  8796. FLVNetWorkDiskDownloadingFiles.ShowSMSButton := False;
  8797. FLVNetWorkDiskDownloadingFiles.ShowCameraButton := False;
  8798. FLVNetWorkDiskDownloadingFiles.ShowHeadImageButton := False;
  8799. FLVNetWorkDiskDownloadingFiles.AdjustPosition := False;
  8800. FLVNetWorkDiskDownloadingFiles.OnItemShowHint := ItemShowHint;
  8801. FLVNetWorkDiskDownloadingFiles.OnItemDoubleClick := nil;
  8802. FLVNetWorkDiskDownloadingFiles.OnSelectItemChanged := nil;
  8803. FLVNetWorkDiskDownloadingFiles.OnItemClick := nil;
  8804. FLVNetWorkDiskDownloadingFiles.OnItemMouseEnter := nil;
  8805. FLVNetWorkDiskDownloadingFiles.ShowSMSButton := True;
  8806. FLVNetWorkDiskDownloadingFiles.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CancelIcon);
  8807. {$endregion}
  8808. iIndex := AddContacterListView(tsCustomers, '客服人员');
  8809. FLVCustomers := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8810. FContacterListViews.Delete(iIndex);
  8811. FLVCustomers.AdjustPosition := False;
  8812. FLVCustomers.OnItemOnline := nil;
  8813. FLVCustomers.OnItemOffline := nil;
  8814. FLVCustomers.Style := lsSmallHeadImage;
  8815. FLVCustomers.Parent := tsCustomers;
  8816. FLVCustomers.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8817. FLVCustomers.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8818. iIndex := AddContacterListView(ScrollBoxLatests, LVLatests);
  8819. FLVLatests := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8820. FLVLatests.AdjustPosition := False;
  8821. FLVLatests.OnItemOnline := nil;
  8822. FLVLatests.OnItemOffline := nil;
  8823. FLVLatests.Parent := ScrollBoxLatests;
  8824. FLVLatests.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8825. FLVLatests.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8826. iIndex := AddContacterListView(ScrollBoxSearchMoreUser, LVMoreUsers);
  8827. FSearchListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8828. FSearchListView.OnItemOnline := nil;
  8829. FSearchListView.OnItemOffline := nil;
  8830. FSearchListView.OnItemIconButtonClick := nil;
  8831. FSearchListView.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8832. FSearchListView.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8833. FSearchListView.ShowTelButton := False;
  8834. FSearchListView.ShowCameraButton := False;
  8835. FSearchListView.ShowEmailButton := False;
  8836. FSearchListView.AdjustPosition := False;
  8837. iIndex := AddContacterListView(ScrollBoxSearchUser, LVSearch);
  8838. FSearchListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8839. FSearchListView.OnItemOnline := nil;
  8840. FSearchListView.OnItemOffline := nil;
  8841. ChangeUIColor(UIMainColor);
  8842. PostMessage(Handle, WM_SIZE, 0, 0);
  8843. Application.ProcessMessages;
  8844. Sleep(200);
  8845. SetUIState;
  8846. AddWebBrowserToPageControl('about:blank', -2);
  8847. lblWeatherCity.Transparent := True;
  8848. lblWeather.Transparent := True;
  8849. lblWeatheren.Transparent := True;
  8850. FToolBarButtonList.AddObject(LVMyContacters, MyContacters);
  8851. FToolBarButtonList.AddObject(LVMoreUsers, SysMsg);
  8852. FToolBarButtonList.AddObject(LVFriends, MyFriend);
  8853. FToolBarButtonList.AddObject(LvTeams, MyTeam);
  8854. FToolBarButtonList.AddObject(LvLatests, Latests);
  8855. FToolBarButtonIconList.AddObject(LVMyContacters, MyContactersIcon);
  8856. FToolBarButtonIconList.AddObject(LVMoreUsers, SysMsgIcon);
  8857. FToolBarButtonIconList.AddObject(LVFriends, MyFriendIcon);
  8858. FToolBarButtonIconList.AddObject(LvTeams, MyTeamIcon);
  8859. FToolBarButtonIconList.AddObject(LvLatests, LatestsIcon);
  8860. NotReadMessageBoxForm := TNotReadMessageBoxForm.Create(Self);
  8861. NotReadMessageBoxForm.Left := -1000;
  8862. NotReadMessageBoxForm.Top := -1000;
  8863. NotReadMessageBoxForm.Show;
  8864. NotReadMessageBoxForm.Hide;
  8865. tsContactersShow(tsContacters);
  8866. if ParamStr(1) = 'wscc://sso' then
  8867. begin
  8868. ca := DecodeString(ParamStr(2));
  8869. ca := URLDecode(ca);
  8870. //ca := copy(ca,pos('ca=',ca)+3,length(ca));
  8871. Sends := TStringList.Create;
  8872. IdHttp := TIdHTTP.Create(nil);
  8873. try
  8874. ResponeStr := Idhttp.post('http://' + RealICQClient.CaServerAddress + ':' + inttostr(RealICQClient.CaPort) + '/api/Structure/LoginByCA?ca=' + ca, Sends);
  8875. ResponeStr := UTF8Decode(ResponeStr);
  8876. try
  8877. jo := SO(ResponeStr);
  8878. CALoginName := jo['data.loginName'].AsString;
  8879. CAPassWord := jo['data.password'].AsString;
  8880. except
  8881. end;
  8882. finally
  8883. Freeandnil(IdHttp);
  8884. Sends.Free;
  8885. end;
  8886. if not UserIsLogined(CALoginName) then
  8887. RealICQClient.Login(CALoginName, CAPassWord, FLoginState, FLeaveMessage, FSavePassword, False, True)
  8888. else
  8889. begin
  8890. try
  8891. Application.Terminate;
  8892. except
  8893. end;
  8894. end;
  8895. end
  8896. else
  8897. begin
  8898. FAutoLogin := RealICQClient.AutoLogin;
  8899. FSavePassword := RealICQClient.SavedPassword;
  8900. SetLoginStateControlState;
  8901. if RealICQClient.AutoLogin and (RealICQClient.SavedPassword or RealICQClient.CALogin) then
  8902. RealICQClient.LoginAsSaved;
  8903. end;
  8904. tsCustomerService.PageControl := nil;
  8905. RealICQClient.OnGettedSysMsgInterfaces := RealICQClientGettedSysMsgInterfaces;
  8906. Application.ProcessMessages;
  8907. except
  8908. on E: Exception do
  8909. Error(E.Message, 'TMainForm.FormCreate');
  8910. end;
  8911. end;
  8912. //------------------------------------------------------------------------------
  8913. procedure TMainForm.FormDeactivate(Sender: TObject);
  8914. begin
  8915. if edWatchword.Visible then
  8916. edWatchwordExit(edWatchword);
  8917. end;
  8918. //------------------------------------------------------------------------------
  8919. procedure TMainForm.FormDestroy(Sender: TObject);
  8920. begin
  8921. try
  8922. if RealICQClient.Connected then
  8923. RealICQClient.Logout;
  8924. if AThreadPool <> nil then
  8925. AThreadPool.TerminateAllYarns;
  8926. FreeAndNil(FDownFile);
  8927. FHintWindow.ReleaseHandle;
  8928. FHintWindow.Free;
  8929. FGetUsersTask.Clear;
  8930. FreeAndNil(FGetUsersTask);
  8931. FServerInfoList.Clear;
  8932. FreeAndNil(FServerInfoList);
  8933. // FreeAndNil(FPCAMessage);
  8934. FreeAndNil(FOfflineAutoResponseTexts);
  8935. FNotAddedEmployeeList.Clear;
  8936. FreeAndNil(FNotAddedEmployeeList);
  8937. FSystemMessages.Clear;
  8938. FreeAndNil(FSystemMessages);
  8939. FToolBarButtonList.Clear;
  8940. FreeAndNil(FToolBarButtonList);
  8941. FToolBarButtonIconList.Clear;
  8942. FreeAndNil(FToolBarButtonIconList);
  8943. FNotReadMessages.Clear;
  8944. FreeAndNil(FNotReadMessages);
  8945. FContacterListViews.Clear;
  8946. FreeAndNil(FContacterListViews);
  8947. FContacterTreeViews.Clear;
  8948. FreeAndNil(FContacterTreeViews);
  8949. FWebTabs.Clear;
  8950. FreeAndNil(FWebTabs);
  8951. FGroups.Clear;
  8952. FreeAndNil(FGroups);
  8953. FFriendInfo.Clear;
  8954. FreeAndNil(FFriendInfo);
  8955. FManageGroupMsgList.Clear;
  8956. FreeAndNil(FManageGroupMsgList);
  8957. FManageGroupMemberMsgList.Clear;
  8958. FreeAndNil(FManageGroupMemberMsgList);
  8959. while FWebPanels.Count > 0 do
  8960. begin
  8961. try
  8962. FWebPanels.Objects[0].Free;
  8963. except
  8964. end;
  8965. FWebPanels.Delete(0);
  8966. end;
  8967. FWebPanels.Clear;
  8968. FreeAndNil(FWebPanels);
  8969. while FSystemNotices.Count > 0 do
  8970. begin
  8971. try
  8972. TSystemNotices(FSystemNotices[0]).Free;
  8973. except
  8974. end;
  8975. FSystemNotices.Delete(0);
  8976. end;
  8977. FSystemNotices.Clear;
  8978. FreeAndNil(FSystemNotices);
  8979. while FFaceList.Count > 0 do
  8980. begin
  8981. try
  8982. FFaceList.Objects[0].Free;
  8983. except
  8984. end;
  8985. FFaceList.Delete(0);
  8986. end;
  8987. FFaceList.Clear;
  8988. FreeAndNil(FFaceList);
  8989. while FTempFaceList.Count > 0 do
  8990. begin
  8991. try
  8992. FTempFaceList.Objects[0].Free;
  8993. except
  8994. end;
  8995. FTempFaceList.Delete(0);
  8996. end;
  8997. FTempFaceList.Clear;
  8998. FreeAndNil(FTempFaceList);
  8999. FFaceCategory.Clear;
  9000. FreeAndNil(FFaceCategory);
  9001. FreeAndNil(FInputFont);
  9002. FreeAndNil(FDBHistory);
  9003. if HookID <> 0 then
  9004. UnHookWindowsHookEx(HookID);
  9005. if HotKeyID_ReadMessage <> 0 then
  9006. begin
  9007. UnregisterHotKey(Handle, HotKeyID_ReadMessage);
  9008. DeleteAtom(HotKeyID_ReadMessage);
  9009. end;
  9010. if HotKeyID_CopyScreen <> 0 then
  9011. begin
  9012. UnregisterHotKey(Handle, HotKeyID_CopyScreen);
  9013. DeleteAtom(HotKeyID_CopyScreen);
  9014. end;
  9015. finally
  9016. GetDataModule.Uninstall;
  9017. end;
  9018. end;
  9019. //------------------------------------------------------------------------------
  9020. procedure TMainForm.FormResize(Sender: TObject);
  9021. var
  9022. iLoop: Integer;
  9023. ContacterTreeView: TRealICQContacterTreeView;
  9024. FriendTreeView: TRealICQContacterTreeView;
  9025. ListView: TRealICQContacterListView;
  9026. begin
  9027. ShowMeInformation;
  9028. if FContacterTreeViews = nil then
  9029. Exit;
  9030. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  9031. begin
  9032. ContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  9033. ContacterTreeView.ReDrawAll;
  9034. end;
  9035. {for iLoop := 0 to FContacterTreeViews.Count - 1 do
  9036. begin
  9037. FriendTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  9038. FriendTreeView.ReDrawAll;
  9039. end; }
  9040. for iLoop := 0 to FContacterListViews.Count - 1 do
  9041. begin
  9042. ListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  9043. ListView.ReDrawAll;
  9044. end;
  9045. if FLVNetWorkDisk <> nil then
  9046. FLVNetWorkDisk.ReDrawAll;
  9047. if FTVCustomerLatests <> nil then
  9048. FTVCustomerLatests.ReDrawAll;
  9049. pnlSearchMoreUser.Width := pnlSelectServer.Width - 5;
  9050. ImgLogining.Left := (pnlSearchMoreUser.Width - ImgLogining.Width) div 2;
  9051. { TODO -olqq -c : 二维码居中 2014/12/14 11:05:27 }
  9052. Image1.Left := (Self.Width - Image1.Width - 26) div 2;
  9053. end;
  9054. //------------------------------------------------------------------------------
  9055. procedure TMainForm.SaveWindowState;
  9056. begin
  9057. if WindowState <> wsMaximized then
  9058. begin
  9059. FMainFormLeft := Left;
  9060. FMainFormTop := Top;
  9061. FMainFormHeight := Height;
  9062. FMainFormWidth := Width - pnlMiddleRight.Width;
  9063. try
  9064. SaveDefaultConfigs;
  9065. except
  9066. end;
  9067. end;
  9068. end;
  9069. //------------------------------------------------------------------------------
  9070. procedure TMainForm.sbpNewWebTabClick(Sender: TObject);
  9071. begin
  9072. AddWebBrowserToPageControl('about:blank', -1);
  9073. end;
  9074. //------------------------------------------------------------------------------
  9075. procedure TMainForm.sbpSMSClick(Sender: TObject);
  9076. begin
  9077. OpenSMSForm('', True);
  9078. end;
  9079. //------------------------------------------------------------------------------
  9080. procedure TMainForm.FormShow(Sender: TObject);
  9081. begin
  9082. try
  9083. //tsCustomers.Parent := nil;
  9084. //tsCustomers.PageControl := nil;
  9085. //pgcMainWorkArea.RemoveControl(tsCustomers);
  9086. //FreeAndNil(tsCustomers);
  9087. except
  9088. end;
  9089. //tsNetWorkDisk.Parent := nil;
  9090. //tsNetWorkDisk.PageControl := nil;
  9091. //pgcMainWorkArea.RemoveControl(tsNetWorkDisk);
  9092. //FreeAndNil(tsNetWorkDisk);
  9093. ClearMemory;
  9094. actOpenMainForm.Execute;
  9095. end;
  9096. procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
  9097. begin
  9098. if FSearchListViewInVisible then
  9099. begin
  9100. edFilterKeyword.Text := '';
  9101. edFilterKeyword.Font.Color := clGray;
  9102. end;
  9103. Action := caNone;
  9104. if pnlMiddleRight.Visible then
  9105. begin
  9106. ShowOrHideMuiltiWeb;
  9107. Exit;
  9108. end;
  9109. ZoomEffect(Self, zaMinimize);
  9110. ShowWindow(Handle, SW_HIDE);
  9111. FHidden := True;
  9112. end;
  9113. //------------------------------------------------------------------------------
  9114. procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  9115. begin
  9116. SaveWindowState;
  9117. end;
  9118. //------------------------------------------------------------------------------
  9119. procedure TMainForm.actLoginExecute(Sender: TObject);
  9120. begin
  9121. end;
  9122. //------------------------------------------------------------------------------
  9123. procedure TMainForm.actRegExecute(Sender: TObject);
  9124. begin
  9125. if RegForm <> nil then
  9126. Exit;
  9127. RegForm := TRegForm.Create(Self);
  9128. try
  9129. if RegForm.ShowModal <> mrOK then
  9130. begin
  9131. RealICQClient.CancelReg;
  9132. end;
  9133. finally
  9134. FreeAndNil(RegForm);
  9135. end;
  9136. end;
  9137. //------------------------------------------------------------------------------
  9138. procedure TMainForm.actDelFriendExecute(Sender: TObject);
  9139. var
  9140. ItemIndex: Integer;
  9141. RealICQFriendTreeView: TRealICQContacterTreeView;
  9142. Friend: TRealICQEmployee;
  9143. begin
  9144. if MessageBox(Handle, '确实要将选中的用户从好友列表中删除吗?', '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  9145. Exit;
  9146. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9147. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9148. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  9149. if (Friend <> nil) then
  9150. begin
  9151. if Friend.BranchID = LVFriends then
  9152. RealICQClient.DelFriend(Friend.LoginName);
  9153. end;
  9154. end;
  9155. //------------------------------------------------------------------------------
  9156. procedure TMainForm.actRemoveUserExecute(Sender: TObject);
  9157. var
  9158. ItemIndex: Integer;
  9159. GroupName: string;
  9160. RealICQFriendTreeView: TRealICQContacterTreeView;
  9161. Friend: TRealICQEmployee;
  9162. MenuItem: TMenuItem;
  9163. begin
  9164. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9165. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9166. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  9167. if Friend = nil then
  9168. Exit;
  9169. GroupName := Friend.BranchID;
  9170. if MessageBox(Handle, PChar('确实要将选中的用户从' + GroupName + '删除吗?'), '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  9171. Exit;
  9172. if FShowGroup and (FGroups.IndexOf(GroupName) <> -1) then
  9173. begin
  9174. MenuItem := miGroup.Find(LVFriends);
  9175. miMoveGroupClick(MenuItem);
  9176. exit;
  9177. end;
  9178. {
  9179. Screen.Cursor := crHourGlass;
  9180. Application.ProcessMessages;
  9181. try
  9182. if GroupName = lvBlacklists then
  9183. begin
  9184. RealICQClient.DelBlacklists(Friend.LoginName);
  9185. ShowAddFriendWindow(Self, Friend.LoginName, Friend.DisplayName);
  9186. Sleep(15);
  9187. end;
  9188. finally
  9189. Screen.Cursor := crDefault;
  9190. end;
  9191. }
  9192. end;
  9193. //------------------------------------------------------------------------------
  9194. procedure TMainForm.actLogoutExecute(Sender: TObject);
  9195. begin
  9196. if GetTalkingFormCount > 0 then
  9197. begin
  9198. if MessageBox(Handle, '确实要注销吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  9199. Exit;
  9200. CloseAllTalkingForm;
  9201. end;
  9202. CloseAllSMSForm;
  9203. RealICQClient.Logout;
  9204. RealICQClient.FriendCount := 0;
  9205. FIsLogout := True;
  9206. end;
  9207. //------------------------------------------------------------------------------
  9208. procedure TMainForm.actLoginAsExecute(Sender: TObject);
  9209. begin
  9210. if RegForm <> nil then
  9211. begin
  9212. MessageBox(RegForm.Handle, '请先关闭新用户注册窗口', '提示', MB_ICONINFORMATION);
  9213. Exit;
  9214. end;
  9215. RealICQClient.LoginAsSaved;
  9216. end;
  9217. //------------------------------------------------------------------------------
  9218. procedure TMainForm.actOfflieAutoResponseExecute(Sender: TObject);
  9219. begin
  9220. if OptionsForm <> nil then
  9221. Exit;
  9222. OptionsForm := TOptionsForm.Create(Self);
  9223. try
  9224. OptionsForm.PageIndex := 11;
  9225. OptionsForm.ShowModal;
  9226. finally
  9227. FreeAndNil(OptionsForm);
  9228. end;
  9229. end;
  9230. procedure TMainForm.actOnlineExecute(Sender: TObject);
  9231. begin
  9232. RealICQClient.ChangeState(TRealICQLoginState((Sender as TAction).Tag), (Sender as TAction).Caption);
  9233. end;
  9234. //------------------------------------------------------------------------------
  9235. procedure TMainForm.actHiddenExecute(Sender: TObject);
  9236. begin
  9237. RealICQClient.ChangeState(stHidden, '');
  9238. end;
  9239. //------------------------------------------------------------------------------
  9240. procedure TMainForm.actLeaveExecute(Sender: TObject);
  9241. begin
  9242. RealICQClient.ChangeState(stLeave, (Sender as TAction).Caption);
  9243. end;
  9244. //------------------------------------------------------------------------------
  9245. procedure TMainForm.actHelpExecute(Sender: TObject);
  9246. begin
  9247. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar('http://www.lxtalk.com'),'',SW_SHOWMAXIMIZED);
  9248. //ShellExecute(handle, 'open',PChar(GetDefaultBrowser), PChar('http://www.lxtalk.com'),'',SW_SHOWMAXIMIZED);
  9249. end;
  9250. //------------------------------------------------------------------------------
  9251. procedure TMainForm.actOtherStateExecute(Sender: TObject);
  9252. var
  9253. LeaveMessage: string;
  9254. begin
  9255. LeaveMessage := Trim(ShowMyInputBox('其它状态', '请输入离开状态说明文字', '', 16));
  9256. if Length(LeaveMessage) > 0 then
  9257. RealICQClient.ChangeState(stLeave, LeaveMessage);
  9258. end;
  9259. //------------------------------------------------------------------------------
  9260. procedure TMainForm.RealICQClientLoginResult(Sender: TObject; LoginResultType: TRealICQLoginResultType; ResultMessage: string);
  9261. var
  9262. DBFileName: string;
  9263. hwnd: THandle;
  9264. begin
  9265. TimerForLogining.Enabled := False;
  9266. if not FCheckedUpdate then
  9267. begin
  9268. if not FileExists(ExtractFilePath(paramstr(0)) + 'Online.exe') then
  9269. DownLoadUpdateConfig
  9270. else
  9271. WinExec(PChar(ExtractFilePath(paramstr(0)) + 'Online.exe /S0 /C /Q'), SW_SHOW);
  9272. end;
  9273. FCheckedUpdate := not FCheckedUpdate;
  9274. case LoginResultType of
  9275. rtLoginOK, rtCanUpdate:
  9276. begin
  9277. Success('成功联上服务器!', 'TMainForm.RealICQClientLoginResult');
  9278. AddMessageHistory(smSimple, '登录至服务器', nil);
  9279. lblLoginState.Caption := '已登录,数据下载中...';
  9280. lblLoginState.Refresh;
  9281. lblNDState.Caption := RealICQClient.NetWorkDiskServerAddress + '(' + IntToStr(RealICQClient.NetWorkDiskServerPort) + ')';
  9282. DBFileName := RealICQClient.GetUserDir + PersonalMessageHistoryDBFile;
  9283. if not FileExists(DBFileName) then
  9284. CopyFile(PChar(ExtractFilePath(paramstr(0)) + MessageHistoryDBFile), PChar(DBFileName), False);
  9285. try
  9286. FDBHistory.LoginName := RealICQClient.LoginName;
  9287. FDBHistory.DBFileName := DBFileName;
  9288. except
  9289. on E: Exception do
  9290. begin
  9291. Error(E.Message, 'LoginResult 加载本地数据库失败');
  9292. end;
  9293. end;
  9294. // btShowMiniPage.Visible := RealICQClient.ShowMiniPage;
  9295. if RealICQClient.WorkingMode = wmPublic then
  9296. begin
  9297. {$region 'wmPublic工作模式'}
  9298. { AddContacterListView(navForContacters.Groups.Objects[0] as TScrollBox, LVFriends);
  9299. navForContacters.Groups[0] := LVFriends;
  9300. AddContacterListView(navForContacters.Groups.Objects[1] as TScrollBox, LVStrangers);
  9301. navForContacters.Groups[1] := LVStrangers;
  9302. AddContacterListView(navForContacters.Groups.Objects[2] as TScrollBox, LVBlacklists);
  9303. navForContacters.Groups[2] := LVBlacklists; }
  9304. {$endregion}
  9305. end
  9306. else if RealICQClient.WorkingMode = wmCorporation then
  9307. begin
  9308. {$region 'wmCorporation'}
  9309. FShowGroup := False;
  9310. AddFriendTreeView(ScrollBoxMyFriend, LVFriends);
  9311. AddContacterTreeView(ScrollBoxContacters, LVMyContacters);
  9312. AddContacterTreeView(ScrollBoxAddrBook, LVAddrBook);
  9313. /// <remarks>
  9314. /// LQQ
  9315. /// 把请求当前用户从RealICQClient移动到BranchService
  9316. /// </remarks>
  9317. TMessagesHander.GetHander.Init;
  9318. {$endregion}
  9319. end;
  9320. TMainFormController.GetController.LoginToAppCentre(RealICQClient.LoginName);
  9321. TTeamsAdapter.Start(RealICQClient.LoginName);
  9322. TGroupShareConfig.GetConfig.URL := RealICQClient.HeadImageURL;
  9323. end;
  9324. rtMustUpdate:
  9325. begin
  9326. //启动升级程序
  9327. hWnd := FindWindow(pchar('TUpdateFrm'), pchar(trim('自动更新')));
  9328. if hWnd = 0 then
  9329. WinExec('Update.exe', SW_SHOW);
  9330. end;
  9331. rtVersionError:
  9332. MessageBox(Handle, '抱歉,您当前使用的客户端版本不受支持', '登录失败', MB_ICONINFORMATION);
  9333. rtLoginErrorByDisplayName:
  9334. MessageBox(Handle, '存在姓名相同的用户,请使用登录名登录!', '登录失败', MB_ICONINFORMATION);
  9335. rtAuthorizationError:
  9336. begin
  9337. MessageBox(Handle, '用户名或密码错误', '登录失败', MB_ICONINFORMATION);
  9338. RealICQClient.ClearSavedPassword;
  9339. actLoginAs.Visible := False;
  9340. SetLoginControlsVisible(True);
  9341. end;
  9342. rtOther:
  9343. MessageBox(Handle, PChar(ResultMessage), '登录失败', MB_ICONINFORMATION);
  9344. end;
  9345. end;
  9346. //------------------------------------------------------------------------------
  9347. procedure TMainForm.RealICQClientLoginStateChanged(Sender: TObject);
  9348. begin
  9349. if not RealICQClient.Logined then
  9350. TimerForCheckLogoutTimeout.Enabled := False;
  9351. SetUIState;
  9352. ClearMemory;
  9353. end;
  9354. //------------------------------------------------------------------------------
  9355. procedure TMainForm.RealICQClientPleaseSendFaceToMe(Sender: TObject; ALoginName, AFaceMD5Code: string);
  9356. var
  9357. iIndex: Integer;
  9358. Face: TFace;
  9359. begin
  9360. iIndex := FFaceList.IndexOf(AFaceMD5Code);
  9361. if iIndex >= 0 then
  9362. begin
  9363. Face := FFaceList.Objects[iIndex] as TFace;
  9364. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, Face.FileName, foFace);
  9365. Exit;
  9366. end;
  9367. iIndex := FTempFaceList.IndexOf(AFaceMD5Code);
  9368. if iIndex >= 0 then
  9369. begin
  9370. Face := FTempFaceList.Objects[iIndex] as TFace;
  9371. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, Face.FileName, foFace);
  9372. Exit;
  9373. end;
  9374. if FileExists(FindRecvedFace(AFaceMD5Code)) then
  9375. begin
  9376. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, FindRecvedFace(AFaceMD5Code), foFace);
  9377. Exit;
  9378. end
  9379. end;
  9380. //------------------------------------------------------------------------------
  9381. procedure TMainForm.RealICQClientPleaseUploadTeamFace(Sender: TObject; MD5String: string; var FileName: string);
  9382. var
  9383. iIndex: Integer;
  9384. Face: TFace;
  9385. begin
  9386. iIndex := FFaceList.IndexOf(MD5String);
  9387. if iIndex >= 0 then
  9388. begin
  9389. Face := FFaceList.Objects[iIndex] as TFace;
  9390. FileName := Face.FileName;
  9391. Exit;
  9392. end;
  9393. iIndex := FTempFaceList.IndexOf(MD5String);
  9394. if iIndex >= 0 then
  9395. begin
  9396. Face := FTempFaceList.Objects[iIndex] as TFace;
  9397. FileName := Face.FileName;
  9398. Exit;
  9399. end;
  9400. if FileExists(FindRecvedFace(MD5String)) then
  9401. begin
  9402. FileName := FindRecvedFace(MD5String);
  9403. Exit;
  9404. end
  9405. end;
  9406. //------------------------------------------------------------------------------
  9407. procedure TMainForm.RealICQClientReConnectExecute(Sender: TObject; ASeconds: Integer);
  9408. begin
  9409. TimerForLogining.Enabled := False;
  9410. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  9411. TrayIcon.SetDefaultIcon;
  9412. lblLoginState.Caption := '连接已中断' + #$D#$A + IntToStr(ASeconds) + ' 秒后重新建立连接。';
  9413. lblLoginState.Visible := True;
  9414. SetLoginControlsVisible(False);
  9415. if not btLogin.Visible then
  9416. begin
  9417. btLogin.Visible := True;
  9418. btLogin.Caption := '取消(&C)';
  9419. btLogin.Refresh;
  9420. end;
  9421. lblReConnect.Visible := True;
  9422. TimerForCheckLogoutTimeout.Enabled := False;
  9423. if not RealICQClient.ReConnectExecuting then
  9424. RealICQClient.CancelReConnectAndLogin;
  9425. end;
  9426. //------------------------------------------------------------------------------
  9427. procedure TMainForm.RealICQClientRemovedUser(Sender: TObject; ALoginName: string);
  9428. var
  9429. itemIndex: Integer;
  9430. RealICQFriendTreeView: TRealICQContacterTreeView;
  9431. // Friend: TRealICQEmployee;
  9432. // Node: TTreeNode;
  9433. begin
  9434. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9435. if ItemIndex >= 0 then
  9436. begin
  9437. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9438. ItemIndex := RealICQFriendTreeView.EmployeeItems.IndexOf(ALoginName);
  9439. if ItemIndex >= 0 then
  9440. RealICQFriendTreeView.EmployeeItems.Delete(ItemIndex);
  9441. end;
  9442. // ShowNavBarNumeric;
  9443. end;
  9444. //------------------------------------------------------------------------------
  9445. procedure TMainForm.TimerForFlashTrayIconTimer(Sender: TObject);
  9446. var
  9447. Icon: TIcon;
  9448. Bitmap: TBitmap;
  9449. MessageID: string;
  9450. RealICQUser: TRealICQUser;
  9451. begin
  9452. if FNotReadMessages.Count = 0 then
  9453. begin
  9454. NotReadMessageBoxForm.Visible := False;
  9455. TimerForFlashTrayIcon.Enabled := False;
  9456. ShowMeInformation;
  9457. Exit;
  9458. end;
  9459. if not (RealICQClient.Logined and RealICQClient.Connected) then
  9460. begin
  9461. TimerForFlashTrayIcon.Enabled := False;
  9462. NotReadMessageBoxForm.Visible := False;
  9463. Exit;
  9464. end;
  9465. Icon := nil;
  9466. Bitmap := nil;
  9467. MessageID := FNotReadMessages.Strings[FNotReadMessages.Count - 1];
  9468. if AnsiSameStr(Copy(MessageID, 1, Length(SMSMessageID)), SMSMessageID) then
  9469. begin
  9470. Icon := TIcon.Create;
  9471. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSMessageIcon);
  9472. end
  9473. else if AnsiSameStr(Copy(MessageID, 1, Length(TeamMessageID)), TeamMessageID) then
  9474. begin
  9475. Icon := TIcon.Create;
  9476. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamIcon);
  9477. end
  9478. else if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  9479. begin
  9480. Icon := TIcon.Create;
  9481. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessageIcon);
  9482. end
  9483. else
  9484. begin
  9485. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(MessageID);
  9486. if FileExists(RealICQUser.HeadImageFile) then
  9487. begin
  9488. try
  9489. Bitmap := GetSamllBitmap(RealICQUser.HeadImageFile, 16, 16, False);
  9490. except
  9491. Icon := TIcon.Create;
  9492. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  9493. end;
  9494. end
  9495. else
  9496. begin
  9497. Icon := TIcon.Create;
  9498. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  9499. end;
  9500. end;
  9501. try
  9502. while ImgLstForFlashTrayIcon.Count > 1 do
  9503. ImgLstForFlashTrayIcon.Delete(1);
  9504. if Icon <> nil then
  9505. ImgLstForFlashTrayIcon.AddIcon(Icon)
  9506. else if Bitmap <> nil then
  9507. ImgLstForFlashTrayIcon.Add(Bitmap, nil);
  9508. finally
  9509. try
  9510. FreeAndNil(Bitmap);
  9511. FreeAndNil(Icon);
  9512. except
  9513. end;
  9514. end;
  9515. ImgLstForFlashTrayIcon.GetIcon(FFlashTrayIconIndex, TrayIcon.Icon);
  9516. TrayIcon.SetDefaultIcon;
  9517. if FFlashTrayIconIndex <> 0 then
  9518. FFlashTrayIconIndex := 0
  9519. else
  9520. FFlashTrayIconIndex := 1;
  9521. end;
  9522. //------------------------------------------------------------------------------
  9523. procedure TMainForm.TimerForLoginingTimer(Sender: TObject);
  9524. begin
  9525. ImgLstForLogining.GetIcon(FFlashTrayIconIndexAtLogining, TrayIcon.Icon);
  9526. TrayIcon.SetDefaultIcon;
  9527. Inc(FFlashTrayIconIndexAtLogining);
  9528. if FFlashTrayIconIndexAtLogining >= ImgLstForLogining.Count then
  9529. FFlashTrayIconIndexAtLogining := 0;
  9530. // TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  9531. // TrayIcon.SetDefaultIcon;
  9532. end;
  9533. procedure TMainForm.TimerForreconnectgroupTimer(Sender: TObject);
  9534. begin
  9535. if (realICQClient.Logined and realICQClient.Connected) then
  9536. begin
  9537. { TODO -olqq -c : 重连的时候,做下异常处理 2014/12/12 15:36:23 }
  9538. try
  9539. TTeamsAdapter.Start(RealICQClient.LoginName);
  9540. { TODO -olqq -c : 在procedure TGroup.OnOpen中有重复 2014/12/12 15:41:02 }
  9541. //WebSocketTeamSubscribe;
  9542. except
  9543. on E: Exception do
  9544. Log(E.Message, 'TMainForm.TimerForreconnectgroupTimer');
  9545. end;
  9546. end;
  9547. end;
  9548. //------------------------------------------------------------------------------
  9549. procedure TMainForm.StopFlashTeam(ATeamID: string);
  9550. var
  9551. ItemIndex: Integer;
  9552. ListItem: TRealICQContacterListItem;
  9553. begin
  9554. ItemIndex := FLVTeams.Items.IndexOf(ATeamID);
  9555. if ItemIndex >= 0 then
  9556. begin
  9557. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9558. ListItem.StopFlash;
  9559. end;
  9560. end;
  9561. procedure TMainForm.StopHeadImageFlash(AID: string);
  9562. var
  9563. ItemIndex: Integer;
  9564. ListItem: TRealICQContacterListItem;
  9565. begin
  9566. ItemIndex := FLVTeams.Items.IndexOf(AID);
  9567. if ItemIndex >= 0 then
  9568. begin
  9569. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9570. ListItem.StopFlash();
  9571. end;
  9572. end;
  9573. procedure TMainForm.SysMsgClick(Sender: TObject);
  9574. begin
  9575. RealICQClient.SendGetMoreServerList;
  9576. end;
  9577. procedure TMainForm.SysMsgIconClick(Sender: TObject);
  9578. begin
  9579. RealICQClient.SendGetMoreServerList;
  9580. end;
  9581. //------------------------------------------------------------------------------
  9582. procedure TMainForm.StopFlash(ALoginName: string);
  9583. var
  9584. ItemIndex: Integer;
  9585. RealICQContacterListView: TRealICQContacterListView;
  9586. RealICQContacterListItem: TRealICQContacterListItem;
  9587. RealICQFriendTreeView: TRealICQContacterTreeView;
  9588. RealICQContacterTreeView: TRealICQContacterTreeView;
  9589. Employee: TRealICQEmployee;
  9590. Friend: TRealICQEmployee;
  9591. begin
  9592. ItemIndex := FSearchListView.Items.IndexOf(ALoginName);
  9593. if ItemIndex >= 0 then
  9594. begin
  9595. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9596. RealICQContacterListItem.StopFlash;
  9597. end;
  9598. if (RealICQClient.WorkingMode = wmCorporation) or (FShowTree and (TFriendsService.GetService.IsFriend(ALoginName)) and (TWorkmatesService.GetService.IsWorkmate(ALoginName))) then
  9599. begin
  9600. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  9601. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9602. if RealICQContacterTreeView <> nil then
  9603. begin
  9604. Employee := RealICQContacterTreeView.GetEmployee(ALoginName);
  9605. if Employee <> nil then
  9606. Employee.StopFlash
  9607. else
  9608. begin
  9609. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9610. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9611. if RealICQFriendTreeView <> nil then
  9612. begin
  9613. Friend := RealICQFriendTreeView.GetEmployee(ALoginName);
  9614. if Friend <> nil then
  9615. Friend.StopFlash;
  9616. end;
  9617. end;
  9618. end;
  9619. end
  9620. else
  9621. begin
  9622. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  9623. if RealICQContacterListView <> nil then
  9624. begin
  9625. ItemIndex := RealICQContacterListView.Items.IndexOf(ALoginName);
  9626. if ItemIndex >= 0 then
  9627. begin
  9628. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9629. RealICQContacterListItem.StopFlash;
  9630. end;
  9631. end;
  9632. end;
  9633. end;
  9634. procedure TMainForm.WMHotKeyHandle(var Msg: TWMHotKey);
  9635. var
  9636. iLoop: Integer;
  9637. AForm: TTalkingForm;
  9638. begin
  9639. msg.Result := 1; //该消息已经处理
  9640. if msg.HotKey = HotKeyID_ReadMessage then
  9641. begin
  9642. TrayIconDblClick(TrayIcon);
  9643. end;
  9644. if msg.HotKey = HotKeyID_CopyScreen then
  9645. begin
  9646. for iLoop := 0 to TalkingForms.Count - 1 do
  9647. begin
  9648. AForm := TalkingForms[iLoop];
  9649. if AForm.Active then
  9650. begin
  9651. ShowCopyScreenForm(AForm);
  9652. Exit;
  9653. end;
  9654. end;
  9655. ShowCopyScreenForm(nil);
  9656. end;
  9657. end;
  9658. //------------------------------------------------------------------------------
  9659. procedure TMainForm.ShowRealICQMessage(RealICQMessage: TRealICQMessage; ShowSendFailed: Boolean; ARealICQClient: TRealICQClient);
  9660. var
  9661. LoginName: string;
  9662. iIndex, ItemIndex: Integer;
  9663. TalkingForm: TTalkingForm;
  9664. MessageList: TList;
  9665. NotReadMessage: TNotReadMessage;
  9666. RealICQContacterListView: TRealICQContacterListView;
  9667. RealICQContacterListItem: TRealICQContacterListItem;
  9668. RealICQContacterTreeView: TRealICQContacterTreeView;
  9669. Employee: TRealICQEmployee;
  9670. RealICQFriendTreeView: TRealICQContacterTreeView;
  9671. Friend: TRealICQEmployee;
  9672. NeedAddToNotReadMessages: Boolean;
  9673. begin
  9674. try
  9675. RealICQMessage.MessageStr := TTextMessageService.GetService.ContentFilter(RealICQMessage);
  9676. FDBHistory.SaveMessage('-1', RealICQMessage.Sender, RealICQMessage.Receiver, RealICQMessage.SendDateTime, RealICQMessage.FontStr, RealICQMessage.MessageStr, RealICQMessage.IsEncryMessage);
  9677. if RealICQMessage.IsEncryMessage then
  9678. RealICQMessage.ID := FDBHistory.GetMaxMessageId;
  9679. finally
  9680. if AnsiSameText(RealICQMessage.Sender, ARealICQClient.LoginName) then
  9681. LoginName := RealICQMessage.Receiver
  9682. else
  9683. LoginName := RealICQMessage.Sender;
  9684. TalkingForm := GetTalkingForm(LoginName, ARealICQClient);
  9685. if TalkingForm = nil then
  9686. NeedAddToNotReadMessages := True
  9687. else
  9688. NeedAddToNotReadMessages := not TalkingForm.CanWriteMessage;
  9689. if NeedAddToNotReadMessages then
  9690. begin
  9691. NotReadMessage := TNotReadMessage.Create;
  9692. NotReadMessage.FRealICQMessage := RealICQMessage;
  9693. NotReadMessage.FShowSendFailed := ShowSendFailed;
  9694. NotReadMessage.FRealICQClient := ARealICQClient;
  9695. iIndex := FNotReadMessages.IndexOf(LoginName);
  9696. if iIndex >= 0 then
  9697. begin
  9698. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  9699. MessageList.Add(NotReadMessage);
  9700. end
  9701. else
  9702. begin
  9703. if MessageBoxForm = nil then
  9704. begin
  9705. {$region '跳动头像'}
  9706. ItemIndex := FSearchListView.Items.IndexOf(LoginName);
  9707. if ItemIndex >= 0 then
  9708. begin
  9709. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9710. if FlashImageOnGetMessage then
  9711. RealICQContacterListItem.Flash(fsJump);
  9712. end;
  9713. if (RealICQClient.WorkingMode = wmCorporation) or (FShowTree and TUsersService.GetUsersService.IsWorkmateOrFriend(LoginName)) then
  9714. begin
  9715. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  9716. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9717. if RealICQContacterTreeView <> nil then
  9718. begin
  9719. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  9720. if Employee <> nil then
  9721. begin
  9722. if FlashImageOnGetMessage then
  9723. Employee.Flash(fsJump);
  9724. end
  9725. else
  9726. begin
  9727. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9728. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9729. if RealICQFriendTreeView <> nil then
  9730. begin
  9731. Friend := RealICQFriendTreeView.GetEmployee(LoginName);
  9732. if Friend <> nil then
  9733. if FlashImageOnGetMessage then
  9734. Friend.Flash(fsJump)
  9735. end;
  9736. end;
  9737. end;
  9738. end
  9739. else
  9740. begin
  9741. RealICQContacterListView := GetListViewByLoginName(LoginName);
  9742. if RealICQContacterListView <> nil then
  9743. begin
  9744. ItemIndex := RealICQContacterListView.Items.IndexOf(LoginName);
  9745. if ItemIndex >= 0 then
  9746. begin
  9747. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9748. if FlashImageOnGetMessage then
  9749. RealICQContacterListItem.Flash(fsJump);
  9750. end;
  9751. end; // if RealICQContacterListView <> nil ...
  9752. end;
  9753. {$endregion}
  9754. end;
  9755. MessageList := TList.Create;
  9756. MessageList.Add(NotReadMessage);
  9757. FNotReadMessages.AddObject(LoginName, MessageList);
  9758. end;
  9759. if MessageBoxForm <> nil then
  9760. begin
  9761. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  9762. FlashWindow(MessageBoxForm.Handle, True);
  9763. MessageBoxForm.ShowMessage(RealICQMessage.Sender, MTUser);
  9764. end
  9765. else if (not TimerForFlashTrayIcon.Enabled) then
  9766. TimerForFlashTrayIcon.Enabled := True;
  9767. if PlaySoundOnGetMessage then
  9768. PlayEventSound(FMessageEventSound);
  9769. NotReadMessageBoxForm.ShowNotReadMessage;
  9770. NotReadMessageBoxForm.Height := 0;
  9771. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  9772. end
  9773. else
  9774. begin
  9775. if (GetForegroundWindow <> TalkingForm.Handle) then
  9776. begin
  9777. FlashWindow(TalkingForm.Handle, True);
  9778. if PlaySoundOnGetMessage then
  9779. PlayEventSound(FMessageEventSound);
  9780. end;
  9781. TalkingForm.ShowMessage(RealICQMessage, ShowSendFailed);
  9782. end;
  9783. end;
  9784. end;
  9785. //------------------------------------------------------------------------------
  9786. procedure TMainForm.RealICQClientSendedSendFileRequest(Sender, FileTransmitter: TObject);
  9787. var
  9788. PtoPFileTransmitter: TPtoPFileTransmitter;
  9789. TalkingForm: TTalkingForm;
  9790. ALoginName: string;
  9791. RealICQUser: TRealICQUser;
  9792. ItemIndex: Integer;
  9793. RealICQContacterListItem: TRealICQContacterListItem;
  9794. begin
  9795. PtoPFileTransmitter := FileTransmitter as TPtoPFileTransmitter;
  9796. if PtoPFileTransmitter.Objective = foFace then
  9797. begin
  9798. TalkingForm := GetTalkingForm(PtoPFileTransmitter.LoginName, Sender as TRealICQClient);
  9799. if TalkingForm = nil then
  9800. Exit;
  9801. end
  9802. else
  9803. begin
  9804. TalkingForm := OpenTalkingForm(PtoPFileTransmitter.LoginName, True, Sender as TRealICQClient);
  9805. end;
  9806. if TalkingForm.CanWriteMessage then
  9807. TalkingForm.ShowSendedSendFileRequest(PtoPFileTransmitter);
  9808. {$region '更新“最近联系人列表”中的数据'}
  9809. if Sender = RealICQClient then
  9810. begin
  9811. ALoginName := PtoPFileTransmitter.LoginName;
  9812. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  9813. if RealICQUser <> nil then
  9814. begin
  9815. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  9816. if ItemIndex = -1 then
  9817. ItemIndex := FLVLatests.Items.Add(ALoginName);
  9818. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9819. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  9820. RealICQContacterListItem.MoveToTop;
  9821. end;
  9822. end;
  9823. {$endregion}
  9824. end;
  9825. //------------------------------------------------------------------------------
  9826. procedure TMainForm.RealICQClientSendedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  9827. begin
  9828. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  9829. end;
  9830. procedure TMainForm.RealICQClientCancelControlRemoteControlTransmite(Sender: TObject; ALoginName: string);
  9831. var
  9832. TalkingForm: TTalkingForm;
  9833. begin
  9834. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9835. if TalkingForm = nil then
  9836. Exit;
  9837. if TalkingForm.CanWriteMessage then
  9838. TalkingForm.ShowCancelControlRemoteControlTransmite;
  9839. end;
  9840. procedure TMainForm.RealICQClientCanceledSendFolder(Sender: TObject; AID: Cardinal; ALoginName: string);
  9841. var
  9842. ReceiveFolderRequestForm: TReceiveFolderRequestForm;
  9843. iLoop: Integer;
  9844. begin
  9845. for iLoop := 0 to ReceiveFolderForms.Count - 1 do
  9846. begin
  9847. ReceiveFolderRequestForm := TReceiveFolderRequestForm(ReceiveFolderForms[iLoop]);
  9848. if (ReceiveFolderRequestForm.FID = AID) and AnsiSameText(ALoginName, ReceiveFolderRequestForm.FLoginName) then
  9849. begin
  9850. ReceiveFolderRequestForm.CanceledSendFolder;
  9851. Break;
  9852. end;
  9853. end;
  9854. end;
  9855. procedure TMainForm.RealICQClientCancelSendFile(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  9856. var
  9857. TalkingForm: TTalkingForm;
  9858. iWaitTimes: Integer;
  9859. begin
  9860. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9861. if TalkingForm <> nil then
  9862. begin
  9863. if (GetForegroundWindow <> TalkingForm.Handle) then
  9864. begin
  9865. FlashWindow(TalkingForm.Handle, True);
  9866. if PlaySoundOnGetMessage then
  9867. PlayEventSound(FMessageEventSound);
  9868. end;
  9869. iWaitTimes := 0;
  9870. while not TalkingForm.CanWriteMessage do
  9871. begin
  9872. Application.ProcessMessages;
  9873. Inc(iWaitTimes);
  9874. if iWaitTimes > 1000 then
  9875. break;
  9876. Sleep(10);
  9877. end;
  9878. TalkingForm.ShowCancelSendFile(AOppositeID);
  9879. end;
  9880. end;
  9881. procedure TMainForm.RealICQClientChangePasswordResult(Sender: TObject; APassChanged: Boolean; ANewPassword: string);
  9882. begin
  9883. end;
  9884. //------------------------------------------------------------------------------
  9885. procedure TMainForm.RealICQClientGettedSendFileRequest(Sender: TObject; SendFileRequestInfo: TSendFileRequestInfo);
  9886. var
  9887. AShowActive: Boolean;
  9888. TalkingForm: TTalkingForm;
  9889. iWaitTimes: Integer;
  9890. ALoginName: string;
  9891. RealICQUser: TRealICQUser;
  9892. ItemIndex: Integer;
  9893. RealICQContacterListItem: TRealICQContacterListItem;
  9894. begin
  9895. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  9896. TalkingForm := GetTalkingForm(SendFileRequestInfo.LoginName, Sender as TRealICQClient);
  9897. if TalkingForm = nil then
  9898. begin
  9899. TalkingForm := OpenTalkingForm(SendFileRequestInfo.LoginName, not AShowActive, Sender as TRealICQClient);
  9900. end;
  9901. iWaitTimes := 0;
  9902. while not TalkingForm.CanWriteMessage do
  9903. begin
  9904. Application.ProcessMessages;
  9905. Inc(iWaitTimes);
  9906. if iWaitTimes > 1000 then
  9907. break;
  9908. Sleep(10);
  9909. end;
  9910. if (GetForegroundWindow <> TalkingForm.Handle) and (SendFileRequestInfo.Objective = foFile) then
  9911. begin
  9912. FlashWindow(TalkingForm.Handle, True);
  9913. if PlaySoundOnGetMessage then
  9914. PlayEventSound(FMessageEventSound);
  9915. end;
  9916. TalkingForm.ShowGettedSendFileRequest(SendFileRequestInfo);
  9917. {$region '更新“最近联系人列表”中的数据'}
  9918. if Sender = RealICQClient then
  9919. begin
  9920. ALoginName := SendFileRequestInfo.LoginName;
  9921. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  9922. if RealICQUser <> nil then
  9923. begin
  9924. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  9925. if ItemIndex = -1 then
  9926. ItemIndex := FLVLatests.Items.Add(ALoginName);
  9927. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9928. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  9929. RealICQContacterListItem.MoveToTop;
  9930. end;
  9931. end;
  9932. {$endregion}
  9933. end;
  9934. procedure TMainForm.RealICQClientGettedSendFolderRequest(Sender: TObject; AID, ACount: Cardinal; ALoginName: string; AFilesStream: TStream);
  9935. var
  9936. ReceiveFolderRequestForm: TReceiveFolderRequestForm;
  9937. begin
  9938. ReceiveFolderRequestForm := TReceiveFolderRequestForm.Create(Self);
  9939. ReceiveFolderRequestForm.FCount := ACount;
  9940. ReceiveFolderRequestForm.FID := AID;
  9941. ReceiveFolderRequestForm.FLoginName := ALoginName;
  9942. ReceiveFolderRequestForm.FFilesStream := AFilesStream;
  9943. ReceiveFolderRequestForm.Show;
  9944. ReceiveFolderRequestForm.BringToFront;
  9945. end;
  9946. procedure TMainForm.RealICQClientGettedSendOfflineFileRequest(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  9947. var
  9948. TalkingForm: TTalkingForm;
  9949. iWaitTimes: Integer;
  9950. begin
  9951. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9952. if TalkingForm <> nil then
  9953. begin
  9954. if (GetForegroundWindow <> TalkingForm.Handle) then
  9955. begin
  9956. FlashWindow(TalkingForm.Handle, True);
  9957. if PlaySoundOnGetMessage then
  9958. PlayEventSound(FMessageEventSound);
  9959. end;
  9960. iWaitTimes := 0;
  9961. while not TalkingForm.CanWriteMessage do
  9962. begin
  9963. Application.ProcessMessages;
  9964. Inc(iWaitTimes);
  9965. if iWaitTimes > 1000 then
  9966. break;
  9967. Sleep(10);
  9968. end;
  9969. TalkingForm.ShowSendOfflineFileRequest(AOppositeID);
  9970. end;
  9971. end;
  9972. //------------------------------------------------------------------------------
  9973. procedure TMainForm.RealICQClientSendMessageFailed(Sender: TObject; RealICQMessage: TRealICQMessage);
  9974. begin
  9975. ShowRealICQMessage(RealICQMessage, True, Sender as TRealICQClient);
  9976. end;
  9977. //------------------------------------------------------------------------------
  9978. procedure TMainForm.RealICQClientSendTeamMessageFailed(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  9979. begin
  9980. ShowRealICQTeamMessage(RealICQTeamMessage, True);
  9981. end;
  9982. //------------------------------------------------------------------------------
  9983. procedure TMainForm.RealICQClientShakeWindow(Sender: TObject; ALoginName: string);
  9984. var
  9985. TalkingForm: TTalkingForm;
  9986. iWaitTimes: Integer;
  9987. begin
  9988. if not MainForm.ShowShakeWindow then
  9989. Exit;
  9990. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9991. if TalkingForm = nil then
  9992. begin
  9993. TalkingForm := OpenTalkingForm(ALoginName, True, Sender as TRealICQClient);
  9994. end;
  9995. iWaitTimes := 0;
  9996. while not TalkingForm.CanWriteMessage do
  9997. begin
  9998. Application.ProcessMessages;
  9999. Inc(iWaitTimes);
  10000. if iWaitTimes > 1000 then
  10001. break;
  10002. Sleep(10);
  10003. end;
  10004. if GetTickCount - TalkingForm.LastRecvShakeWindowTicket < 150000 then
  10005. Exit;
  10006. ForceForeGroundWindow(TalkingForm.Handle);
  10007. TalkingForm.ShowShakeWindow(False);
  10008. TalkingForm.LastRecvShakeWindowTicket := GetTickCount;
  10009. end;
  10010. //------------------------------------------------------------------------------
  10011. procedure TMainForm.RealICQClientSMSResult(Sender: TObject; AMessageID: Cardinal; AResult: Integer);
  10012. var
  10013. iIndex: Integer;
  10014. SMSMessage: TSMSMessage;
  10015. begin
  10016. iIndex := SMSMessages.IndexOf(IntToStr(AMessageID));
  10017. if iIndex >= 0 then
  10018. begin
  10019. SMSMessage := SMSMessages.Objects[iIndex] as TSMSMessage;
  10020. SMSMessage.Sended := AResult = 0;
  10021. SMSMessage.SMSForm.ShowSMSMessageResult(AMessageID, AResult);
  10022. end;
  10023. end;
  10024. //------------------------------------------------------------------------------
  10025. procedure TMainForm.RealICQClientTeamInfoReady(Sender: TObject; ARealICQTeam: TRealICQTeam);
  10026. var
  10027. iLoop, iIndex: Integer;
  10028. ListItem: TRealICQContacterListItem;
  10029. MemberList: TStringList;
  10030. begin
  10031. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  10032. if iIndex = -1 then
  10033. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  10034. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  10035. if ARealICQTeam.IsTempTeam then
  10036. ListItem.Watchword := ''
  10037. else
  10038. ListItem.Watchword := ARealICQTeam.TeamIntro;
  10039. ListItem.LoginState := stLeave;
  10040. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  10041. try
  10042. for iLoop := MemberList.Count - 1 downto 0 do
  10043. begin
  10044. if Length(Trim(MemberList[iLoop])) = 0 then
  10045. MemberList.Delete(iLoop);
  10046. end;
  10047. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  10048. finally
  10049. MemberList.Free;
  10050. end;
  10051. {try
  10052. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  10053. except
  10054. ListItem.HeadImagePicture.Graphic := nil;
  10055. end; }
  10056. if ARealICQTeam.IsTempTeam then
  10057. ListItem.DisplayName := '多人对话'
  10058. else
  10059. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  10060. ListItem.Data := ARealICQTeam;
  10061. ListItem.ReDrawItem;
  10062. ShowNavBarNumeric;
  10063. // UpdateTeamOptionsForm(ARealICQTeam);
  10064. UpdateTeamTalkingForm(ARealICQTeam);
  10065. end;
  10066. //------------------------------------------------------------------------------
  10067. procedure TMainForm.RealICQClientReceivedAdversement(Sender: TObject);
  10068. begin
  10069. if (not RealICQClient.MainFormAdversement.Visible) then
  10070. begin
  10071. if pnlAdvertisement.Height > 0 then
  10072. pnlAdvertisement.Height := 0;
  10073. end
  10074. else
  10075. begin
  10076. WebBrowserForAdvertisement.OnBeforeNavigate2 := nil;
  10077. pnlForHideWebBrowser.Visible := True;
  10078. pnlForHideWebBrowser.BringToFront;
  10079. WebBrowserForAdvertisement.OnDocumentComplete := WebBrowserForAdvertisementDocumentComplete;
  10080. WebBrowserForAdvertisement.Navigate(AnsiReplaceText(AnsiReplaceText(RealICQClient.MainFormAdversement.URL, '[%LoginName%]', RealICQClient.LoginName), '[%BranchID%]', RealICQClient.Me.BranchID));
  10081. pnlWebSearch.Top := pnlAdvertisement.Top + pnlAdvertisement.Height + 1;
  10082. end;
  10083. UpdateTalkingFormAdversement;
  10084. end;
  10085. //------------------------------------------------------------------------------
  10086. procedure TMainForm.RealICQClientReceivedCustomMessage(Sender: TObject; AContent: string);
  10087. var
  10088. Contents: TStringList;
  10089. LoginName: string;
  10090. SystemMessage: TRealICQSystemMessage;
  10091. jo: ISuperObject;
  10092. reg: TPerlRegEx;
  10093. begin
  10094. if AnsiSameText('ReGetCountByReceiver', AContent) then
  10095. begin
  10096. RealICQClient.SendGetNewInformation(0);
  10097. Exit;
  10098. end;
  10099. if AnsiSameText('ReGetAnnouncement', AContent) then
  10100. begin
  10101. RealICQClient.SendGetNewInformation(1);
  10102. Exit;
  10103. end;
  10104. AContent := AnsiReplaceStr(AContent, Chr(13), '');
  10105. Contents := RealICQUtils.SplitString(AContent, Chr(10));
  10106. try
  10107. //TODO: lqq 新消息通知接口
  10108. if (Contents.Count > 1) and (CompareText(Contents[0], 'SendNotify') = 0) then
  10109. begin
  10110. jo := SO(Contents[1]);
  10111. SystemMessage := TRealICQSystemMessage.Create;
  10112. SystemMessage.MessageID := GetTickCount;
  10113. Sleep(100);
  10114. SystemMessage.MessageType := mtBroadcast;
  10115. SystemMessage.AutoOpenWindow := True;
  10116. SystemMessage.Position := mpRightBottom;
  10117. SystemMessage.Left := 0;
  10118. SystemMessage.Top := 0;
  10119. SystemMessage.Width := 258;
  10120. SystemMessage.Height := 168;
  10121. SystemMessage.Delay := 0;
  10122. SystemMessage.MaxShowTimes := 0;
  10123. SystemMessage.Title := jo.S['title'];
  10124. SystemMessage.URL := jo.S['url'];
  10125. if jo.S['appkey'] = '' then
  10126. SystemMessage.Content := Format('<a target="_blank" href="%s" style="text-decoration: none;line-height:18px;">%s</a>', [SystemMessage.URL, jo.S['content']])
  10127. else
  10128. SystemMessage.Content := Format('<a target="_blank" href="%s" style="text-decoration: none;line-height:18px;">%s</a>', ['SSO||' + jo.S['appkey'] + '||' + SystemMessage.URL, jo.S['content']]);
  10129. SystemMessage.AutoCloseTime := 0;
  10130. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10131. Exit;
  10132. end;
  10133. if Contents.Count >= 3 then
  10134. begin
  10135. { if AnsiSameText(Contents.Strings[0], 'CONFIRMDLG') then
  10136. begin
  10137. SystemMessage := TRealICQSystemMessage.Create;
  10138. SystemMessage.MessageID :=StrToInt(Contents.Strings[5]);// GetTickCount;
  10139. Sleep(100);
  10140. SystemMessage.MessageType := mtConfirmMsg;
  10141. SystemMessage.AutoOpenWindow := True;
  10142. SystemMessage.Position := mpCenter;
  10143. SystemMessage.Width := 278;
  10144. SystemMessage.Height := 178;
  10145. SystemMessage.Delay := 0;
  10146. SystemMessage.MaxShowTimes := 0;
  10147. SystemMessage.Content := Contents.Strings[2];
  10148. SystemMessage.Title := Contents.Strings[3];
  10149. SystemMessage.URL := Contents.Strings[4]+Chr(10)+Contents.Strings[6]+Chr(10)+Contents.Strings[7];
  10150. SystemMessage.AutoCloseTime :=120;
  10151. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10152. end; }
  10153. if AnsiSameText(Contents.Strings[0], 'RJOA') or AnsiSameText(Contents.Strings[0], 'RDOA') or AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10154. begin
  10155. SystemMessage := TRealICQSystemMessage.Create;
  10156. SystemMessage.MessageID := GetTickCount;
  10157. Sleep(100);
  10158. SystemMessage.MessageType := mtBroadcast;
  10159. if AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10160. SystemMessage.MessageType := mtAdvertisement;
  10161. SystemMessage.AutoOpenWindow := True;
  10162. SystemMessage.Position := mpRightBottom;
  10163. SystemMessage.Left := 0;
  10164. SystemMessage.Top := 0;
  10165. SystemMessage.Width := 258;
  10166. SystemMessage.Height := 168;
  10167. SystemMessage.Delay := 0;
  10168. SystemMessage.MaxShowTimes := 0;
  10169. SystemMessage.Title := '系统提醒';
  10170. reg := TPerlRegEx.Create;
  10171. try
  10172. reg.Subject := Contents.Strings[2];
  10173. reg.RegEx := '<[^>]+>';
  10174. reg.Replacement := '';
  10175. reg.ReplaceAll;
  10176. SystemMessage.Content := '<p style="line-height:18px; text-indent:2em;">' + reg.Subject + '</p>';
  10177. finally
  10178. reg.Free;
  10179. end;
  10180. SystemMessage.URL := '';
  10181. SystemMessage.AutoCloseTime := 0;
  10182. if AnsiSameText(Contents.Strings[0], 'RDOA') or AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10183. begin
  10184. SystemMessage.URL := Contents.Strings[4];
  10185. if Contents.Strings[6] = '1' then
  10186. begin
  10187. LoginName := RealICQClient.LoginName;
  10188. if Pos('-', RealICQClient.LoginName) > 0 then
  10189. LoginName := Copy(RealICQClient.LoginName, Pos('-', RealICQClient.LoginName) + 1, Length(RealICQClient.LoginName));
  10190. SystemMessage.URL := SystemMessage.URL + Contents.Strings[5];
  10191. end;
  10192. SystemMessage.Title := Contents.Strings[7];
  10193. end
  10194. else
  10195. begin
  10196. if Contents.Count >= 7 then
  10197. SystemMessage.URL := Contents.Strings[3];
  10198. try
  10199. if Contents.Count >= 5 then
  10200. SystemMessage.Width := StrToInt(Contents.Strings[4]);
  10201. if Contents.Count >= 6 then
  10202. SystemMessage.Height := StrToInt(Contents.Strings[5]);
  10203. if Contents.Count >= 7 then
  10204. begin
  10205. if Contents.Strings[6] = '1' then
  10206. begin
  10207. TimerForShowSystemNotices.Enabled := False;
  10208. RealICQClient.SendGetNewInformation(1);
  10209. end
  10210. else
  10211. begin
  10212. RealICQClient.SendGetNewInformation(0);
  10213. end;
  10214. end
  10215. else
  10216. begin
  10217. RealICQClient.SendGetNewInformation(0);
  10218. end;
  10219. if Contents.Count >= 8 then
  10220. SystemMessage.Title := Contents.Strings[7];
  10221. except
  10222. end;
  10223. end;
  10224. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10225. end;
  10226. if AnsiSameText(Contents.Strings[0], 'LXUMC') then
  10227. begin
  10228. // if not MainForm.ShowFileTransCompleted then Exit;
  10229. SystemMessage := TRealICQSystemMessage.Create;
  10230. SystemMessage.MessageID := GetTickCount;
  10231. SystemMessage.MessageType := mtBroadcast;
  10232. SystemMessage.AutoOpenWindow := True;
  10233. SystemMessage.Position := mpRightBottom;
  10234. SystemMessage.Left := 0;
  10235. SystemMessage.Top := 0;
  10236. SystemMessage.Width := 258;
  10237. SystemMessage.Height := 148;
  10238. SystemMessage.Delay := 0;
  10239. SystemMessage.MaxShowTimes := 0;
  10240. SystemMessage.Title := '系统提醒';
  10241. SystemMessage.Content := Contents.Strings[2];
  10242. SystemMessage.URL := '';
  10243. SystemMessage.AutoCloseTime := 0;
  10244. if Contents.Count > 3 then
  10245. SystemMessage.Title := Contents.Strings[3];
  10246. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10247. end;
  10248. if AnsiSameText(Contents.Strings[0], 'EMAIL') then
  10249. begin
  10250. if AnsiSameText(Contents.Strings[1], '0') then
  10251. begin
  10252. spbEmail.Caption := '(' + Contents.Strings[2] + ')';
  10253. end
  10254. else if AnsiSameText(Contents.Strings[1], '1') then
  10255. begin
  10256. spbEmail.Caption := '(' + IntToStr(StrToInt(ReplaceStr(ReplaceStr(spbEmail.Caption, '(', ''), ')', '')) + 1) + ')';
  10257. SystemMessage := TRealICQSystemMessage.Create;
  10258. SystemMessage.MessageID := GetTickCount;
  10259. SystemMessage.MessageType := mtBroadcast;
  10260. SystemMessage.AutoOpenWindow := True;
  10261. SystemMessage.Position := mpRightBottom;
  10262. SystemMessage.Left := 0;
  10263. SystemMessage.Top := 0;
  10264. SystemMessage.Width := 258;
  10265. SystemMessage.Height := 148;
  10266. SystemMessage.Delay := 0;
  10267. SystemMessage.MaxShowTimes := 0;
  10268. SystemMessage.Title := '系统提醒';
  10269. if AnsiSameText(Copy(Contents.Strings[3], 1, 7), 'http://') then
  10270. begin
  10271. SystemMessage.Content := '您从 <a herf="' + Contents.Strings[3] + '">' + Contents.Strings[2] + '</a> 处收到一封新邮件!';
  10272. SystemMessage.URL := Contents.Strings[3];
  10273. end
  10274. else
  10275. begin
  10276. SystemMessage.Content := '您从 ' + Contents.Strings[3] + ' 处收到一封新邮件!';
  10277. SystemMessage.URL := '';
  10278. end;
  10279. SystemMessage.AutoCloseTime := 15;
  10280. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10281. end;
  10282. end;
  10283. end;
  10284. finally
  10285. FreeAndNil(Contents);
  10286. end;
  10287. end;
  10288. //------------------------------------------------------------------------------
  10289. procedure TMainForm.RealICQClientReceivedMessage(Sender: TObject; RealICQMessage: TRealICQMessage);
  10290. var
  10291. ItemIndex: Integer;
  10292. RealICQContacterListItem: TRealICQContacterListItem;
  10293. RealICQUser: TRealICQUser;
  10294. ALoginName: string;
  10295. begin
  10296. ShowRealICQMessage(RealICQMessage, False, Sender as TRealICQClient);
  10297. {$region '更新“最近联系人列表”中的数据'}
  10298. if Sender = RealICQClient then
  10299. begin
  10300. if not AnsiSameText(RealICQMessage.Sender, RealICQClient.LoginName) then
  10301. ALoginName := RealICQMessage.Sender
  10302. else
  10303. ALoginName := RealICQMessage.Receiver;
  10304. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10305. if RealICQUser <> nil then
  10306. begin
  10307. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10308. if ItemIndex = -1 then
  10309. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10310. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10311. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10312. RealICQContacterListItem.MoveToTop;
  10313. end;
  10314. end;
  10315. {$endregion}
  10316. end;
  10317. //------------------------------------------------------------------------------
  10318. procedure TMainForm.RealICQClientReceivedOfflineAutoResponseSet(Sender: TObject; AEnabled: Boolean; AText: string);
  10319. begin
  10320. actOfflieAutoResponse.Checked := AEnabled;
  10321. if OptionsForm <> nil then
  10322. begin
  10323. OptionsForm.GetSets;
  10324. end;
  10325. end;
  10326. //------------------------------------------------------------------------------
  10327. procedure TMainForm.RealICQClientReceivedOfflineFile(Sender: TObject; ASender, AFileName: string; AFileSize: Int64; ASendDateTime: TDateTime);
  10328. var
  10329. AShowActive: Boolean;
  10330. TalkingForm: TTalkingForm;
  10331. iWaitTimes: Integer;
  10332. ALoginName: string;
  10333. RealICQUser: TRealICQUser;
  10334. ItemIndex: Integer;
  10335. RealICQContacterListItem: TRealICQContacterListItem;
  10336. begin
  10337. if AnsiSameText(ASender, RealICQClient.Me.LoginName) then
  10338. Exit;
  10339. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  10340. TalkingForm := GetTalkingForm(ASender, RealICQClient);
  10341. if TalkingForm = nil then
  10342. begin
  10343. TalkingForm := OpenTalkingForm(ASender, not AShowActive, RealICQClient);
  10344. end;
  10345. iWaitTimes := 0;
  10346. while not TalkingForm.CanWriteMessage do
  10347. begin
  10348. Application.ProcessMessages;
  10349. Inc(iWaitTimes);
  10350. if iWaitTimes > 1000 then
  10351. break;
  10352. Sleep(10);
  10353. end;
  10354. if (GetForegroundWindow <> TalkingForm.Handle) then
  10355. begin
  10356. FlashWindow(TalkingForm.Handle, True);
  10357. if PlaySoundOnGetMessage then
  10358. PlayEventSound(FMessageEventSound);
  10359. end;
  10360. TFileTransmitAdapter.Receive(TalkingForm, AFileName, 0, ASender, '', ASendDateTime, Self.RealICQClient, AFileSize);
  10361. {$region '更新“最近联系人列表”中的数据'}
  10362. if Sender = RealICQClient then
  10363. begin
  10364. ALoginName := ASender;
  10365. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10366. if RealICQUser <> nil then
  10367. begin
  10368. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10369. if ItemIndex = -1 then
  10370. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10371. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10372. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10373. RealICQContacterListItem.MoveToTop;
  10374. end;
  10375. end;
  10376. {$endregion}
  10377. end;
  10378. //------------------------------------------------------------------------------
  10379. procedure TMainForm.RealICQClientReceivedServerList(Sender: TObject; AServerList: string);
  10380. var
  10381. ServerList: TStringList;
  10382. iLoop, chrPos: Integer;
  10383. MenuItem: TMenuItem;
  10384. ServerInfo: TServerInfo;
  10385. config: TConditionConfig;
  10386. begin
  10387. config := TConditionConfig.GetConfig;
  10388. while ppServerList.Items.Count > 0 do
  10389. ppServerList.Items.Delete(0);
  10390. ServerList := SplitString(AServerList, Chr(10));
  10391. try
  10392. iLoop := 0;
  10393. while iLoop < ServerList.Count - 1 do
  10394. begin
  10395. ServerInfo := TServerInfo.Create;
  10396. ServerInfo.ServerId := ServerList[iLoop];
  10397. Inc(iLoop);
  10398. ServerInfo.ServerName := ServerList[iLoop];
  10399. Inc(iLoop);
  10400. if config.OtherServersDisable and not (UpperCase(ServerInfo.ServerId) = UpperCase(RealICQClient.ServerID)) then
  10401. begin
  10402. Continue;
  10403. end;
  10404. MenuItem := TMenuItem.Create(ppServerList);
  10405. MenuItem.AutoHotkeys := maManual;
  10406. MenuItem.AutoLineReduction := maManual;
  10407. MenuItem.Caption := '&' + ServerInfo.ServerName;
  10408. MenuItem.Hint := ServerInfo.ServerId;
  10409. MenuItem.OnClick := miChangeServerClick;
  10410. MenuItem.Tag := iLoop;
  10411. if UpperCase(ServerInfo.ServerId) = UpperCase(RealICQClient.ServerID) then
  10412. begin
  10413. edServerList.Text := ServerInfo.ServerName;
  10414. ImgLoadingMoreBranchs.Visible := True;
  10415. ScrollBoxMoreUser.Visible := False;
  10416. //RealICQClient.SendGetMoreBranch(ServerInfo.ServerId);
  10417. RealICQClient.SendGetBranchs(ServerInfo.ServerId, 0);
  10418. FCurrentServerID := ServerInfo.ServerId;
  10419. //Todo: 调用Online.exe
  10420. if FileExists(ExtractFilePath(Application.ExeName) + 'Online.exe') then
  10421. TCheckRunProcessThread.Create('Online', ExtractFilePath(Application.ExeName) + 'Online.exe')
  10422. else
  10423. Self.PostUpdateLog;
  10424. end;
  10425. FServerInfoList.AddObject(ServerInfo.ServerId, ServerInfo);
  10426. ppServerList.Items.Add(MenuItem);
  10427. end;
  10428. finally
  10429. FreeAndNil(ServerList);
  10430. end;
  10431. end;
  10432. //------------------------------------------------------------------------------
  10433. procedure TMainForm.ShowRealICQTeamMessage(RealICQTeamMessage: TRealICQTeamMessage; ShowSendFailed: Boolean);
  10434. var
  10435. nTeamID: string;
  10436. iIndex, ItemIndex: Integer;
  10437. MessageList: TList;
  10438. TalkingForm: TTalkingForm;
  10439. NotReadTeamMessage: TNotReadTeamMessage;
  10440. NeedAddToNotReadMessages: Boolean;
  10441. ListItem: TRealICQContacterListItem;
  10442. ASave: Boolean;
  10443. begin
  10444. try
  10445. ASave := AutoSaveMessage;
  10446. if Copy(RealICQTeamMessage.MessageStr, 1, 11) = '<TeamShare>' then
  10447. begin
  10448. if Copy(RealICQTeamMessage.MessageStr, Length(RealICQTeamMessage.MessageStr) - 11, 12) = '</TeamShare>' then
  10449. begin
  10450. ASave := False;
  10451. end;
  10452. end;
  10453. if ASave then
  10454. begin
  10455. FDBHistory.SaveMessage(RealICQTeamMessage.TeamID, RealICQTeamMessage.Sender, RealICQClient.LoginName, RealICQTeamMessage.SendDateTime, RealICQTeamMessage.FontStr, RealICQTeamMessage.MessageStr, RealICQTeamMessage.IsEncryMessage);
  10456. if RealICQTeamMessage.IsEncryMessage then
  10457. RealICQTeamMessage.ID := FDBHistory.GetMaxMessageId;
  10458. end;
  10459. except
  10460. end;
  10461. nTeamID := RealICQTeamMessage.TeamID;
  10462. TalkingForm := GetTeamTalkingForm(nTeamID);
  10463. if TalkingForm = nil then
  10464. NeedAddToNotReadMessages := True
  10465. else
  10466. NeedAddToNotReadMessages := not TalkingForm.CanWriteMessage;
  10467. if NeedAddToNotReadMessages then
  10468. begin
  10469. NotReadTeamMessage := TNotReadTeamMessage.Create;
  10470. NotReadTeamMessage.FRealICQTeamMessage := RealICQTeamMessage;
  10471. NotReadTeamMessage.FShowSendFailed := ShowSendFailed;
  10472. iIndex := FNotReadMessages.IndexOf(TeamMessageID + nTeamID);
  10473. if iIndex >= 0 then
  10474. begin
  10475. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  10476. MessageList.Add(NotReadTeamMessage);
  10477. end
  10478. else
  10479. begin
  10480. {$region '跳动头像'}
  10481. ItemIndex := FLVTeams.Items.IndexOf(nTeamID);
  10482. if ItemIndex >= 0 then
  10483. begin
  10484. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10485. if FlashImageOnGetMessage then
  10486. ListItem.Flash(fsJump);
  10487. end;
  10488. {$endregion}
  10489. MessageList := TList.Create;
  10490. MessageList.Add(NotReadTeamMessage);
  10491. FNotReadMessages.AddObject(TeamMessageID + nTeamID, MessageList);
  10492. TimerForFlashTrayIcon.Enabled := True;
  10493. if PlaySoundOnGetMessage then
  10494. PlayEventSound(FMessageEventSound);
  10495. end;
  10496. if MessageBoxForm <> nil then
  10497. begin
  10498. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  10499. FlashWindow(MessageBoxForm.Handle, True);
  10500. MessageBoxForm.ShowMessage(RealICQTeamMessage.Sender, MTTeam);
  10501. Exit;
  10502. end
  10503. else if (not TimerForFlashTrayIcon.Enabled) then
  10504. TimerForFlashTrayIcon.Enabled := True;
  10505. NotReadMessageBoxForm.ShowNotReadMessage;
  10506. NotReadMessageBoxForm.Height := 0;
  10507. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10508. end
  10509. else
  10510. begin
  10511. if (GetForegroundWindow <> TalkingForm.Handle) then
  10512. begin
  10513. FlashWindow(TalkingForm.Handle, True);
  10514. if PlaySoundOnGetMessage then
  10515. PlayEventSound(FMessageEventSound);
  10516. end;
  10517. TalkingForm.ShowTeamMessage(RealICQTeamMessage, ShowSendFailed);
  10518. end;
  10519. end;
  10520. procedure TMainForm.RealICQClientReceivedSMS(Sender: TObject; ASMSSender, ASMSContent: string; ASMSDateTime: TDateTime);
  10521. var
  10522. NotReadSMSMessage: TNotReadSMSMessage;
  10523. SMSForm: TSMSForm;
  10524. ASender: string;
  10525. iLoop: Integer;
  10526. ARealICQUser: TRealICQUser;
  10527. NeedAddToNotReadMessages: Boolean;
  10528. MessageList: TList;
  10529. iIndex: Integer;
  10530. AUsers: TStringList;
  10531. begin
  10532. ASender := '';
  10533. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  10534. try
  10535. for iLoop := 0 to AUsers.Count - 1 do
  10536. begin
  10537. ARealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  10538. if Length(Trim(ARealICQUser.Mobile)) < 11 then
  10539. continue;
  10540. if Pos(ARealICQUser.Mobile, ASMSSender) > 0 then
  10541. begin
  10542. ASender := ARealICQUser.LoginName;
  10543. Break;
  10544. end;
  10545. if Length(ARealICQUser.Mobile) < 10 then
  10546. begin
  10547. if AnsiSameStr('1060578' + ARealICQUser.Mobile, ASMSSender) then
  10548. begin
  10549. ASender := ARealICQUser.LoginName;
  10550. Break;
  10551. end;
  10552. end;
  10553. end;
  10554. // if ASender = '' then
  10555. // ASender := ASMSSender;
  10556. finally
  10557. FreeAndNil(AUsers);
  10558. end;
  10559. SMSForm := GetSMSForm(ASender);
  10560. NotReadSMSMessage := TNotReadSMSMessage.Create;
  10561. NotReadSMSMessage.FSMSSender := ASMSSender;
  10562. NotReadSMSMessage.FSMSContent := ASMSContent;
  10563. NotReadSMSMessage.FSMSDateTime := ASMSDateTime;
  10564. iIndex := FNotReadMessages.IndexOf(SMSMessageID + ASender);
  10565. if iIndex >= 0 then
  10566. begin
  10567. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  10568. MessageList.Add(NotReadSMSMessage);
  10569. end
  10570. else
  10571. begin
  10572. MessageList := TList.Create;
  10573. MessageList.Add(NotReadSMSMessage);
  10574. FNotReadMessages.AddObject(SMSMessageID + ASender, MessageList);
  10575. TimerForFlashTrayIcon.Enabled := True;
  10576. if PlaySoundOnGetMessage then
  10577. PlayEventSound(FMessageEventSound);
  10578. end;
  10579. if SMSForm = nil then
  10580. NeedAddToNotReadMessages := True
  10581. else
  10582. NeedAddToNotReadMessages := not SMSForm.CanWriteMessage;
  10583. if NeedAddToNotReadMessages then
  10584. begin
  10585. TimerForFlashTrayIcon.Enabled := True;
  10586. if PlaySoundOnGetMessage then
  10587. PlayEventSound(FMessageEventSound);
  10588. if MessageBoxForm <> nil then
  10589. begin
  10590. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  10591. FlashWindow(MessageBoxForm.Handle, True);
  10592. MessageBoxForm.ShowMessage(ASender, MTSMS);
  10593. Exit;
  10594. end
  10595. else if (not TimerForFlashTrayIcon.Enabled) then
  10596. TimerForFlashTrayIcon.Enabled := True;
  10597. NotReadMessageBoxForm.ShowNotReadMessage;
  10598. NotReadMessageBoxForm.Height := 0;
  10599. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10600. end
  10601. else
  10602. begin
  10603. if (GetForegroundWindow <> SMSForm.Handle) then
  10604. begin
  10605. FlashWindow(SMSForm.Handle, True);
  10606. if PlaySoundOnGetMessage then
  10607. PlayEventSound(FMessageEventSound);
  10608. end;
  10609. //显示收到的短消息
  10610. SMSForm.LoadNotReadSMSMessages;
  10611. end;
  10612. end;
  10613. //------------------------------------------------------------------------------
  10614. procedure TMainForm.RealICQClientReceivedSystemMessage(Sender: TObject; ASystemMessage: TRealICQSystemMessage);
  10615. begin
  10616. if (ASystemMessage.MaxShowTimes = 0) or ((GetSystemMessageCounter(ASystemMessage.MessageID) < ASystemMessage.MaxShowTimes) and (ASystemMessage.MaxShowTimes > 0)) then
  10617. begin
  10618. try
  10619. FDBHistory.SaveSystemMessage(ASystemMessage.MessageID, ASystemMessage.MessageType, ASystemMessage.Position, ASystemMessage.Left, ASystemMessage.Top, ASystemMessage.Width, ASystemMessage.Height, ASystemMessage.Title, ASystemMessage.Content, ASystemMessage.URL, ASystemMessage.AutoCloseTime);
  10620. except
  10621. end;
  10622. FSystemMessages.Insert(0, ASystemMessage);
  10623. if TimerForShowSystemMessage.Enabled = False then
  10624. TimerForShowSystemMessage.Enabled := True;
  10625. end;
  10626. end;
  10627. //------------------------------------------------------------------------------
  10628. procedure TMainForm.ShowSystemMessage(ASystemMessage: TRealICQSystemMessage);
  10629. begin
  10630. try
  10631. OpenSystemMessageForm(IntToStr(ASystemMessage.MessageID), ASystemMessage.MessageType, ASystemMessage.Position, ASystemMessage.Left, ASystemMessage.Top, ASystemMessage.Width, ASystemMessage.Height, ASystemMessage.Title, ASystemMessage.Content, ASystemMessage.URL, ASystemMessage.AutoCloseTime);
  10632. IncSystemMessageCounter(ASystemMessage.MessageID);
  10633. finally
  10634. FreeAndNil(ASystemMessage);
  10635. end;
  10636. end;
  10637. //------------------------------------------------------------------------------
  10638. procedure TMainForm.TimerForShowSystemMessageTimer(Sender: TObject);
  10639. var
  10640. iLoop: Integer;
  10641. ASystemMessage: TRealICQSystemMessage;
  10642. begin
  10643. if FSystemMessages.Count = 0 then
  10644. TimerForShowSystemMessage.Enabled := False
  10645. else
  10646. begin
  10647. for iLoop := FSystemMessages.Count - 1 downto 0 do
  10648. begin
  10649. ASystemMessage := FSystemMessages[iLoop];
  10650. ASystemMessage.Delay := ASystemMessage.Delay - 0.2;
  10651. if ASystemMessage.Delay <= 0 then
  10652. begin
  10653. FSystemMessages.Delete(iLoop);
  10654. if ASystemMessage.AutoOpenWindow then
  10655. begin
  10656. ShowSystemMessage(ASystemMessage);
  10657. end
  10658. else
  10659. begin
  10660. FNotReadMessages.AddObject(SystemMessageID + IntToStr(ASystemMessage.MessageID), ASystemMessage);
  10661. TimerForFlashTrayIcon.Enabled := True;
  10662. if PlaySoundOnGetSystemMessage then
  10663. PlayEventSound(FSystemMessageEventSound);
  10664. NotReadMessageBoxForm.ShowNotReadMessage;
  10665. NotReadMessageBoxForm.Height := 0;
  10666. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10667. end;
  10668. end;
  10669. end;
  10670. if (self.MessageBoxForm <> nil) then
  10671. MessageBoxForm.ShowSystemMessages(FSystemMessages);
  10672. end;
  10673. end;
  10674. //------------------------------------------------------------------------------
  10675. procedure TMainForm.RealICQClientReceivedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  10676. begin
  10677. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  10678. end;
  10679. procedure TMainForm.RealICQClientReceivedVideoImage(Sender: TObject; ALoginName: string; ABitmap: TBitmap);
  10680. begin
  10681. end;
  10682. //------------------------------------------------------------------------------
  10683. procedure TMainForm.UpdateFriendNode(Friend: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  10684. var
  10685. GIFImage: TGIFImage;
  10686. jo: IsuperObject;
  10687. ARemarkTel, ARemarkMobile, ARemark: string;
  10688. begin
  10689. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10690. if jo <> nil then
  10691. begin
  10692. ARemark := jo.S['Remark'];
  10693. ARemarkTel := jo.S['Phone'];
  10694. ARemarkMobile := jo.S['Mobile'];
  10695. end;
  10696. Friend.HasCamera := RealICQUser.InstalledCamera;
  10697. Friend.Watchword := RealICQUser.Watchword;
  10698. Friend.LeaveMessage := RealICQUser.LeaveMessage;
  10699. Friend.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10700. Friend.TelephoneHint := '';
  10701. if Length(Trim(ARemarkTel)) > 0 then
  10702. begin
  10703. Friend.TelephoneHint := Friend.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10704. end;
  10705. if Length(Trim(RealICQUser.Tel)) > 0 then
  10706. begin
  10707. if Length(Trim(Friend.TelephoneHint)) > 0 then
  10708. Friend.TelephoneHint := Friend.TelephoneHint + ' ';
  10709. Friend.TelephoneHint := Friend.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10710. end;
  10711. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10712. begin
  10713. if Length(Trim(Friend.TelephoneHint)) > 0 then
  10714. Friend.TelephoneHint := Friend.TelephoneHint + ' ';
  10715. Friend.TelephoneHint := Friend.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10716. end;
  10717. Friend.HasMobilePhone := False;
  10718. Friend.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10719. Friend.HasSMS := (Length(Trim(RealICQUser.Mobile)) > 0);
  10720. if not Friend.HasTelephone then
  10721. Friend.HasTelephone := Friend.HasSMS;
  10722. Friend.Mobile := Trim(RealICQUser.Mobile);
  10723. Friend.Tel := Trim(RealICQUser.Tel);
  10724. if Length(Trim(ARemarkMobile)) > 0 then
  10725. Friend.MobilePhoneHint := Trim(ARemarkMobile)
  10726. else
  10727. Friend.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10728. Friend.HeadImageHint := '单击显示联系人卡片';
  10729. Friend.TelephoneHint := Friend.TelephoneHint;
  10730. Friend.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10731. Friend.SMSHint := Trim(Friend.MobilePhoneHint) + '(双击发送手机短信息)';
  10732. Friend.CameraHint := '双击发送视频对话邀请';
  10733. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slAllCannotSee) then
  10734. begin
  10735. Friend.TelephoneHint := '*';
  10736. Friend.MobilePhoneHint := '*';
  10737. Friend.SMSHint := '*';
  10738. end;
  10739. if FileExists(RealICQUser.HeadImageFile) then
  10740. begin
  10741. try
  10742. if (RealICQUser.HeadImageFileType = htGIF) then
  10743. begin
  10744. GIFImage := TGIFImage.Create;
  10745. GIFImage.Animate := False;
  10746. try
  10747. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10748. Friend.HeadImagePicture.Bitmap.Assign(GIFImage);
  10749. finally
  10750. GIFImage.Free;
  10751. end;
  10752. end
  10753. else
  10754. Friend.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10755. except
  10756. Friend.HeadImagePicture.Graphic := nil;
  10757. end;
  10758. end
  10759. else
  10760. Friend.HeadImagePicture.Graphic := nil;
  10761. Friend.DisplayName := RealICQUser.DisplayName;
  10762. Friend.LoginState := RealICQUser.LoginState;
  10763. Friend.Data := RealICQUser;
  10764. if AShowNavBarNumeric then
  10765. Friend.Update;
  10766. if AShowNavBarNumeric then
  10767. ShowNavBarNumeric;
  10768. end;
  10769. //------------------------------------------------------------------------------
  10770. procedure TMainForm.UpdateEmployeeNode(Employee: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  10771. var
  10772. GIFImage: TGIFImage;
  10773. jo: ISuperObject;
  10774. ARemarkTel, ARemarkMobile, ARemark: string;
  10775. begin
  10776. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10777. if jo <> nil then
  10778. begin
  10779. ARemark := jo.S['Remark'];
  10780. ARemarkTel := jo.S['Phone'];
  10781. ARemarkMobile := jo.S['Mobile'];
  10782. end;
  10783. Employee.HasCamera := RealICQUser.InstalledCamera;
  10784. Employee.Watchword := RealICQUser.Watchword;
  10785. Employee.LeaveMessage := RealICQUser.LeaveMessage;
  10786. Employee.HasNewSNS := ShowSNS and RealICQUser.HasNewSNSUpdate;
  10787. Employee.NewSNSHint := '个人空间最近有更新,点击查看';
  10788. Employee.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10789. Employee.TelephoneHint := '';
  10790. if Length(Trim(ARemarkTel)) > 0 then
  10791. begin
  10792. Employee.TelephoneHint := Employee.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10793. end;
  10794. if Length(Trim(RealICQUser.Tel)) > 0 then
  10795. begin
  10796. if Length(Trim(Employee.TelephoneHint)) > 0 then
  10797. Employee.TelephoneHint := Employee.TelephoneHint + ' ';
  10798. Employee.TelephoneHint := Employee.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10799. end;
  10800. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10801. begin
  10802. if Length(Trim(Employee.TelephoneHint)) > 0 then
  10803. Employee.TelephoneHint := Employee.TelephoneHint + ' ';
  10804. Employee.TelephoneHint := Employee.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10805. end;
  10806. Employee.HasMobilePhone := False;
  10807. Employee.HasSMS := (Length(Trim(RealICQUser.Mobile)) > 0);
  10808. Employee.Tel := Trim(RealICQUser.Tel);
  10809. Employee.Mobile := Trim(RealICQUser.Mobile);
  10810. if Length(Trim(ARemarkMobile)) > 0 then
  10811. Employee.MobilePhoneHint := Trim(ARemarkMobile)
  10812. else
  10813. Employee.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10814. Employee.HeadImageHint := '单击显示联系人卡片';
  10815. Employee.TelephoneHint := Trim(Employee.TelephoneHint);
  10816. Employee.AddFriendHint := '双击添加好友';
  10817. Employee.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10818. Employee.SMSHint := Employee.MobilePhoneHint + '(双击发送手机短信息)';
  10819. Employee.CameraHint := '双击发送视频对话邀请';
  10820. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slAllCannotSee) and (Employee.LoginName <> MainForm.RealICQClient.Me.LoginName) then
  10821. begin
  10822. Employee.TelephoneHint := '*';
  10823. Employee.MobilePhoneHint := '*';
  10824. Employee.SMSHint := '*';
  10825. end;
  10826. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slOnlyFriendCanSee) and not (TUsersService.GetUsersService.IsWorkmateOrFriend(Employee.LoginName)) then
  10827. begin
  10828. Employee.TelephoneHint := '*';
  10829. Employee.MobilePhoneHint := '*';
  10830. Employee.SMSHint := '*';
  10831. end;
  10832. if FileExists(RealICQUser.HeadImageFile) then
  10833. begin
  10834. try
  10835. if (RealICQUser.HeadImageFileType = htGIF) then
  10836. begin
  10837. GIFImage := TGIFImage.Create;
  10838. GIFImage.Animate := False;
  10839. try
  10840. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10841. Employee.HeadImagePicture.Bitmap.Assign(GIFImage);
  10842. finally
  10843. GIFImage.Free;
  10844. end;
  10845. end
  10846. else
  10847. Employee.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10848. except
  10849. Employee.HeadImagePicture.Graphic := nil;
  10850. end;
  10851. end
  10852. else
  10853. Employee.HeadImagePicture.Graphic := nil;
  10854. Employee.DisplayName := RealICQUser.DisplayName;
  10855. Employee.LoginState := RealICQUser.LoginState;
  10856. Employee.Data := RealICQUser;
  10857. if AShowNavBarNumeric then
  10858. Employee.Update;
  10859. if AShowNavBarNumeric then
  10860. ShowNavBarNumeric;
  10861. end;
  10862. //------------------------------------------------------------------------------
  10863. procedure TMainForm.BindUserDataToItem(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean = True);
  10864. var
  10865. GIFImage: TGIFImage;
  10866. jo: ISuperObject;
  10867. ARemarkTel, ARemarkMobile, ARemark: string;
  10868. begin
  10869. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10870. if jo <> nil then
  10871. begin
  10872. ARemark := jo.S['Remark'];
  10873. ARemarkTel := jo.S['Phone'];
  10874. ARemarkMobile := jo.S['Mobile'];
  10875. end;
  10876. RealICQContacterListItem.HasCamera := RealICQUser.InstalledCamera;
  10877. RealICQContacterListItem.Watchword := RealICQUser.Watchword;
  10878. RealICQContacterListItem.LeaveMessage := RealICQUser.LeaveMessage;
  10879. RealICQContacterListItem.Branch := RealICQUser.Branch;
  10880. RealICQContacterListItem.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10881. RealICQContacterListItem.TelephoneHint := '';
  10882. if Length(Trim(ARemarkTel)) > 0 then
  10883. begin
  10884. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10885. end;
  10886. if Length(Trim(RealICQUser.Tel)) > 0 then
  10887. begin
  10888. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10889. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10890. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10891. end;
  10892. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10893. begin
  10894. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10895. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10896. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10897. end;
  10898. RealICQContacterListItem.HasMobilePhone := (Length(Trim(RealICQUser.Mobile)) > 0) or (Length(Trim(ARemarkMobile)) > 0);
  10899. RealICQContacterListItem.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10900. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasMobilePhone;
  10901. RealICQContacterListItem.HeadImageHint := '单击显示联系人卡片';
  10902. if Length(Trim(ARemarkMobile)) > 0 then
  10903. RealICQContacterListItem.MobilePhoneHint := Trim(ARemarkMobile)
  10904. else
  10905. RealICQContacterListItem.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10906. RealICQContacterListItem.Mobile := Trim(RealICQUser.Mobile);
  10907. RealICQContacterListItem.Tel := Trim(RealICQUser.Tel);
  10908. RealICQContacterListItem.HasMobilePhone := False;
  10909. RealICQContacterListItem.MobilePhoneHint := RealICQContacterListItem.MobilePhoneHint + '(双击发送手机短信息)';
  10910. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint;
  10911. RealICQContacterListItem.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10912. RealICQContacterListItem.SMSHint := RealICQContacterListItem.MobilePhoneHint;
  10913. RealICQContacterListItem.CameraHint := '双击发送视频对话邀请';
  10914. RealICQContacterListItem.HasTelephone := RealICQContacterListItem.HasTelephone and RealICQContacterListItem.ListView.ShowTelButton;
  10915. RealICQContacterListItem.HasMobilePhone := RealICQContacterListItem.HasMobilePhone and RealICQContacterListItem.ListView.ShowMobileButton;
  10916. RealICQContacterListItem.HasEmail := RealICQContacterListItem.HasEmail and RealICQContacterListItem.ListView.ShowEmailButton;
  10917. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasSMS and RealICQContacterListItem.ListView.ShowSMSButton;
  10918. if FileExists(RealICQUser.HeadImageFile) then
  10919. begin
  10920. try
  10921. if (RealICQUser.HeadImageFileType = htGIF) then
  10922. begin
  10923. GIFImage := TGIFImage.Create;
  10924. GIFImage.Animate := False;
  10925. try
  10926. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10927. RealICQContacterListItem.HeadImagePicture.Bitmap.Assign(GIFImage);
  10928. finally
  10929. GIFImage.Free;
  10930. end;
  10931. end
  10932. else
  10933. RealICQContacterListItem.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10934. except
  10935. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  10936. end;
  10937. end
  10938. else
  10939. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  10940. RealICQContacterListItem.DisplayName := RealICQUser.DisplayName;
  10941. RealICQContacterListItem.LoginState := RealICQUser.LoginState;
  10942. RealICQContacterListItem.Data := RealICQUser;
  10943. if AShowNavBarNumeric then
  10944. RealICQContacterListItem.ReDrawItem;
  10945. if AShowNavBarNumeric then
  10946. ShowNavBarNumeric;
  10947. end;
  10948. procedure TMainForm.BindUserDataToItemForGroup(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AGroupAlias: string; AShowNavBarNumeric: Boolean);
  10949. var
  10950. GIFImage: TGIFImage;
  10951. jo: IsuperObject;
  10952. ARemarkTel, ARemarkMobile, ARemark: string;
  10953. begin
  10954. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10955. if jo <> nil then
  10956. begin
  10957. ARemark := jo.S['Remark'];
  10958. ARemarkTel := jo.S['Phone'];
  10959. ARemarkMobile := jo.S['Mobile'];
  10960. end;
  10961. RealICQContacterListItem.HasCamera := RealICQUser.InstalledCamera;
  10962. RealICQContacterListItem.Watchword := RealICQUser.Watchword;
  10963. RealICQContacterListItem.LeaveMessage := RealICQUser.LeaveMessage;
  10964. RealICQContacterListItem.Branch := RealICQUser.Branch;
  10965. RealICQContacterListItem.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10966. RealICQContacterListItem.TelephoneHint := '';
  10967. if Length(Trim(ARemarkTel)) > 0 then
  10968. begin
  10969. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10970. end;
  10971. if Length(Trim(RealICQUser.Tel)) > 0 then
  10972. begin
  10973. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10974. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10975. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10976. end;
  10977. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10978. begin
  10979. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10980. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10981. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10982. end;
  10983. RealICQContacterListItem.HasMobilePhone := (Length(Trim(RealICQUser.Mobile)) > 0) or (Length(Trim(ARemarkMobile)) > 0);
  10984. RealICQContacterListItem.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10985. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasMobilePhone;
  10986. RealICQContacterListItem.HeadImageHint := '单击显示联系人卡片';
  10987. if Length(Trim(ARemarkMobile)) > 0 then
  10988. RealICQContacterListItem.MobilePhoneHint := Trim(ARemarkMobile)
  10989. else
  10990. RealICQContacterListItem.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10991. RealICQContacterListItem.Mobile := Trim(RealICQUser.Mobile);
  10992. RealICQContacterListItem.Tel := Trim(RealICQUser.Tel);
  10993. RealICQContacterListItem.HasMobilePhone := False;
  10994. RealICQContacterListItem.MobilePhoneHint := RealICQContacterListItem.MobilePhoneHint + '(双击发送手机短信息)';
  10995. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint;
  10996. RealICQContacterListItem.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10997. RealICQContacterListItem.SMSHint := RealICQContacterListItem.MobilePhoneHint;
  10998. RealICQContacterListItem.CameraHint := '双击发送视频对话邀请';
  10999. RealICQContacterListItem.HasTelephone := RealICQContacterListItem.HasTelephone and RealICQContacterListItem.ListView.ShowTelButton;
  11000. RealICQContacterListItem.HasMobilePhone := RealICQContacterListItem.HasMobilePhone and RealICQContacterListItem.ListView.ShowMobileButton;
  11001. RealICQContacterListItem.HasEmail := RealICQContacterListItem.HasEmail and RealICQContacterListItem.ListView.ShowEmailButton;
  11002. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasSMS and RealICQContacterListItem.ListView.ShowSMSButton;
  11003. if FileExists(RealICQUser.HeadImageFile) then
  11004. begin
  11005. try
  11006. if (RealICQUser.HeadImageFileType = htGIF) then
  11007. begin
  11008. GIFImage := TGIFImage.Create;
  11009. GIFImage.Animate := False;
  11010. try
  11011. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  11012. RealICQContacterListItem.HeadImagePicture.Bitmap.Assign(GIFImage);
  11013. finally
  11014. GIFImage.Free;
  11015. end;
  11016. end
  11017. else
  11018. RealICQContacterListItem.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  11019. except
  11020. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11021. end;
  11022. end
  11023. else
  11024. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11025. RealICQContacterListItem.DisplayName := AGroupAlias; //RealICQUser.DisplayName;
  11026. RealICQContacterListItem.LoginState := RealICQUser.LoginState;
  11027. RealICQContacterListItem.Data := RealICQUser;
  11028. if AShowNavBarNumeric then
  11029. RealICQContacterListItem.ReDrawItem;
  11030. if AShowNavBarNumeric then
  11031. ShowNavBarNumeric;
  11032. end;
  11033. //------------------------------------------------------------------------------
  11034. procedure TMainForm.btCloseTopMessageClick(Sender: TObject);
  11035. begin
  11036. pnlForTopMessage.Visible := False;
  11037. FTopSystemMessage := nil;
  11038. end;
  11039. procedure TMainForm.btCustomerDisplayNameClick(Sender: TObject);
  11040. var
  11041. Point: TPoint;
  11042. begin
  11043. Point.X := 0;
  11044. Point.Y := btCustomerDisplayName.Height + 1;
  11045. Point := btCustomerDisplayName.ClientToScreen(Point);
  11046. ppChangeCustomerState.Popup(Point.X, Point.Y);
  11047. end;
  11048. procedure TMainForm.btCustomerLogoutClick(Sender: TObject);
  11049. begin
  11050. //
  11051. end;
  11052. procedure TMainForm.btLoginClick(Sender: TObject);
  11053. var
  11054. ca: ICAClient;
  11055. b: Boolean;
  11056. begin
  11057. if RealICQClient.Logining then
  11058. RealICQClient.CancelLogin
  11059. else if RealICQClient.ReConnectExecuting then
  11060. RealICQClient.CancelReConnectAndLogin
  11061. else if actLoginAs.Visible and actLoginAs.Enabled and FLoginAsSavePassword then
  11062. begin
  11063. actLoginAs.Execute
  11064. end
  11065. else if RealICQClient.Logined then
  11066. begin
  11067. RealICQClient.Logout;
  11068. end
  11069. else
  11070. begin
  11071. if GetCaConfig.GetEnable and RealICQClient.CALogin then
  11072. begin
  11073. b := actLoginAs.Enabled;
  11074. actLoginAs.Enabled := true;
  11075. actLoginAs.Execute;
  11076. actLoginAs.Enabled := b;
  11077. Exit;
  11078. end;
  11079. if Length(Trim(edLoginName.Text)) = 0 then
  11080. begin
  11081. MessageBox(Handle, '请输入用户名!', '提示', MB_ICONINFORMATION);
  11082. Exit;
  11083. end;
  11084. if Length(edPassword.Text) = 0 then
  11085. begin
  11086. MessageBox(Handle, '请输入密码!', '提示', MB_ICONINFORMATION);
  11087. Exit;
  11088. end;
  11089. RealICQClient.AutoLogin := FAutoLogin;
  11090. RealICQClient.Login(Trim(edLoginName.Text), edPassword.Text, FLoginState, FLeaveMessage, FSavePassword, False, False);
  11091. end;
  11092. end;
  11093. procedure TMainForm.btMainMenuClick(Sender: TObject);
  11094. var
  11095. Point: TPoint;
  11096. begin
  11097. edtSearchMoreUser.Text := '';
  11098. Point.X := 0;
  11099. Point.Y := btMainMenu.top;
  11100. Point := btMainMenu.ClientToScreen(Point);
  11101. ppMainMenu.Popup(Point.X, Point.Y - GetSystemMetrics(SM_CYMENU) * 10 - 8);
  11102. end;
  11103. procedure TMainForm.btnCALoginClick(Sender: TObject);
  11104. begin
  11105. RealICQClient.CALogin := not RealICQClient.CALogin;
  11106. // if RealICQClient.CALogin then
  11107. // begin
  11108. // ImgLstCheckStates.GetIcon(1, btnCaLogin.Icon);
  11109. //// edLoginName.Text := CA_TEXT;
  11110. // edLoginName.Enabled := False;
  11111. // edPassword.Enabled := False;
  11112. // spbChangeLoginName.Enabled := False;
  11113. // end
  11114. // else
  11115. // begin
  11116. // ImgLstCheckStates.GetIcon(0, btnCaLogin.Icon);
  11117. //// edLoginName.Text := '';
  11118. // edLoginName.Enabled := True;
  11119. // edPassword.Enabled := True;
  11120. // spbChangeLoginName.Enabled := True;
  11121. // end;
  11122. SetLoginStateControlState;
  11123. end;
  11124. //------------------------------------------------------------------------------
  11125. procedure TMainForm.cbxURLInputerDropDown(Sender: TObject);
  11126. var
  11127. iLoop: Integer;
  11128. Items: TStringList;
  11129. begin
  11130. Items := TStringList.Create;
  11131. try
  11132. GetIEHistory(Items);
  11133. cbxURLInputer.ItemsEx.Clear;
  11134. for iLoop := 0 to Items.Count - 1 do
  11135. begin
  11136. with cbxURLInputer.ItemsEx.Add do
  11137. begin
  11138. Caption := Items.Strings[iLoop];
  11139. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  11140. ImageIndex := 2
  11141. else if Copy(Caption, 1, 4) = 'ftp:' then
  11142. ImageIndex := 1
  11143. else
  11144. ImageIndex := 0;
  11145. end;
  11146. end;
  11147. finally
  11148. Items.Free;
  11149. end;
  11150. end;
  11151. //------------------------------------------------------------------------------
  11152. procedure TMainForm.cbxURLInputerKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  11153. begin
  11154. if Key = 13 then
  11155. spbGoClick(spbGo);
  11156. end;
  11157. //------------------------------------------------------------------------------
  11158. procedure TMainForm.cbxURLInputerSelect(Sender: TObject);
  11159. begin
  11160. spbGoClick(spbGo);
  11161. end;
  11162. //------------------------------------------------------------------------------
  11163. procedure TMainForm.SetStyleMenuChecked;
  11164. begin
  11165. case FLVStyle of
  11166. lsBigHeadImage:
  11167. actShowBigHeadImage.Checked := True;
  11168. lsMiddleHeadImage:
  11169. actShowMiddleHeadImage.Checked := True;
  11170. lsSmallHeadImage:
  11171. actShowSmallHeadImage.Checked := True;
  11172. lsNoHeadImage:
  11173. actShowNormalHeadImage.Checked := True;
  11174. end;
  11175. case FLVCaptionStyle of
  11176. csDisplayName:
  11177. actShowDisplayName.Checked := True;
  11178. csLoginName:
  11179. actShowLoginName.Checked := True;
  11180. csDisplayNameAndLoginName:
  11181. actShowAllName.Checked := True;
  11182. end;
  11183. actShowRemark.Checked := RealICQClient.ShowRemark;
  11184. end;
  11185. //------------------------------------------------------------------------------
  11186. procedure TMainForm.SetLoginStateMenuChecked;
  11187. var
  11188. LeaveMsg: string;
  11189. begin
  11190. actOnline.Checked := False;
  11191. actHidden.Checked := False;
  11192. actOffline.Checked := False;
  11193. actBusy.Checked := False;
  11194. actMute.Checked := False;
  11195. actLeave.Checked := False;
  11196. actRepast.Checked := False;
  11197. actPhone.Checked := False;
  11198. actMeeting.Checked := False;
  11199. actOtherState.Checked := False;
  11200. if RealICQClient.Me = nil then
  11201. begin
  11202. actOffline.Checked := True;
  11203. Exit;
  11204. end;
  11205. LeaveMsg := RealICQClient.Me.LeaveMessage;
  11206. if RealICQClient.Me.LoginState = stOnline then
  11207. actOnline.Checked := True
  11208. else if RealICQClient.Me.LoginState = stHidden then
  11209. actHidden.Checked := True
  11210. else if RealICQClient.Me.LoginState = stLeave then
  11211. begin
  11212. if AnsiSameText(actLeave.Caption, LeaveMsg) then
  11213. actLeave.Checked := True
  11214. else if AnsiSameText(actRepast.Caption, LeaveMsg) then
  11215. actRepast.Checked := True
  11216. else if AnsiSameText(actMeeting.Caption, LeaveMsg) then
  11217. actMeeting.Checked := True
  11218. else
  11219. actOtherState.Checked := True;
  11220. end
  11221. else if RealICQClient.Me.LoginState = stBusy then
  11222. begin
  11223. if AnsiSameText(actBusy.Caption, LeaveMsg) then
  11224. actBusy.Checked := True
  11225. else if AnsiSameText(actPhone.Caption, LeaveMsg) then
  11226. actPhone.Checked := True
  11227. else
  11228. actOtherState.Checked := True;
  11229. end
  11230. else if RealICQClient.Me.LoginState = stMute then
  11231. actMute.Checked := True
  11232. else
  11233. actOtherState.Checked := True;
  11234. end;
  11235. //------------------------------------------------------------------------------
  11236. procedure TMainForm.ShowMeInformation;
  11237. var
  11238. ADisplayName, ATrueDisplayName, AWatchword, AStateMsg: WideString;
  11239. HeadPic: TPicture;
  11240. GIFImage: TGIFImage;
  11241. begin
  11242. if RealICQClient.Me = nil then
  11243. Exit;
  11244. if FNotReadMessages.Count = 0 then
  11245. begin
  11246. case RealICQClient.Me.LoginState of
  11247. stOffline:
  11248. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  11249. stOnline:
  11250. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Online.ico');
  11251. stLeave:
  11252. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\leave.ico');
  11253. stBusy:
  11254. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Busy.ico');
  11255. stMute:
  11256. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Mute.ico');
  11257. stHidden:
  11258. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\invisible.ico');
  11259. end;
  11260. TrayIcon.SetDefaultIcon;
  11261. end;
  11262. if FileExists(RealICQClient.Me.HeadImageFile) then
  11263. begin
  11264. try
  11265. if (RealICQClient.Me.HeadImageFileType = htGIF) then
  11266. begin
  11267. GIFImage := TGIFImage.Create;
  11268. GIFImage.Animate := FShowGIFInMailForm and (RealICQClient.Me.LoginState <> stHidden);
  11269. try
  11270. GIFImage.LoadFromFile(RealICQClient.Me.HeadImageFile);
  11271. if GIFImage.Animate then
  11272. imgHead.Picture.Assign(GIFImage)
  11273. else
  11274. imgHead.Picture.Bitmap.Assign(GIFImage);
  11275. finally
  11276. GIFImage.Free;
  11277. end;
  11278. end
  11279. else
  11280. imgHead.Picture.LoadFromFile(RealICQClient.Me.HeadImageFile);
  11281. except
  11282. imgHead.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  11283. end;
  11284. end
  11285. else
  11286. begin
  11287. imgHead.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  11288. end;
  11289. {if RealICQClient.Me.LoginState = stHidden then
  11290. begin
  11291. HeadPic := TPicture.Create;
  11292. try
  11293. HeadPic.Bitmap.Assign(imgHead.Picture.Graphic);
  11294. Grayscale(HeadPic.Bitmap);
  11295. imgHead.Picture.Bitmap.Assign(HeadPic.Bitmap);
  11296. finally
  11297. HeadPic.Free;
  11298. end;
  11299. end;
  11300. imgLeave.Visible := False;}
  11301. case RealICQClient.Me.LoginState of
  11302. stOffline:
  11303. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Offline.ico');
  11304. stOnline:
  11305. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Online.ico');
  11306. stLeave:
  11307. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  11308. stBusy:
  11309. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Busy.ico');
  11310. stMute:
  11311. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Mute.ico');
  11312. stHidden:
  11313. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\invisible.ico');
  11314. end;
  11315. if (RealICQClient.Me.LoginState = stLeave) or (RealICQClient.Me.LoginState = stBusy) then
  11316. AStateMsg := RealICQClient.Me.LeaveMessage
  11317. else
  11318. AStateMsg := StateValues[Integer(RealICQClient.Me.LoginState)];
  11319. ATrueDisplayName := RealICQClient.Me.Nickname;
  11320. ADisplayName := ATrueDisplayName + '(' + AStateMsg + ')';
  11321. spbDisplayName.Hint := ADisplayName;
  11322. spbDisplayName.ShowHint := False;
  11323. TrayIcon.Hint := Application.Title + ' - ' + ADisplayName;
  11324. AWatchword := RealICQClient.Me.Watchword;
  11325. if Length(Trim(AWatchword)) = 0 then
  11326. AWatchword := '在此键入您的个性签名';
  11327. spbWatchword.Hint := AWatchword;
  11328. spbWatchword.ShowHint := False;
  11329. btn_lock_DisplayName.Caption := ADisplayName; // + Format('(%s)', [StateValues[Integer(RealICQClient.Me.LoginState)]]);
  11330. btn_lock_DisplayName.AutoSize := False;
  11331. btn_lock_DisplayName.AutoSize := True;
  11332. btn_lock_DisplayName.Update;
  11333. img_lock_HeadPrev.Picture := imgHead.Picture;
  11334. //字符串长度过长时,截短字符串并在后面显示“...”
  11335. while spbDisplayName.Canvas.TextWidth(ADisplayName) > pnlTop.Width - 86 do
  11336. begin
  11337. if Length(ATrueDisplayName) > 3 then
  11338. begin
  11339. if Copy(ATrueDisplayName, Length(ATrueDisplayName) - 2, Length(ATrueDisplayName)) = '...' then
  11340. ATrueDisplayName := Copy(ATrueDisplayName, 1, Length(ATrueDisplayName) - 3);
  11341. ATrueDisplayName := Copy(ATrueDisplayName, 1, Length(ATrueDisplayName) - 1) + '...';
  11342. end
  11343. else if Length(AStateMsg) > 3 then
  11344. begin
  11345. if Copy(AStateMsg, Length(AStateMsg) - 2, Length(AStateMsg)) = '...' then
  11346. AStateMsg := Copy(AStateMsg, 1, Length(AStateMsg) - 3);
  11347. AStateMsg := Copy(AStateMsg, 1, Length(AStateMsg) - 1) + '...';
  11348. end
  11349. else
  11350. break;
  11351. ADisplayName := ATrueDisplayName + '(' + AStateMsg + ')';
  11352. spbDisplayName.ShowHint := True;
  11353. end;
  11354. //字符串长度过长时,截短字符串并在后面显示“...”
  11355. while spbWatchword.Canvas.TextWidth(AWatchword) > pnlTop.Width - 86 do
  11356. begin
  11357. if Length(AWatchword) > 3 then
  11358. begin
  11359. if Copy(AWatchword, Length(AWatchword) - 2, Length(AWatchword)) = '...' then
  11360. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 3);
  11361. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 1) + '...';
  11362. end
  11363. else
  11364. break;
  11365. spbWatchword.ShowHint := True;
  11366. end;
  11367. spbDisplayName.Caption := ADisplayName;
  11368. spbWatchword.Caption := AWatchword;
  11369. edWatchword.Text := RealICQClient.Me.Watchword;
  11370. if OptionsForm <> nil then
  11371. begin
  11372. OptionsForm.ShowHeadImage;
  11373. OptionsForm.GetSets;
  11374. end;
  11375. SetLoginStateMenuChecked;
  11376. end;
  11377. //------------------------------------------------------------------------------
  11378. procedure TMainForm.RealICQClientGetDBProcedureResult(Sender: TObject; DBProcedureName, ArgIn, ArgOut: string);
  11379. var
  11380. WebPanel: TWebPanel;
  11381. WebTabAcount: TWebTabAcount;
  11382. StrList1, StrList2: TStringList;
  11383. iLoop, iIndex: Integer;
  11384. begin
  11385. if AnsiSameText(DBProcedureName, 'YJ_AddTempRemark') then
  11386. begin
  11387. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(MainForm.RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(MainForm.RealICQClient.LoginName), StrToBase64(MD5En(MainForm.RealICQClient.Password)), StrToBase64(Format(AddRemarkURL, [ArgOut]))])), '', SW_SHOWDEFAULT);
  11388. end;
  11389. if AnsiSameText(DBProcedureName, 'GetWebTabAcounts') then
  11390. begin
  11391. StrList1 := SplitString(ArgOut, Chr(13));
  11392. for iLoop := 0 to StrList1.Count - 1 do
  11393. begin
  11394. if StrList1.Strings[iLoop] = '' then
  11395. Continue;
  11396. StrList2 := SplitString(StrList1.Strings[iLoop], Chr(10));
  11397. WebTabAcount := TWebTabAcount.Create;
  11398. try
  11399. WebTabAcount.FWebTabID := StrToInt(StrList2.Strings[0]);
  11400. WebTabAcount.FTitle := StrList2.Strings[1];
  11401. WebTabAcount.LoginName := StrList2.Strings[2];
  11402. WebTabAcount.FPassword := StrList2.Strings[3];
  11403. WebTabAcount.FExplain := StrList2.Strings[4];
  11404. iIndex := FWebPanels.IndexOf(IntToStr(WebTabAcount.FWebTabID));
  11405. if iIndex >= 0 then
  11406. begin
  11407. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  11408. WebPanel.FAcounts.Add(WebTabAcount);
  11409. end;
  11410. except
  11411. FreeAndNil(WebTabAcount);
  11412. end;
  11413. end;
  11414. end;
  11415. end;
  11416. procedure TMainForm.RealICQClientGetNotReadMessageCount(Sender: TObject; iCount: Integer);
  11417. begin
  11418. spbShowNotReadMessage.Caption := Format('(%d)', [iCount]);
  11419. end;
  11420. procedure TMainForm.RealICQClientGetSystemNoticesCount(Sender: TObject; iCount: Integer; NoticesRecords: array of TSystemNotices);
  11421. var
  11422. iLoop: Integer;
  11423. ANoticesRecord: TSystemNotices;
  11424. begin
  11425. FLastGetSystemNoticesTicket := GetTickCount;
  11426. while FSystemNotices.Count > 0 do
  11427. begin
  11428. ANoticesRecord := FSystemNotices[0];
  11429. FSystemNotices.Delete(0);
  11430. try
  11431. FreeAndNil(ANoticesRecord);
  11432. except
  11433. end;
  11434. end;
  11435. for iLoop := Low(NoticesRecords) to High(NoticesRecords) do
  11436. begin
  11437. ANoticesRecord := NoticesRecords[iLoop];
  11438. FSystemNotices.Add(ANoticesRecord);
  11439. end;
  11440. pnlForTopMessage.Visible := iCount > 0;
  11441. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  11442. FSystemNoticeIndex := 0;
  11443. if pnlForTopMessage.Visible then
  11444. begin
  11445. ShowSystemNotices;
  11446. end;
  11447. end;
  11448. procedure TMainForm.TimerForShowSystemNoticesTimer(Sender: TObject);
  11449. begin
  11450. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  11451. btNextLogClick(nil);
  11452. if GetTickCount - FLastGetSystemNoticesTicket > 60000 * 30 then
  11453. begin
  11454. TimerForShowSystemNotices.Enabled := False;
  11455. RealICQClient.SendGetNewInformation(1);
  11456. end;
  11457. end;
  11458. procedure TMainForm.TimerForShowUserCardTimer(Sender: TObject);
  11459. begin
  11460. TimerForShowUserCard.Enabled := False;
  11461. TimerForHideUserCard.Enabled := False;
  11462. if not Assigned(UserCardViewForm) then
  11463. UserCardViewForm := TUserCardViewForm.Create(Self);
  11464. // UserCardViewForm.LoginName := FNeedShowUserCardLoginName;
  11465. UserCardViewForm.TargetTop := FShowUserCardTargetTop;
  11466. UserCardViewForm.Update(FNeedShowUserCardLoginName);
  11467. // if not Assigned(UserCardForm) then UserCardForm := TUserCardForm.Create(Self);
  11468. // TUsersService.GetUsersService.GetOrRequestUser(FNeedShowUserCardLoginName, RealICQClient);
  11469. // UserCardForm.LoginName := FNeedShowUserCardLoginName;
  11470. // UserCardForm.TargetTop := FShowUserCardTargetTop;
  11471. end;
  11472. procedure TMainForm.ShowSystemNotices;
  11473. var
  11474. ANoticesRecord: TSystemNotices;
  11475. begin
  11476. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  11477. while ANoticesRecord.EndDate < Now do
  11478. begin
  11479. FSystemNotices.Delete(FSystemNoticeIndex);
  11480. FreeAndNil(ANoticesRecord);
  11481. if FSystemNotices.Count > 0 then
  11482. begin
  11483. if FSystemNoticeIndex >= FSystemNotices.Count then
  11484. FSystemNoticeIndex := FSystemNotices.Count - 1;
  11485. if FSystemNoticeIndex < 0 then
  11486. FSystemNoticeIndex := 0;
  11487. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  11488. end
  11489. else
  11490. begin
  11491. pnlForTopMessage.Visible := False;
  11492. TimerForShowSystemNotices.Enabled := False;
  11493. Exit;
  11494. end;
  11495. end;
  11496. lblLogsTitle.Caption := Format('系统公告(%d/%d)', [FSystemNoticeIndex + 1, FSystemNotices.Count]);
  11497. lblLogs.Caption := ANoticesRecord.Title;
  11498. lblLogs.Hint := ANoticesRecord.Title + '(有效期:' + DateTimeToStr(ANoticesRecord.EndDate) + ')';
  11499. TimerForShowSystemNotices.Enabled := False;
  11500. TimerForShowSystemNotices.Enabled := FSystemNotices.Count > 0;
  11501. end;
  11502. procedure TMainForm.btNextLogClick(Sender: TObject);
  11503. begin
  11504. Inc(FSystemNoticeIndex, 1);
  11505. if FSystemNoticeIndex >= FSystemNotices.Count then
  11506. FSystemNoticeIndex := 0;
  11507. ShowSystemNotices;
  11508. end;
  11509. procedure TMainForm.btn_lockClick(Sender: TObject);
  11510. var
  11511. iLoop: Integer;
  11512. AForm: TSMSForm;
  11513. begin
  11514. if Assigned(MessageBoxForm) then
  11515. MessageBoxForm.Hide;
  11516. if Assigned(MessagesManagerForm) then
  11517. MessagesManagerForm.Visible := False;
  11518. if Assigned(SearchForm) then
  11519. SearchForm.Visible := False;
  11520. for iLoop := SMSForms.Count - 1 downto 0 do
  11521. begin
  11522. AForm := SMSForms[iLoop];
  11523. AForm.Visible := False;
  11524. end;
  11525. pnlLocked.Visible := True;
  11526. pnlLocked.BringToFront;
  11527. ChangeTalkingFormVisible(False);
  11528. end;
  11529. procedure TMainForm.btn_unlockClick(Sender: TObject);
  11530. var
  11531. APassword: string;
  11532. iLoop: Integer;
  11533. AForm: TSMSForm;
  11534. begin
  11535. actOpenMainForm.Execute;
  11536. APassword := ShowMyInputBox(PChar('解锁'), PChar('请输入您的登录密码以解除锁定状态! '), '', 32);
  11537. if Trim(APassword) = '' then
  11538. Exit;
  11539. if AnsiSameText(APassword, MainForm.RealICQClient.Password) then
  11540. begin
  11541. ChangeTalkingFormVisible(True);
  11542. pnlLocked.Visible := False;
  11543. pnlMiddleClient.Visible := RealICQClient.Logined and RealICQClient.Connected;
  11544. if Assigned(MessagesManagerForm) then
  11545. MessagesManagerForm.Visible := True;
  11546. if Assigned(SearchForm) then
  11547. SearchForm.Visible := True;
  11548. for iLoop := SMSForms.Count - 1 downto 0 do
  11549. begin
  11550. AForm := SMSForms[iLoop];
  11551. AForm.Visible := True;
  11552. end;
  11553. end
  11554. else
  11555. begin
  11556. showmessage('您输入的密码有误! ');
  11557. end;
  11558. end;
  11559. procedure TMainForm.btPrevLogClick(Sender: TObject);
  11560. begin
  11561. Dec(FSystemNoticeIndex, 1);
  11562. if FSystemNoticeIndex < 0 then
  11563. FSystemNoticeIndex := FSystemNotices.Count - 1;
  11564. ShowSystemNotices;
  11565. end;
  11566. procedure TMainForm.spbShowNotReadMessageClick(Sender: TObject);
  11567. begin
  11568. { if MessageBoxForm=nil then
  11569. begin
  11570. MessageBoxForm:=TMessageBoxForm.Create(self);
  11571. end;
  11572. MessageBoxForm.Show; }
  11573. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(InBoxURL)])), '', SW_SHOWDEFAULT);
  11574. end;
  11575. //----------------------------------------------
  11576. procedure TMainForm.OpenNewWorkDisk(Path: string);
  11577. var
  11578. UserInfo: string;
  11579. C: TCopyDataStruct;
  11580. hwnd: THandle;
  11581. begin
  11582. WinExec(PChar(ExtractFilePath(Application.ExeName) + Path), sw_show);
  11583. UserInfo := RealICQClient.LoginName + #10 + RealICQClient.Password;
  11584. with c do
  11585. begin
  11586. dwData := WM_COPYDATA;
  11587. lpData := PChar(UserInfo + #0);
  11588. cbData := Length(UserInfo) + 2;
  11589. end;
  11590. hWnd := FindWindow(pchar('TMainForm'), pchar('网络存储'));
  11591. if hWnd <> 0 then
  11592. SendMessage(hwnd, WM_COPYDATA, 0, integer(@c));
  11593. end;
  11594. //---------------------------------------------------
  11595. procedure TMainForm.SaveBranchUserDataToXML(FileName: string);
  11596. var
  11597. iLoop: Integer;
  11598. XMLDocument: TXMLDocument;
  11599. Nodes, BranchsNode, BranchNode, UsersNode, UserNode: IXMLNode;
  11600. BranchInfo: TRealICQBranchInfo;
  11601. RealICQUser: TRealICQUser;
  11602. LoginName: string;
  11603. AUsers: TStringList;
  11604. begin
  11605. XMLDocument := TXMLDocument.Create(Self);
  11606. try
  11607. try
  11608. XMLDocument.Active := True;
  11609. if not FileExists(FileName) then
  11610. begin
  11611. XMLDocument.XML.Text := '<?xml version="1.0"?><Data>' + '<Branchs>' + '</Branchs>' + '<Users>' + '</Users></Data>';
  11612. XMLDocument.Active := True;
  11613. end
  11614. else
  11615. begin
  11616. XMLDocument.LoadFromFile(FileName);
  11617. end;
  11618. Nodes := XMLDocument.DocumentElement;
  11619. BranchsNode := Nodes.ChildNodes.Get(0);
  11620. UsersNode := Nodes.ChildNodes.Get(1);
  11621. BranchsNode.ChildNodes.Clear;
  11622. UsersNode.ChildNodes.Clear;
  11623. for iLoop := 0 to self.RealICQClient.Branchs.Count - 1 do
  11624. begin
  11625. BranchInfo := RealICQClient.Branchs.Objects[iLoop] as TRealICQBranchInfo;
  11626. BranchNode := BranchsNode.AddChild('Branch');
  11627. BranchNode.Attributes['ID'] := BranchInfo.ID;
  11628. BranchNode.Attributes['Name'] := BranchInfo.BranchName;
  11629. BranchNode.Attributes['ParentID'] := BranchInfo.ParentID;
  11630. end;
  11631. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  11632. try
  11633. for iLoop := 0 to AUsers.Count - 1 do
  11634. begin
  11635. RealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  11636. LoginName := RealICQUser.LoginName;
  11637. if AnsiPos('+', LoginName) > 0 then
  11638. LoginName := Copy(LoginName, AnsiPos('+', LoginName) + 1, Length(LoginName) - AnsiPos('+', LoginName));
  11639. UserNode := UsersNode.AddChild('User');
  11640. UserNode.Attributes['LoginName'] := LoginName;
  11641. UserNode.Attributes['DisplayName'] := RealICQUser.DisplayName;
  11642. UserNode.Attributes['BranchID'] := RealICQUser.BranchID;
  11643. end;
  11644. finally
  11645. FreeAndNil(AUsers);
  11646. end;
  11647. XMLDocument.SaveToFile(FileName);
  11648. except
  11649. on E: Exception do
  11650. showmessage(e.Message);
  11651. end;
  11652. finally
  11653. XMLDocument.Free;
  11654. end;
  11655. end;
  11656. //------网络存储-------------------------------------
  11657. procedure TMainForm.spbNetworkBackupClick(Sender: TObject);
  11658. var
  11659. UserInfo, LoginName: string;
  11660. C: TCopyDataStruct;
  11661. hwnd: THandle;
  11662. FilePath: string;
  11663. begin
  11664. FilePath := ExtractFilePath(paramstr(0)) + 'NetworkBackup\';
  11665. SaveBranchUserDataToXml(FilePath + 'BranchUsers.XML');
  11666. LoginName := RealICQClient.LoginName;
  11667. if AnsiPos('+', LoginName) > 0 then
  11668. LoginName := Copy(LoginName, AnsiPos('+', LoginName) + 1, Length(LoginName) - AnsiPos('+', LoginName));
  11669. WinExec(PChar(FilePath + 'NetworkBackup.exe ' + LoginName + ' ' + RealICQClient.Password), sw_show);
  11670. end;
  11671. procedure TMainForm.RealICQClientGettedAudioTransmiteConnectted(Sender: TObject; ALoginName: string);
  11672. var
  11673. TalkingForm: TTalkingForm;
  11674. begin
  11675. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11676. if TalkingForm = nil then
  11677. Exit;
  11678. if TalkingForm.CanWriteMessage then
  11679. TalkingForm.ShowGettedAudioTransmiteConnectted;
  11680. end;
  11681. //------------------------------------------------------------------------------
  11682. procedure TMainForm.RealICQClientGettedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  11683. var
  11684. AShowActive: Boolean;
  11685. TalkingForm: TTalkingForm;
  11686. iWaitTimes: Integer;
  11687. begin
  11688. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  11689. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11690. if TalkingForm = nil then
  11691. begin
  11692. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  11693. end;
  11694. iWaitTimes := 0;
  11695. while not TalkingForm.CanWriteMessage do
  11696. begin
  11697. Application.ProcessMessages;
  11698. Inc(iWaitTimes);
  11699. if iWaitTimes > 1000 then
  11700. break;
  11701. Sleep(10);
  11702. end;
  11703. if (GetForegroundWindow <> TalkingForm.Handle) then
  11704. begin
  11705. FlashWindow(TalkingForm.Handle, True);
  11706. if PlaySoundOnGetMessage then
  11707. PlayEventSound(FMessageEventSound);
  11708. end;
  11709. TalkingForm.ShowGettedAudioTransmiteRequest;
  11710. end;
  11711. //------------------------------------------------------------------------------
  11712. procedure TMainForm.RealICQClientGettedAudioTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  11713. var
  11714. TalkingForm: TTalkingForm;
  11715. begin
  11716. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11717. if TalkingForm = nil then
  11718. Exit;
  11719. if TalkingForm.CanWriteMessage then
  11720. TalkingForm.ShowGettedAudioTransmiteResponse(AAcceptted);
  11721. end;
  11722. //------显示全市页面查询结果------------------------------------------------------------------------
  11723. procedure TMainForm.RealICQClientSearchUserResult(Sender: TObject);
  11724. var
  11725. iIndex, iLoop: Integer;
  11726. ListItem: TRealICQContacterListItem;
  11727. RealICQUser: TRealICQUser;
  11728. Branch: TRealICQBranch;
  11729. RealICQContacterTreeView: TRealICQContacterTreeView;
  11730. begin
  11731. iIndex := FContacterListViews.IndexOf(LVMoreUsers);
  11732. FSearchMoreUserListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  11733. for iLoop := 0 to RealICQClient.SearchUsers.Count - 1 do
  11734. begin
  11735. RealICQUser := RealICQClient.SearchUsers.Objects[iLoop] as TRealICQUser;
  11736. iIndex := FSearchMoreUserListView.Items.IndexOf(RealICQUser.LoginName);
  11737. if iIndex = -1 then
  11738. begin
  11739. iIndex := FSearchMoreUserListView.Items.Add(RealICQUser.LoginName);
  11740. ListItem := FSearchMoreUserListView.Items.Objects[iIndex] as TRealICQContacterListItem;
  11741. ListItem.DisplayName := RealICQUser.DisplayName;
  11742. ListItem.LoginState := RealICQUser.LoginState;
  11743. ListItem.Data := RealICQUser;
  11744. Application.ProcessMessages;
  11745. end;
  11746. end;
  11747. RealICQContacterTreeView := FContacterTreeViews.Objects[FContacterTreeViews.IndexOf(LVMoreUsers)] as TRealICQContacterTreeView;
  11748. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  11749. begin
  11750. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  11751. if (AnsiPos(UpperCase(RealICQClient.KeyWord), UpperCase(Branch.BranchName)) > 0) or (AnsiPos(UpperCase(RealICQClient.KeyWord), GetPYIndexString(Branch.BranchName)) > 0) then
  11752. begin
  11753. iIndex := FSearchMoreUserListView.Items.Add(Branch.BranchName);
  11754. ListItem := FSearchMoreUserListView.Items.Objects[iIndex] as TRealICQContacterListItem;
  11755. ListItem.DisplayName := Branch.BranchName;
  11756. ListItem.LoginState := stOnline;
  11757. ListItem.StateIndex := 0;
  11758. ListItem.Data := Branch;
  11759. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  11760. end;
  11761. end;
  11762. PostMessage(FSearchMoreUserListView.Handle, WM_SIZE, 0, 0);
  11763. ImgLogining.Visible := False;
  11764. ScrollBoxSearchMoreUser.Visible := FSearchMoreUserListView.Items.Count > 0;
  11765. LblSearchHint.Visible := not ScrollBoxSearchMoreUser.Visible;
  11766. LblSearchHint.Caption := '没有找到相关记录';
  11767. end;
  11768. procedure TMainForm.RealICQClientSendedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  11769. var
  11770. TalkingForm: TTalkingForm;
  11771. begin
  11772. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11773. if TalkingForm = nil then
  11774. Exit;
  11775. if TalkingForm.CanWriteMessage then
  11776. TalkingForm.ShowSendedAudioTransmiteRequest;
  11777. end;
  11778. procedure TMainForm.RealICQClientSendedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  11779. var
  11780. TalkingForm: TTalkingForm;
  11781. begin
  11782. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11783. if TalkingForm = nil then
  11784. Exit;
  11785. if TalkingForm.CanWriteMessage then
  11786. TalkingForm.ShowSendedRemoteControlTransmiteControlRequest;
  11787. end;
  11788. procedure TMainForm.RealICQClientSendedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  11789. var
  11790. TalkingForm: TTalkingForm;
  11791. begin
  11792. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11793. if TalkingForm = nil then
  11794. Exit;
  11795. if TalkingForm.CanWriteMessage then
  11796. TalkingForm.ShowSendedRemoteControlTransmiteRequest;
  11797. end;
  11798. //------------------------------------------------------------------------------
  11799. procedure TMainForm.RealICQClientGettedCancelAudioTransmite(Sender: TObject; ALoginName: string);
  11800. var
  11801. TalkingForm: TTalkingForm;
  11802. begin
  11803. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11804. if TalkingForm = nil then
  11805. Exit;
  11806. if TalkingForm.CanWriteMessage then
  11807. TalkingForm.ShowCanceledAudioTransmite;
  11808. end;
  11809. procedure TMainForm.RealICQClientGettedCancelRemoteControlTransmite(Sender: TObject; ALoginName: string);
  11810. var
  11811. TalkingForm: TTalkingForm;
  11812. begin
  11813. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11814. if TalkingForm = nil then
  11815. Exit;
  11816. if TalkingForm.CanWriteMessage then
  11817. TalkingForm.ShowCanceledRemoteControlTransmite;
  11818. end;
  11819. //------------------------------------------------------------------------------
  11820. procedure TMainForm.RealICQClientGettedStopAudioTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  11821. var
  11822. TalkingForm: TTalkingForm;
  11823. begin
  11824. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11825. if TalkingForm = nil then
  11826. Exit;
  11827. if TalkingForm.CanWriteMessage then
  11828. TalkingForm.ShowStoppedAudioTransmite(AIsStopper);
  11829. end;
  11830. procedure TMainForm.RealICQClientGettedStopRemoteControlTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  11831. var
  11832. TalkingForm: TTalkingForm;
  11833. begin
  11834. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11835. if TalkingForm = nil then
  11836. Exit;
  11837. if TalkingForm.CanWriteMessage then
  11838. TalkingForm.ShowStoppedRemoteControlTransmite(AIsStopper);
  11839. end;
  11840. //------------------------------------------------------------------------------
  11841. procedure TMainForm.RealICQClientGettedVideoTransmiteConnectted(Sender: TObject; ALoginName: string; ASendBigBmp, ARecvBigBmp: Boolean);
  11842. var
  11843. TalkingForm: TTalkingForm;
  11844. begin
  11845. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11846. if TalkingForm = nil then
  11847. Exit;
  11848. if TalkingForm.CanWriteMessage then
  11849. TalkingForm.ShowGettedVideoTransmiteConnectted(ASendBigBmp, ARecvBigBmp);
  11850. end;
  11851. //------------------------------------------------------------------------------
  11852. procedure TMainForm.RealICQClientGettedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  11853. var
  11854. AShowActive: Boolean;
  11855. TalkingForm: TTalkingForm;
  11856. iWaitTimes: Integer;
  11857. begin
  11858. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  11859. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11860. if TalkingForm = nil then
  11861. begin
  11862. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  11863. end;
  11864. iWaitTimes := 0;
  11865. while not TalkingForm.CanWriteMessage do
  11866. begin
  11867. Application.ProcessMessages;
  11868. Inc(iWaitTimes);
  11869. if iWaitTimes > 1000 then
  11870. break;
  11871. Sleep(10);
  11872. end;
  11873. if (GetForegroundWindow <> TalkingForm.Handle) then
  11874. begin
  11875. FlashWindow(TalkingForm.Handle, True);
  11876. if PlaySoundOnGetMessage then
  11877. PlayEventSound(FMessageEventSound);
  11878. end;
  11879. TalkingForm.ShowGettedVideoTransmiteRequest;
  11880. end;
  11881. //------------------------------------------------------------------------------
  11882. procedure TMainForm.RealICQClientGettedVideoTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  11883. var
  11884. TalkingForm: TTalkingForm;
  11885. begin
  11886. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11887. if TalkingForm = nil then
  11888. Exit;
  11889. if TalkingForm.CanWriteMessage then
  11890. TalkingForm.ShowGettedVideoTransmiteResponse(AAcceptted);
  11891. end;
  11892. procedure TMainForm.RealICQClientGettedWebUrl(Sender: TObject);
  11893. begin
  11894. // if trim(RealICQClient.WeatherUrl)<>'' then
  11895. // begin
  11896. // FDownFile.OnComplete:=DownFileComplete;
  11897. // FDownFile.ThreadDownFile(RealICQClient.WeatherUrl,ExtractFilePath(Application.ExeName)+'Weather.txt');
  11898. // end;
  11899. end;
  11900. //------------------------------------------------------------------------------
  11901. procedure TMainForm.RealICQClientSendedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  11902. var
  11903. TalkingForm: TTalkingForm;
  11904. begin
  11905. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11906. if TalkingForm = nil then
  11907. Exit;
  11908. if TalkingForm.CanWriteMessage then
  11909. TalkingForm.ShowSendedVideoTransmiteRequest;
  11910. end;
  11911. //------------------------------------------------------------------------------
  11912. procedure TMainForm.RealICQClientGettedCancelVideoTransmite(Sender: TObject; ALoginName: string);
  11913. var
  11914. TalkingForm: TTalkingForm;
  11915. begin
  11916. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11917. if TalkingForm = nil then
  11918. Exit;
  11919. if TalkingForm.CanWriteMessage then
  11920. TalkingForm.ShowCanceledVideoTransmite;
  11921. end;
  11922. procedure TMainForm.RealICQClientGettedCanSendSMSCount(Sender: TObject);
  11923. begin
  11924. UpdateCanSendSMSCount;
  11925. end;
  11926. //------------------------------------------------------------------------------
  11927. procedure TMainForm.RealICQClientGettedStopVideoTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  11928. var
  11929. TalkingForm: TTalkingForm;
  11930. begin
  11931. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11932. if TalkingForm = nil then
  11933. Exit;
  11934. if TalkingForm.CanWriteMessage then
  11935. TalkingForm.ShowStoppedVideoTransmite(AIsStopper);
  11936. end;
  11937. //---显示黑名单-------------------------------------------------------------
  11938. procedure TMainForm.ShowBlacklists;
  11939. var
  11940. iLoop, ItemIndex: Integer;
  11941. RealICQUser: TRealICQUser;
  11942. FriendTreeView: TRealICQContacterTreeView;
  11943. Friend: TRealICQEmployee;
  11944. begin
  11945. SetFlashCaptionOnOnlineValue(False);
  11946. try
  11947. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  11948. FriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  11949. for iLoop := 0 to RealICQClient.Blacklists.Count - 1 do
  11950. begin
  11951. RealICQUser := RealICQClient.Blacklists.Objects[iLoop] as TRealICQUser;
  11952. if trim(RealICQUser.DisplayName) = '' then
  11953. TUsersService.GetUsersService.GetOrRequestUser(RealICQUser.LoginName, RealICQClient);
  11954. if (FriendTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then
  11955. Continue;
  11956. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  11957. Friend.BranchID := LVBlackLists;
  11958. FriendTreeView.AddEmployee(Friend);
  11959. UpdateFriendNode(Friend, RealICQUser, False);
  11960. end;
  11961. finally
  11962. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  11963. end;
  11964. end;
  11965. //------------------------------------------------------------------------------
  11966. procedure TMainForm.RealICQClientGettedBlacklists(Sender: TObject);
  11967. begin
  11968. ShowBlacklists;
  11969. end;
  11970. //-------显示与自己不同部门的联系人------------------------------
  11971. procedure TMainForm.RealICQClientGettedBranchUser(Sender: TObject);
  11972. var
  11973. iLoop, ItemIndex: Integer;
  11974. RealICQUser: TRealICQUser;
  11975. RealICQContacterTreeView: TRealICQContacterTreeView;
  11976. Employee: TRealICQEmployee;
  11977. TmpBranch, RootBranch: TRealICQBranch;
  11978. OnlineEmployee: Integer;
  11979. begin
  11980. // TmpBranch:=nil;
  11981. // RootBranch:=nil;
  11982. // ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  11983. // RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  11984. // RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  11985. // RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  11986. // RealICQContacterTreeView.AdjustPosition :=False;
  11987. // RealICQContacterTreeView.HideSystemScrollBar;
  11988. // pgcMainWorkArea.DisableAlign;
  11989. // RealICQContacterTreeView.BeginUpdate;
  11990. // try
  11991. // ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户');
  11992. // if ItemIndex>=0 then
  11993. // RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  11994. // OnlineEmployee:=0;
  11995. //
  11996. // for iLoop:=0 to RealICQContacterTreeView.EmployeeItems.Count-1 do
  11997. // begin
  11998. // Employee:=RealICQContacterTreeView.EmployeeItems.Objects[iLoop] as TRealICQEmployee;
  11999. // if (Employee.LoginState <> stOffline) and (Employee.LoginState <> stHidden) then
  12000. // OnlineEmployee := OnlineEmployee + 1;
  12001. // end;
  12002. // for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12003. // begin
  12004. // TmpBranch:=RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  12005. // if not TmpBranch.IsGetUserList then
  12006. // begin
  12007. // TmpBranch.OnlineEmployee:=0;
  12008. // TmpBranch.EmployeeCount:=0;
  12009. // TmpBranch.IsGetUserList:=True;
  12010. // end;
  12011. // if (TmpBranch.ParentID='0') then
  12012. // RootBranch:=TmpBranch
  12013. // end;
  12014. // if RootBranch<>nil then
  12015. // begin
  12016. // RootBranch.OnlineEmployee:=OnlineEmployee;
  12017. // RootBranch.EmployeeCount:= RealICQContacterTreeView.EmployeeItems.Count;
  12018. // end;
  12019. // {$region '添加联系人'}
  12020. // for iLoop := RealICQClient.Friends.Count - 1 downto 0 do
  12021. // begin
  12022. // RealICQUser := RealICQClient.Friends.Objects[iLoop] as TRealICQUser;
  12023. // if (RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then Continue;
  12024. // if AnsiSameText(RealICQUser.BranchID, 'U') then Continue;
  12025. //
  12026. // Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12027. // Employee.BranchID := RealICQUser.BranchID;
  12028. // Employee.HasAddFreindButton:=False;
  12029. // Employee.HasEmail :=False;
  12030. // RealICQContacterTreeView.AddEmployee(Employee);
  12031. // if Assigned(Employee.Node.Parent) then
  12032. // begin
  12033. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12034. // end
  12035. // else
  12036. // FreeAndNil(Employee);
  12037. // end;
  12038. // {$endregion}
  12039. // PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12040. // finally
  12041. // RealICQContacterTreeView.EndUpdate;
  12042. // pgcMainWorkArea.EnableAlign;
  12043. // end;
  12044. end;
  12045. //------------------------------------------------------------------------------
  12046. procedure TMainForm.LoadLatests;
  12047. var
  12048. FLatestUsers: TStringList;
  12049. RealICQUser: TRealICQUser;
  12050. RealICQContacterListItem: TRealICQContacterListItem;
  12051. iLoop, ItemIndex: Integer;
  12052. LoginName: string;
  12053. begin
  12054. FLatestUsers := DBHistory.GetLatests(RealICQClient.LoginName);
  12055. try
  12056. for iLoop := 0 to FLatestUsers.Count - 1 do
  12057. begin
  12058. if iLoop >= 20 then
  12059. Break;
  12060. LoginName := FLatestUsers[iLoop];
  12061. if (AnsiPos('+', LoginName) <= 0) and (trim(RealICQClient.CenterServerID) <> '') then
  12062. LoginName := RealICQClient.CenterServerID + '+' + LoginName;
  12063. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  12064. if RealICQUser = nil then
  12065. Continue;
  12066. if not AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  12067. begin
  12068. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  12069. if ItemIndex = -1 then
  12070. ItemIndex := FLVLatests.Items.Add(RealICQUser.LoginName);
  12071. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  12072. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  12073. end;
  12074. end;
  12075. finally
  12076. FreeAndNil(FLatestUsers);
  12077. end;
  12078. end;
  12079. //------------------------------------------------------------------------------
  12080. procedure TMainForm.GetOtherBranchs;
  12081. var
  12082. iLoop: Integer;
  12083. RealICQUser: TRealICQUser;
  12084. ALoginNames: string;
  12085. begin
  12086. ALoginNames := '';
  12087. for iLoop := 0 to FNotAddedEmployeeList.Count - 1 do
  12088. begin
  12089. RealICQUser := FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  12090. ALoginNames := ALoginNames + RealICQUser.LoginName;
  12091. if (iLoop < FNotAddedEmployeeList.Count - 1) then
  12092. ALoginNames := ALoginNames + Chr(10);
  12093. end;
  12094. if (Length(Trim(ALoginNames)) > 0) then
  12095. RealICQClient.SendGetFriendsInfo(ALoginNames);
  12096. end;
  12097. //-----计算某个部门的总上线人数和总用户数-----------------------------------
  12098. procedure TMainForm.GetBranchEmpOnlineAndSum(Branchs: TStringList; BranchInfo: TRealICQBranchInfo; var OnlineEmployee, EmployeeCount: Integer);
  12099. var
  12100. iLoop: Integer;
  12101. TmpBranchInfo: TRealICQBranchInfo;
  12102. begin
  12103. OnlineEmployee := OnlineEmployee + BranchInfo.OnlineEmployee;
  12104. EmployeeCount := EmployeeCount + BranchInfo.EmployeeCount;
  12105. for iLoop := 0 to Branchs.Count - 1 do
  12106. begin
  12107. TmpBranchInfo := Branchs.Objects[iLoop] as TRealICQBranchInfo;
  12108. if TmpBranchInfo.ParentID = BranchInfo.ID then
  12109. begin
  12110. GetBranchEmpOnlineAndSum(Branchs, TmpBranchInfo, OnlineEmployee, EmployeeCount);
  12111. end;
  12112. end;
  12113. end;
  12114. //------------------------------------------------------------------------------
  12115. procedure TMainForm.ShowBranchAndUsers(ExpandSelfNode: Boolean = False);
  12116. var
  12117. iLoop, ItemIndex: Integer;
  12118. OnlineEmployee, EmployeeCount: Integer;
  12119. RealICQUser: TRealICQUser;
  12120. RealICQContacterTreeView: TRealICQContacterTreeView;
  12121. BranchInfo: TRealICQBranchInfo;
  12122. Branch: TRealICQBranch;
  12123. Employee: TRealICQEmployee;
  12124. ParentNode: TTreeNode;
  12125. begin
  12126. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  12127. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12128. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12129. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12130. RealICQContacterTreeView.AdjustPosition := False;
  12131. RealICQContacterTreeView.HideSystemScrollBar;
  12132. //pgcMainWorkArea.DisableAlign;
  12133. { TODO -olqq -c : 添加部门和用户 2015/3/14 17:03:49 }
  12134. { TODO -olqq -c : 需要考虑 2015/3/14 17:05:43 }
  12135. RealICQContacterTreeView.BeginUpdate;
  12136. try
  12137. // {$region '添加部门'}
  12138. for iLoop := 0 to RealICQClient.Branchs.Count - 1 do
  12139. begin
  12140. BranchInfo := RealICQClient.Branchs.Objects[iLoop] as TRealICQBranchInfo;
  12141. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12142. Continue;
  12143. OnlineEmployee := 0;
  12144. EmployeeCount := 0;
  12145. GetBranchEmpOnlineAndSum(RealICQClient.Branchs, BranchInfo, OnlineEmployee, EmployeeCount);
  12146. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12147. Branch.BranchID := BranchInfo.ID;
  12148. Branch.ParentID := BranchInfo.ParentID;
  12149. Branch.IsGetUserList := False;
  12150. Branch.OnlineEmployee := OnlineEmployee;
  12151. Branch.EmployeeCount := EmployeeCount;
  12152. RealICQContacterTreeView.AddBranch(Branch);
  12153. end;
  12154. //
  12155. // RealICQContacterTreeView.ReAlignBranchs;
  12156. // {$endregion}
  12157. // {$region '添加联系人'}
  12158. //
  12159. // for iLoop := RealICQClient.Friends.Count - 1 downto 0 do
  12160. // begin
  12161. // RealICQUser := RealICQClient.Friends.Objects[iLoop] as TRealICQUser;
  12162. //
  12163. // if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  12164. // begin
  12165. // ShowMeInformation;
  12166. // end;
  12167. // //if (RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then Continue;
  12168. //
  12169. // Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12170. // Employee.BranchID := RealICQUser.BranchID;
  12171. // Employee.HasEmail :=False;// (Length(Trim(RealICQUser.Email)) > 0);
  12172. // Employee.HasAddFreindButton:=False;
  12173. //
  12174. //
  12175. // if not AnsiSameText(Employee.BranchID, 'U') then
  12176. // begin
  12177. // RealICQContacterTreeView.AddEmployee(Employee);
  12178. // if Assigned(Employee.Node.Parent) then
  12179. // begin
  12180. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12181. // end
  12182. // else
  12183. // begin
  12184. // FreeAndNil(Employee);
  12185. // if AnsiPos('-',RealICQUser.LoginName)>0 then
  12186. // begin
  12187. // // RealICQClient.GetUserInformation(RealICQUser.LoginName,True);
  12188. // if (FNotAddedEmployeeList.IndexOf(RealICQUser.LoginName)) < 0 then
  12189. // FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  12190. // end;
  12191. // end;
  12192. // end
  12193. // else
  12194. // begin
  12195. //
  12196. // if AnsiPos('-',RealICQUser.LoginName)>0 then
  12197. // begin
  12198. // TUsersService.GetUsersService.RequestUserInformation(RealICQUser.LoginName, RealICQClient);
  12199. // if (FNotAddedEmployeeList.IndexOf(RealICQUser.LoginName)) < 0 then
  12200. // FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  12201. // end;
  12202. // end;
  12203. // end;
  12204. // {$endregion}
  12205. // {$region '展开自己所在的部门树'}
  12206. if ExpandSelfNode then
  12207. begin
  12208. Employee := RealICQContacterTreeView.GetEmployee(RealICQClient.Me.LoginName);
  12209. ParentNode := Employee.Node.Parent;
  12210. while ParentNode <> nil do
  12211. begin
  12212. ParentNode.Expanded := True;
  12213. Branch := ParentNode.Data;
  12214. Branch.IsGetUserList := True;
  12215. ParentNode := ParentNode.Parent;
  12216. end;
  12217. RealICQContacterTreeView.MoveScrollBarToTop;
  12218. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12219. end;
  12220. {$endregion}
  12221. finally
  12222. RealICQContacterTreeView.EndUpdate;
  12223. //pgcMainWorkArea.EnableAlign;
  12224. end;
  12225. GetOtherBranchs;
  12226. end;
  12227. //-------------
  12228. procedure TMainForm.ShowBranchAndFriends;
  12229. begin
  12230. end;
  12231. //------------------------------------------------------------------------------
  12232. procedure TMainForm.RealICQClientUsersBranchReady(Sender: TObject);
  12233. begin
  12234. //
  12235. end;
  12236. //------------------------------------------------------------------------------
  12237. procedure TMainForm.RealICQClientGettedFriendList(Sender: TObject);
  12238. begin
  12239. RealICQClient.OnGetCanSendSMSCount := Self.RealICQClientGettedCanSendSMSCount;
  12240. lblLoginState.Caption := '载入联系人列表...';
  12241. lblLoginState.Refresh;
  12242. try
  12243. if tsCustomers.Parent <> nil then
  12244. begin
  12245. tsCustomers.Parent := nil;
  12246. tsCustomers.PageControl := nil;
  12247. pgcMainWorkArea.RemoveControl(tsCustomers);
  12248. end;
  12249. except
  12250. end;
  12251. { TODO -olqq -c : 需要考虑 2015/3/14 17:06:30 }
  12252. //读取最近的联系人列表
  12253. try
  12254. LoadLatests;
  12255. except
  12256. end;
  12257. {$region '读取配置信息'}
  12258. try
  12259. //读取组配置信息
  12260. LoadGroupConfigs;
  12261. except
  12262. DeleteFile(TRealICQClient.GetUserDir + GroupConfigXMLFile);
  12263. LoadGroupConfigs;
  12264. end;
  12265. try
  12266. //读取样式
  12267. LoadStyleConfigs;
  12268. except
  12269. DeleteFile(TRealICQClient.GetUserDir + StyleConfigXMLFile);
  12270. LoadStyleConfigs;
  12271. end;
  12272. try
  12273. //读取热键设置
  12274. LoadHotKeyConfigs;
  12275. except
  12276. DeleteFile(TRealICQClient.GetUserDir + HotKeyConfigXMLFile);
  12277. LoadHotKeyConfigs;
  12278. end;
  12279. try
  12280. //读取消息提示和声音配置信息
  12281. LoadHintAndSoundConfigs;
  12282. except
  12283. DeleteFile(TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile);
  12284. LoadHintAndSoundConfigs;
  12285. end;
  12286. try
  12287. //读取文件传输配置选项
  12288. LoadReceiveFileConfigs;
  12289. except
  12290. DeleteFile(TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile);
  12291. LoadReceiveFileConfigs;
  12292. end;
  12293. try
  12294. //读取安全配置选项
  12295. LoadSafeConfigs;
  12296. except
  12297. DeleteFile(TRealICQClient.GetUserDir + SafeConfigXMLFile);
  12298. LoadSafeConfigs;
  12299. end;
  12300. try
  12301. //读取字体,表情等信息
  12302. LoadInputConfigs;
  12303. except
  12304. DeleteFile(TRealICQClient.GetUserDir + InputConfigXMLFile);
  12305. LoadInputConfigs;
  12306. end;
  12307. try
  12308. //读取出差设置
  12309. LoadOfflineAutoResponseSets;
  12310. except
  12311. DeleteFile(TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile);
  12312. LoadOfflineAutoResponseSets;
  12313. end;
  12314. {$endregion}
  12315. SetFlashCaptionOnOnlineValue(False);
  12316. FCanAlert := False;
  12317. // ShowBranchAndUsers(True);
  12318. try
  12319. //重新保存组成员列表
  12320. SaveGroupConfigs;
  12321. except
  12322. end;
  12323. FCanAlert := True;
  12324. ChangeUIColor(FUIMainColor);
  12325. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  12326. try
  12327. CheckCacheDir;
  12328. except
  12329. end;
  12330. try
  12331. ShowGroupInterface;
  12332. except
  12333. end;
  12334. spbShowNotReadMessage.Caption := Format('(%d)', [0]);
  12335. RealICQClient.SendGetNewInformation(0);
  12336. Sleep(50);
  12337. pnlForTopMessage.Visible := False;
  12338. RealICQClient.SendGetNewInformation(1);
  12339. if ScrollBoxTeam.Visible or PnlMoreUser.Visible or ScrollBoxMyFriend.Visible or ScrollBoxLatests.Visible then
  12340. else
  12341. SetToolBarState(MyContacters);
  12342. try
  12343. RealICQClientReceivedAdversement(nil);
  12344. except
  12345. end;
  12346. RealICQClient.SendGetMoreServerList;
  12347. // PostMessage(Handle, WM_SIZE, 0, 0);
  12348. //Application.ProcessMessages;
  12349. RealICQClient.SendGetWebUrl;
  12350. if FIsLogout then
  12351. RealICQClient.SendGetMoreServerList;
  12352. MainForm.RealICQClient.OnGettedAddrBookGroups := GettedAddrBookGroups;
  12353. MainForm.RealICQClient.OnManageAddrBookResult := GettedManageAddrBookResult;
  12354. RealICQClient.SendGetAddrBookGroup;
  12355. // if RealICQClient.ShowMiniPage then
  12356. // RealICQClient.SendGetNewInformation(2);
  12357. if TCustomerConfig.GetConfig.ShowGuideView then
  12358. btShowMiniPageClick(nil);
  12359. try
  12360. pgcMainWorkArea.ActivePageIndex := 0;
  12361. except
  12362. end;
  12363. end;
  12364. procedure TMainForm.TimerForGetBranchOnlineStatesTimer(Sender: TObject);
  12365. begin
  12366. miChangeServerClick(nil);
  12367. TimerForGetBranchUsersOnlineStates.Enabled := False;
  12368. TimerForGetBranchUsersOnlineStates.Enabled := True;
  12369. end;
  12370. procedure TMainForm.TimerForGetBranchUsersOnlineStatesTimer(Sender: TObject);
  12371. var
  12372. iLoop, ItemIndex: Integer;
  12373. RealICQContacterTreeView: TRealICQContacterTreeView;
  12374. Branch: TRealICQBranch;
  12375. StrBranchs: string;
  12376. begin
  12377. TimerForGetBranchUsersOnlineStates.Enabled := False;
  12378. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12379. if ItemIndex >= 0 then
  12380. begin
  12381. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12382. StrBranchs := '';
  12383. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12384. begin
  12385. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  12386. if Branch.Node.Expanded then
  12387. begin
  12388. StrBranchs := StrBranchs + Branch.BranchID + ',';
  12389. end;
  12390. end;
  12391. miChangeServerClick(nil);
  12392. if Length(StrBranchs) > 0 then
  12393. RealICQClient.SendGetMoreUser(StrBranchs, FCurrentServerID);
  12394. end;
  12395. end;
  12396. procedure TMainForm.btShowMiniPageClick(Sender: TObject);
  12397. var
  12398. AShowMiniPageSet, AShowMiniPageWhenEverLoginSet: Boolean;
  12399. jo: ISuperObject;
  12400. begin
  12401. jo := SO();
  12402. if TConditionConfig.GetConfig.RemoteUI then
  12403. begin
  12404. jo.S['url'] := Format('%s/guideview/index.html?v=%d', [TConditionConfig.GetConfig.RemoteUIHost, GetTickCount]);
  12405. end
  12406. else
  12407. jo.S['url'] := ExtractFilePath(paramstr(0)) + 'html/guideview/#/';
  12408. jo.S['caption'] := '引导页';
  12409. jo.B['center'] := True;
  12410. jo.B['unsizeable'] := True;
  12411. // if not Assigned(AGuideViewForm) then
  12412. AGuideViewForm := TGuideViewForm.Create(Self);
  12413. AGuideViewForm.SetFormInfo(jo.AsString);
  12414. AGuideViewForm.Show;
  12415. // AShowMiniPageSet := RealICQClient.ShowMiniPageSet;
  12416. // AShowMiniPageWhenEverLoginSet := RealICQClient.ShowMiniPageWhenEverLoginSet;
  12417. // try
  12418. // RealICQClient.ShowMiniPageSet := True;
  12419. // RealICQClient.ShowMiniPageWhenEverLoginSet := True;
  12420. // RealICQClientGettedMiniPageSets(nil);
  12421. // finally
  12422. // RealICQClient.ShowMiniPageSet := AShowMiniPageSet;
  12423. // RealICQClient.ShowMiniPageWhenEverLoginSet := AShowMiniPageWhenEverLoginSet;
  12424. // end;
  12425. end;
  12426. procedure TMainForm.RealICQClientGettedMiniPageSets(Sender: TObject);
  12427. var
  12428. SystemMessage: TRealICQSystemMessage;
  12429. UserLoginName: string;
  12430. begin
  12431. //if (Sender <> nil) then
  12432. if not RealICQClient.ShowMiniPageSet then
  12433. Exit;
  12434. SystemMessage := TRealICQSystemMessage.Create;
  12435. SystemMessage.MessageID := 10000;
  12436. SystemMessage.MessageType := mtAdvertisement;
  12437. SystemMessage.AutoOpenWindow := True;
  12438. SystemMessage.Position := mpCenter;
  12439. SystemMessage.Left := 0;
  12440. SystemMessage.Top := 0;
  12441. SystemMessage.Width := 618;
  12442. SystemMessage.Height := 465;
  12443. SystemMessage.Delay := 0;
  12444. SystemMessage.MaxShowTimes := 0;
  12445. SystemMessage.Title := '每日新闻';
  12446. SystemMessage.Content := '';
  12447. UserLoginName := MainForm.RealICQClient.LoginName;
  12448. if Pos('+', UserLoginName) > 0 then
  12449. UserLoginName := Copy(UserLoginName, Pos('+', UserLoginName) + 1, Length(UserLoginName));
  12450. //SystemMessage.URL := Format(MiniPageURL, [UserLoginName]);
  12451. SystemMessage.URL := Format(RealICQClient.WebAppBaseURL + MiniPageURL, [UserLoginName]);
  12452. SystemMessage.AutoCloseTime := 0;
  12453. if RealICQClient.ShowMiniPageWhenEverLoginSet then
  12454. SystemMessage.MaxShowTimes := 0
  12455. else
  12456. SystemMessage.MaxShowTimes := 1;
  12457. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  12458. end;
  12459. procedure TMainForm.RealICQClientGettedMoreBranchList(Sender: TObject);
  12460. var
  12461. iLoop, jLoop, ItemIndex: Integer;
  12462. RealICQContacterTreeView: TRealICQContacterTreeView;
  12463. BranchInfo: TRealICQBranchInfo;
  12464. Branch, TopBranch: TRealICQBranch;
  12465. OnlineEmployee, EmployeeCount: Integer;
  12466. AFinded: Boolean;
  12467. Employee: TRealICQEmployee;
  12468. begin
  12469. AFinded := False;
  12470. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12471. if ItemIndex >= 0 then
  12472. begin
  12473. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12474. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12475. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12476. for iLoop := 0 to RealICQClient.MoreBranchs.Count - 1 do
  12477. begin
  12478. BranchInfo := RealICQClient.MoreBranchs.Objects[iLoop] as TRealICQBranchInfo;
  12479. if BranchInfo.ParentID = '0' then
  12480. begin
  12481. for jLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12482. begin
  12483. Branch := RealICQContacterTreeView.BranchItems.Objects[jLoop] as TRealICQBranch;
  12484. if (Branch.ParentID = '0') and AnsiSameText(Branch.BranchID, BranchInfo.ID) then
  12485. begin
  12486. AFinded := True;
  12487. Break;
  12488. end;
  12489. end;
  12490. Break;
  12491. end;
  12492. end;
  12493. if not AFinded then
  12494. begin
  12495. try
  12496. RealICQContacterTreeView.Clear;
  12497. FreeAndNil(RealICQContacterTreeView);
  12498. FContacterTreeViews.Delete(ItemIndex);
  12499. except
  12500. Exit;
  12501. end;
  12502. end;
  12503. end;
  12504. if not AFinded then
  12505. ItemIndex := AddContacterTreeView(ScrollBoxMoreUser, LVMoreUsers)
  12506. else
  12507. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12508. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12509. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12510. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12511. RealICQContacterTreeView.AdjustPosition := False;
  12512. RealICQContacterTreeView.AutoChangeOnlineNumeric := False;
  12513. RealICQContacterTreeView.AutoCalculate := False;
  12514. if not AFinded then
  12515. begin
  12516. RealICQContacterTreeView.HideSystemScrollBar;
  12517. tsContacters.DisableAlign;
  12518. RealICQContacterTreeView.BeginUpdate;
  12519. end;
  12520. try
  12521. {$region '添加部门'}
  12522. for iLoop := 0 to RealICQClient.MoreBranchs.Count - 1 do
  12523. begin
  12524. BranchInfo := RealICQClient.MoreBranchs.Objects[iLoop] as TRealICQBranchInfo;
  12525. OnlineEmployee := 0;
  12526. EmployeeCount := 0;
  12527. //GetBranchEmpOnlineAndSum(RealICQClient.MoreBranchs, BranchInfo, OnlineEmployee,EmployeeCount);
  12528. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12529. begin
  12530. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12531. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12532. //Branch.EmployeeCount := EmployeeCount;
  12533. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12534. Branch.Update;
  12535. Continue;
  12536. end;
  12537. //-----------------------------------------------------------------
  12538. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12539. Branch.BranchID := BranchInfo.ID;
  12540. Branch.ParentID := BranchInfo.ParentID;
  12541. if Branch.ParentID = '0' then
  12542. begin
  12543. TopBranch := Branch;
  12544. //EmployeeCount:=EmployeeCount-BranchInfo.EmployeeCount;
  12545. if BranchInfo.EmployeeCount > 0 then
  12546. begin
  12547. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12548. end;
  12549. end;
  12550. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12551. //Branch.EmployeeCount:=EmployeeCount;
  12552. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12553. RealICQContacterTreeView.AddBranch(Branch);
  12554. Application.ProcessMessages;
  12555. end;
  12556. {$endregion}
  12557. if not AFinded then
  12558. begin
  12559. RealICQContacterTreeView.ReAlignBranchs;
  12560. if Assigned(TopBranch) then
  12561. TopBranch.Node.Expanded := True;
  12562. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12563. RealICQContacterTreeView.MoveScrollBarToTop;
  12564. end;
  12565. finally
  12566. if not AFinded then
  12567. begin
  12568. RealICQContacterTreeView.EndUpdate;
  12569. tsContacters.EnableAlign;
  12570. end;
  12571. end;
  12572. ImgLoadingMoreBranchs.Visible := False;
  12573. ScrollBoxMoreUser.Visible := True;
  12574. {TimerForGetBranchOnlineStates.Enabled := False;
  12575. TimerForGetBranchOnlineStates.Enabled := True;}
  12576. end;
  12577. //----用户单击部门------------------------------------
  12578. procedure TMainForm.NodeBranchClick(Sender: TObject; Branch: TRealICQBranch);
  12579. var
  12580. RealICQContacterTreeView: TRealICQContacterTreeView;
  12581. ItemIndex: Integer;
  12582. Employee: TRealICQEmployee;
  12583. BranchInfo: TRealICQBranchInfo;
  12584. begin
  12585. //-------获取指定部门下的用户------------------------------------------------
  12586. if (not Branch.IsGetUserList) then// and (FGetUsersTask.IndexOf(Branch.BranchID) < 0) then
  12587. begin
  12588. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12589. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12590. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12591. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12592. // BranchInfo := MainForm.RealICQClient.MoreBranchs.Objects[MainForm.RealICQClient.MoreBranchs.IndexOf(Branch.BranchID)] as TRealICQBranchInfo;
  12593. // FGetUsersTask.AddObject(Branch.BranchID, Branch);
  12594. // if (BranchInfo.IsGetUserList) then
  12595. // begin
  12596. // //RealICQContacterTreeView.ReCalculateEmployeeCount(Branch);
  12597. // RealICQClientGettedMoreUserList(nil)
  12598. // end
  12599. // else
  12600. if RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户') < 0 then
  12601. begin
  12602. Employee := TRealICQEmployee.Create('正在下载用户');
  12603. Employee.BranchID := Branch.BranchID;
  12604. RealICQContacterTreeView.AddEmployee(Employee);
  12605. Branch.Node.Expanded := True;
  12606. GetBranchUser(Branch);
  12607. Branch.IsGetUserList := True;
  12608. end;
  12609. end;
  12610. end;
  12611. //----------------------------------------------------------------------------
  12612. procedure TMainForm.GetBranchUser(Branch: TRealICQBranch);
  12613. var
  12614. RealICQContacterTreeView: TRealICQContacterTreeView;
  12615. iIndex: Integer;
  12616. begin
  12617. SetGetMoreUserEvent;
  12618. //iIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12619. //RealICQContacterTreeView := FContacterTreeViews.Objects[iIndex] as TRealICQContacterTreeView;
  12620. //RealICQContacterTreeView.ReCalculateEmployeeCount(Branch);
  12621. RealICQClient.SendGetBranchs(FCurrentServerID, StrToInt(Branch.BranchID));
  12622. Sleep(5);
  12623. RealICQClient.SendGetMoreUser(Branch.BranchID, FCurrentServerID);
  12624. end;
  12625. //----------------------------------------------------------------------
  12626. procedure TMainForm.RealICQClientGettedMoreUserList(Sender: TObject);
  12627. var
  12628. iLoop, ItemIndex: Integer;
  12629. RealICQUser: TRealICQUser;
  12630. RealICQContacterTreeView: TRealICQContacterTreeView;
  12631. Employee: TRealICQEmployee;
  12632. TmpBranch, Branch, TopBranch: TRealICQBranch;
  12633. ParentNode: TTreeNode;
  12634. BranchInfo: TRealICQBranchInfo;
  12635. begin
  12636. TmpBranch := nil;
  12637. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12638. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12639. RealICQContacterTreeView.AdjustPosition := False;
  12640. RealICQContacterTreeView.HideSystemScrollBar;
  12641. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  12642. RealICQContacterTreeView.OnItemOnline := nil;
  12643. RealICQContacterTreeView.OnItemOffline := nil;
  12644. tsContacters.DisableAlign;
  12645. RealICQContacterTreeView.BeginUpdate;
  12646. try
  12647. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户');
  12648. if ItemIndex >= 0 then
  12649. begin
  12650. Employee := RealICQContacterTreeView.GetEmployee('正在下载用户');
  12651. ParentNode := Employee.Node.Parent;
  12652. TmpBranch := TRealICQBranch(ParentNode.Data);
  12653. //BranchInfo:=MainForm.RealICQClient.MoreBranchs.Objects[MainForm.RealICQClient.MoreBranchs.IndexOf(TmpBranch.BranchID)] as TRealICQBranchInfo;
  12654. //BranchInfo.IsGetUserList:=True;
  12655. TmpBranch.IsGetUserList := True;
  12656. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12657. end;
  12658. // else if FGetUsersTask.Count > 0 then
  12659. // TmpBranch:=FGetUsersTask.Objects[FGetUsersTask.Count-1] as TRealICQBranch;
  12660. {$region '添加联系人'}
  12661. for iLoop := RealICQClient.MoreUsers.Count - 1 downto 0 do
  12662. begin
  12663. RealICQUser := RealICQClient.MoreUsers.Objects[iLoop] as TRealICQUser;
  12664. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(RealICQUser.BranchID);
  12665. if ItemIndex < 0 then
  12666. Continue;
  12667. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName);
  12668. if ItemIndex >= 0 then
  12669. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12670. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12671. Employee.BranchID := RealICQUser.BranchID;
  12672. Employee.HasAddFreindButton := True;
  12673. Employee.HasEmail := False;
  12674. if not TConditionConfig.GetConfig.UserInfoController then
  12675. Employee.SeeInfoPermissions := $00
  12676. else
  12677. Employee.SeeInfoPermissions := RealICQUser.SeeInfoPermissions;
  12678. RealICQContacterTreeView.AddEmployee(Employee);
  12679. UpdateEmployeeNode(Employee, RealICQUser, False);
  12680. // ParentNode := Employee.Node.Parent;
  12681. // while ParentNode <> nil do
  12682. // begin
  12683. // TmpBranch := ParentNode.Data;
  12684. // TmpBranch.EmployeeCount := TmpBranch.EmployeeCount - 1;
  12685. // if (Employee.LoginState <> stOffline) and (Employee.LoginState <> stHidden) then
  12686. // TmpBranch.OnlineEmployee := TmpBranch.OnlineEmployee - 1;
  12687. // ParentNode := ParentNode.Parent;
  12688. // end;
  12689. // if Assigned(Employee.Node.Parent) then
  12690. // begin
  12691. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12692. // if (not Assigned(Employee.Node.Parent.Parent)) and (Employee.LoginState <> stOffline) and (Employee.LoginState <> stHidden) then
  12693. // begin
  12694. // TmpBranch := Employee.Node.Parent.data;
  12695. // TmpBranch.OnlineEmployee := TmpBranch.OnlineEmployee - 1;
  12696. // TmpBranch.EmployeeCount := TmpBranch.EmployeeCount - 1;
  12697. // TmpBranch.Update;
  12698. // end;
  12699. // end
  12700. // else
  12701. // FreeAndNil(Employee);
  12702. end;
  12703. {$endregion}
  12704. {$region '添加部门'}
  12705. for iLoop := RealICQClient.MoreBranchs2.Count - 1 downto 0 do
  12706. begin
  12707. BranchInfo := RealICQClient.MoreBranchs2.Objects[iLoop] as TRealICQBranchInfo;
  12708. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12709. begin
  12710. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12711. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12712. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12713. Branch.Update;
  12714. Continue;
  12715. end;
  12716. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12717. Branch.BranchID := BranchInfo.ID;
  12718. Branch.ParentID := BranchInfo.ParentID;
  12719. if Branch.ParentID = '0' then
  12720. begin
  12721. TopBranch := Branch;
  12722. //EmployeeCount:=EmployeeCount-BranchInfo.EmployeeCount;
  12723. if BranchInfo.EmployeeCount > 0 then
  12724. begin
  12725. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12726. end;
  12727. end;
  12728. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12729. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12730. //if Branch.BranchID<>TmpBranch.BranchID then continue;
  12731. RealICQContacterTreeView.AddBranch(Branch);
  12732. Application.ProcessMessages;
  12733. end;
  12734. {$endregion}
  12735. if TmpBranch <> nil then
  12736. begin
  12737. TmpBranch.Node.Expanded := True;
  12738. TmpBranch.IsGetUserList := True;
  12739. // ItemIndex := FGetUsersTask.IndexOf(TmpBranch.BranchID);
  12740. // if ItemIndex >= 0 then FGetUsersTask.Delete(ItemIndex);
  12741. // if FGetUsersTask.Count > 0 then GetBranchUser(FGetUsersTask.Objects[0] as TRealICQBranch);
  12742. end;
  12743. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12744. finally
  12745. RealICQContacterTreeView.EndUpdate;
  12746. tsContacters.EnableAlign;
  12747. end;
  12748. end;
  12749. procedure TMainForm.RealICQClientGettedPermission(Sender: TObject);
  12750. begin
  12751. //
  12752. spbNetworkBackup.Visible := RealICQClient.UserPermission.EnableBackup;
  12753. end;
  12754. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteBeControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12755. var
  12756. TalkingForm: TTalkingForm;
  12757. begin
  12758. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12759. if TalkingForm = nil then
  12760. Exit;
  12761. if TalkingForm.CanWriteMessage then
  12762. TalkingForm.ShowGettedRemoteControlTransmiteControlBeControlResponse(AAcceptted);
  12763. end;
  12764. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteConnectted(Sender: TObject; ALoginName: string);
  12765. var
  12766. TalkingForm: TTalkingForm;
  12767. begin
  12768. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12769. if TalkingForm = nil then
  12770. Exit;
  12771. if TalkingForm.CanWriteMessage then
  12772. TalkingForm.ShowGettedRemoteControlTransmiteConnectted;
  12773. end;
  12774. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  12775. var
  12776. TalkingForm: TTalkingForm;
  12777. begin
  12778. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12779. if TalkingForm = nil then
  12780. Exit;
  12781. if TalkingForm.CanWriteMessage then
  12782. TalkingForm.ShowGettedRemoteControlTransmiteControlRequest;
  12783. end;
  12784. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12785. var
  12786. TalkingForm: TTalkingForm;
  12787. begin
  12788. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12789. if TalkingForm = nil then
  12790. Exit;
  12791. if TalkingForm.CanWriteMessage then
  12792. TalkingForm.ShowGettedRemoteControlTransmiteControlControlResponse(AAcceptted);
  12793. end;
  12794. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  12795. var
  12796. AShowActive: Boolean;
  12797. TalkingForm: TTalkingForm;
  12798. iWaitTimes: Integer;
  12799. begin
  12800. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  12801. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12802. if TalkingForm = nil then
  12803. begin
  12804. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  12805. end;
  12806. iWaitTimes := 0;
  12807. while not TalkingForm.CanWriteMessage do
  12808. begin
  12809. Application.ProcessMessages;
  12810. Inc(iWaitTimes);
  12811. if iWaitTimes > 1000 then
  12812. break;
  12813. Sleep(10);
  12814. end;
  12815. if (GetForegroundWindow <> TalkingForm.Handle) then
  12816. begin
  12817. FlashWindow(TalkingForm.Handle, True);
  12818. if PlaySoundOnGetMessage then
  12819. PlayEventSound(FMessageEventSound);
  12820. end;
  12821. TalkingForm.ShowGettedRemoteControlTransmiteRequest;
  12822. end;
  12823. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12824. var
  12825. TalkingForm: TTalkingForm;
  12826. begin
  12827. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12828. if TalkingForm = nil then
  12829. Exit;
  12830. if TalkingForm.CanWriteMessage then
  12831. TalkingForm.ShowGettedRemoteControlTransmiteResponse(AAcceptted);
  12832. end;
  12833. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenImage(Sender: TObject; ALoginName: string; ALeft, ATop, AWidth, AHeight: Integer; AP: TPoint; ABitmap: TBitmap);
  12834. begin
  12835. if RemoteControlForm = nil then
  12836. Exit;
  12837. RemoteControlForm.imgRCScreen.Picture.Bitmap.Canvas.CopyRect(Rect(ALeft, ATop, ALeft + AWidth, ATop + AHeight), ABitmap.canvas, Rect(0, 0, ABitmap.width, ABitmap.height)); //拷贝
  12838. end;
  12839. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenSize(Sender: TObject; ALoginName: string; AWidth, AHeight: Integer);
  12840. var
  12841. TalkingForm: TTalkingForm;
  12842. begin
  12843. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12844. if TalkingForm = nil then
  12845. Exit;
  12846. TalkingForm.ShowGettedRemoteControlTransmiteRecvedScreenSize(AWidth, AHeight);
  12847. end;
  12848. //------------------------------------------------------------------------------
  12849. procedure TMainForm.CheckCacheDir;
  12850. var
  12851. DSearchRec: TSearchRec;
  12852. FindResult: Integer;
  12853. begin
  12854. FindResult := FindFirst(CacheDir + '*' + CacheFileExt, faAnyFile, DSearchRec);
  12855. while FindResult = 0 do
  12856. begin
  12857. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  12858. begin
  12859. try
  12860. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  12861. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12862. except
  12863. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  12864. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12865. end;
  12866. end;
  12867. FindResult := FindNext(DSearchRec);
  12868. end;
  12869. FindResult := FindFirst(CacheDir + '*' + CacheResumeSizeFileExt, faAnyFile, DSearchRec);
  12870. while FindResult = 0 do
  12871. begin
  12872. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  12873. begin
  12874. try
  12875. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  12876. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12877. except
  12878. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  12879. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12880. end;
  12881. end;
  12882. FindResult := FindNext(DSearchRec);
  12883. end;
  12884. if GetDirectorySize(CacheDir) > MaxCacheDirSize * 1024 * 1024 then
  12885. begin
  12886. if MessageBox(Handle, PChar('Cache目录的大小已经超过 ' + IntToStr(MaxCacheDirSize) + 'MB,是否打开Cache目录进行管理?'), '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_OK then
  12887. WinExec(PChar('explorer "' + CacheDir + '"'), SW_SHOWNORMAL);
  12888. end;
  12889. end;
  12890. //------------------------------------------------------------------------------
  12891. procedure TMainForm.ShowWebTabs;
  12892. var
  12893. iLoop: Integer;
  12894. TabSheet: TTabSheet;
  12895. Bitmap: TBitmap;
  12896. WebPanel: TWebPanel;
  12897. EUser, EPass: string;
  12898. begin
  12899. //先删除
  12900. try
  12901. for iLoop := 0 to FWebTabs.Count - 1 do
  12902. begin
  12903. TabSheet := FWebTabs[iLoop];
  12904. TabSheet.OnShow := nil;
  12905. TabSheet.PageControl := nil;
  12906. FreeAndNil(TabSheet);
  12907. end;
  12908. except
  12909. end;
  12910. FWebTabs.Clear;
  12911. //显示
  12912. pgcMainWorkArea.DisableAlign;
  12913. try
  12914. for iLoop := 0 to FWebPanels.Count - 1 do
  12915. begin
  12916. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12917. if (not WebPanel.Show) and (not WebPanel.MustShow) then
  12918. Continue;
  12919. if ((AnsiPos('邮件', WebPanel.FName) > 0) or (AnsiPos('邮箱', WebPanel.FName) > 0) or (AnsiPos('信箱', WebPanel.FName) > 0)) and (WebPanel.MustShow) then
  12920. begin
  12921. if WebPanel.UserIMLoginName then
  12922. EUser := RealICQClient.LoginName
  12923. else
  12924. EUser := WebPanel.CustomLoginName;
  12925. if WebPanel.UserIMPassword then
  12926. EPass := RealICQClient.Password
  12927. else
  12928. EPass := WebPanel.CustomPassword;
  12929. //WebBrowserForEMail.Navigate(Format('http://mail.lishui.gov.cn/web_email/modules/i_login.phtml?field_ouser=%s&field_ovdomain=%s&field_opass=%s', [EUser, 'lishui.gov.cn', EPass]));
  12930. end;
  12931. TabSheet := TTabSheet.Create(pgcMainWorkArea);
  12932. TabSheet.Parent := pgcMainWorkArea;
  12933. TabSheet.DoubleBuffered := True;
  12934. TabSheet.Caption := WebPanel.Name;
  12935. TabSheet.ShowHint := False;
  12936. if FileExists(WebPanel.Image) then
  12937. begin
  12938. Bitmap := GetSamllBitmap(WebPanel.Image, 32, 32, False);
  12939. try
  12940. try
  12941. Bitmap.LoadFromFile(WebPanel.Image);
  12942. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  12943. ImgLstPageControl.Add(Bitmap, nil);
  12944. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  12945. except
  12946. //
  12947. end;
  12948. finally
  12949. FreeAndNil(Bitmap);
  12950. end;
  12951. end
  12952. else
  12953. TabSheet.ImageIndex := 2; //?号图标
  12954. TabSheet.OnShow := WebTabShow;
  12955. TabSheet.Tag := iLoop;
  12956. TabSheet.PageControl := pgcMainWorkArea;
  12957. FWebTabs.Add(TabSheet);
  12958. end;
  12959. finally
  12960. pgcMainWorkArea.EnableAlign;
  12961. end;
  12962. end;
  12963. //------------------------------------------------------------------------------
  12964. procedure TMainForm.RealICQClientGetWebTabs(Sender: TObject; ATabCount: Integer; WebTabRecords: array of TWebTabRecord);
  12965. var
  12966. iLoop, jLoop: Integer;
  12967. WebTabRecord: TWebTabRecord;
  12968. WebPanel: TWebPanel;
  12969. FFinded: Boolean;
  12970. AWebPanels: TStringList;
  12971. begin
  12972. LoadWebPanelsFromXML;
  12973. AWebPanels := TStringList.Create;
  12974. for iLoop := 0 to FWebPanels.Count - 1 do
  12975. begin
  12976. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12977. AWebPanels.AddObject(WebPanel.ID, WebPanel);
  12978. end;
  12979. FWebPanels.Clear;
  12980. for iLoop := Low(WebTabRecords) to High(WebTabRecords) do
  12981. begin
  12982. WebTabRecord := WebTabRecords[iLoop];
  12983. if AWebPanels.IndexOf(WebTabRecord.ID) < 0 then
  12984. begin
  12985. WebPanel := TWebPanel.Create;
  12986. //FWebPanels.AddObject(WebTabRecord.Name, WebPanel);
  12987. WebPanel.FUserIMLoginName := True;
  12988. WebPanel.FUserIMPassword := True;
  12989. WebPanel.FCustomLoginName := '';
  12990. WebPanel.FCustomPassword := '';
  12991. WebPanel.FShow := False;
  12992. end
  12993. else
  12994. begin
  12995. WebPanel := AWebPanels.Objects[AWebPanels.IndexOf(WebTabRecord.ID)] as TWebPanel;
  12996. end;
  12997. WebPanel.MustShow := WebTabRecord.MustShow;
  12998. if WebPanel.MustShow then
  12999. WebPanel.FShow := True;
  13000. WebPanel.FID := WebTabRecord.ID;
  13001. WebPanel.FName := WebTabRecord.Name;
  13002. WebPanel.FURL := WebTabRecord.URL;
  13003. WebPanel.FImage := WebTabRecord.IconFile;
  13004. WebPanel.Content := WebTabRecord.Content;
  13005. if AnsiSameText(WebTabRecord.Method, 'GET') then
  13006. WebPanel.FNavigateType := ntGET
  13007. else if AnsiSameText(WebTabRecord.Method, 'POST') then
  13008. WebPanel.FNavigateType := ntPOST
  13009. else
  13010. WebPanel.FNavigateType := ntFill;
  13011. WebPanel.FPostFields := WebTabRecord.PostFields;
  13012. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  13013. end;
  13014. {for iLoop := FWebPanels.Count - 1 downto 0 do
  13015. begin
  13016. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  13017. //if WebPanel.MustShow then
  13018. begin
  13019. FFinded := False;
  13020. for jLoop := Low(WebTabRecords) to High(WebTabRecords) do
  13021. begin
  13022. WebTabRecord := WebTabRecords[jLoop];
  13023. if AnsiSameStr(WebTabRecord.ID, WebPanel.ID) then
  13024. begin
  13025. FFinded := True;
  13026. Break;
  13027. end;
  13028. end;
  13029. if not FFinded then
  13030. begin
  13031. FreeAndNil(WebPanel);
  13032. FWebPanels.Delete(iLoop);
  13033. end;
  13034. end;
  13035. end; }
  13036. SaveWebPanelsToXML;
  13037. DisplayWebs := False;
  13038. ShowWebTabs;
  13039. DisplayWebs := True;
  13040. end;
  13041. //------------------------------------------------------------------------------
  13042. procedure TMainForm.RealICQClientInputting(Sender: TObject; ALoginName: string; AInputting: Boolean);
  13043. var
  13044. TalkingForm: TTalkingForm;
  13045. begin
  13046. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  13047. if TalkingForm = nil then
  13048. Exit;
  13049. TalkingForm.ShowInputting(AInputting);
  13050. end;
  13051. //------------------------------------------------------------------------------
  13052. procedure TMainForm.RealICQClientJoinedTeam(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13053. var
  13054. AlertMessage: string;
  13055. RealICQUser: TRealICQUser;
  13056. begin
  13057. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13058. if RealICQUser.DisplayName = '' then
  13059. AlertMessage := RealICQUser.LoginName
  13060. else
  13061. AlertMessage := RealICQUser.DisplayName;
  13062. if ARealICQTeam.IsTempTeam then
  13063. AlertMessage := AlertMessage + ' 将您添加进了 临时多人会话'
  13064. else
  13065. AlertMessage := AlertMessage + ' 将您添加进了群组: ' + ARealICQTeam.TeamCaption;
  13066. ShowNotifyAlertForm(AlertMessage);
  13067. AddMessageHistory(smSimple, AlertMessage, nil);
  13068. UpdateTeamTalkingForm(ARealICQTeam);
  13069. end;
  13070. //------------------------------------------------------------------------------
  13071. procedure TMainForm.RealICQClientJoinTeamRequest(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName, ATag: string);
  13072. begin
  13073. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ARealICQTeam.TeamCaption, ARealICQTeam.TeamID]), nil);
  13074. ShowJoinTeamRequestWindow(Self, ARealICQTeam.TeamID, ARealICQTeam.TeamCaption, ALoginName, ATag);
  13075. end;
  13076. //------------------------------------------------------------------------------
  13077. procedure TMainForm.RealICQClientJoinTeamResponse(Sender: TObject; ATeamID: string; ALoginName: string; ATag: string; AAcceptted: Boolean);
  13078. var
  13079. ATeam: TRealICQTeam;
  13080. begin
  13081. ATeam := TTeamsAdapter.GetTeam(ATeamID);
  13082. if ATeam = nil then
  13083. Exit;
  13084. if AAcceptted then
  13085. begin
  13086. AddMessageHistory(smSimple, ALoginName + ' 接受了您加入群组 ' + ATeam.TeamCaption + ' 的请求', nil);
  13087. ShowNotifyAlertForm(ALoginName + ' 接受您加入群组 ' + ATeam.TeamCaption + ' 的请求');
  13088. end
  13089. else
  13090. begin
  13091. if Length(ATag) = 0 then
  13092. ATag := '无';
  13093. AddMessageHistory(smSimple, ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption, nil);
  13094. ShowNotifyAlertForm(ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption + #$D#$A + '附言 :' + ATag);
  13095. end;
  13096. end;
  13097. //------------------------------------------------------------------------------
  13098. procedure TMainForm.RealICQClientTeamDisbanded(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13099. var
  13100. iIndex: Integer;
  13101. AlertMessage: string;
  13102. RealICQUser: TRealICQUser;
  13103. begin
  13104. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13105. if iIndex >= 0 then
  13106. begin
  13107. FLVTeams.Items.Delete(iIndex);
  13108. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13109. if RealICQUser = RealICQClient.Me then
  13110. AlertMessage := '您'
  13111. else if RealICQUser.DisplayName = '' then
  13112. AlertMessage := RealICQUser.LoginName
  13113. else
  13114. AlertMessage := RealICQUser.DisplayName;
  13115. if ARealICQTeam.IsTempTeam then
  13116. AlertMessage := AlertMessage + ' 解散了 多人对话'
  13117. else
  13118. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  13119. ShowNotifyAlertForm(AlertMessage);
  13120. AddMessageHistory(smSimple, AlertMessage, nil);
  13121. ShowNavBarNumeric;
  13122. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13123. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13124. UpdateTeamTalkingForm(ARealICQTeam);
  13125. end;
  13126. end;
  13127. procedure TMainForm.RealICQClientTeamQuitted(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName: string);
  13128. var
  13129. iIndex: Integer;
  13130. AlertMessage: string;
  13131. begin
  13132. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13133. if iIndex >= 0 then
  13134. begin
  13135. FLVTeams.Items.Delete(iIndex);
  13136. if ARealICQTeam.IsTempTeam then
  13137. AlertMessage := '您 退出了 多人对话'
  13138. else
  13139. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  13140. ShowNotifyAlertForm(AlertMessage);
  13141. AddMessageHistory(smSimple, AlertMessage, nil);
  13142. ShowNavBarNumeric;
  13143. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13144. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13145. UpdateTeamTalkingForm(ARealICQTeam);
  13146. end;
  13147. end;
  13148. //------------------------------------------------------------------------------
  13149. procedure TMainForm.SetFlashCaptionOnOnlineValue(Value: Boolean);
  13150. var
  13151. iLoop: Integer;
  13152. GroupName: string;
  13153. RealICQContacterListView: TRealICQContacterListView;
  13154. RealICQContacterTreeView: TRealICQContacterTreeView;
  13155. begin
  13156. for iLoop := 0 to FContacterListViews.Count - 1 do
  13157. begin
  13158. GroupName := FContacterListViews[iLoop];
  13159. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  13160. RealICQContacterListView.FlashCaptionOnOnline := Value and (GroupName <> LVStrangers) and (GroupName <> LVBlacklists) and (GroupName <> LVLatests);
  13161. end;
  13162. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  13163. begin
  13164. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  13165. RealICQContacterTreeView.FlashCaptionOnOnline := Value;
  13166. RealICQContacterTreeView.ReDrawAll;
  13167. end;
  13168. end;
  13169. //------------------------------------------------------------------------------
  13170. procedure TMainForm.RealICQClientUserExInformationChanged(Sender: TObject; RealICQUser: TRealICQUser);
  13171. begin
  13172. if (OptionsForm <> nil) and (RealICQUser = RealICQClient.Me) then
  13173. begin
  13174. OptionsForm.GetSets;
  13175. end;
  13176. // UpdateSeeInformationForm(RealICQUser);
  13177. UpdateTalkingForm(RealICQUser);
  13178. UpdateSMSForm(RealICQUser);
  13179. end;
  13180. //------------------------------------------------------------------------------
  13181. procedure TMainForm.RealICQClientUserInformationReady(Sender: TObject; RealICQUser: TRealICQUser);
  13182. var
  13183. ItemIndex: Integer;
  13184. RealICQContacterListItem: TRealICQContacterListItem;
  13185. RealICQContacterListView: TRealICQContacterListView;
  13186. RealICQFriendTreeView: TRealICQContacterTreeView;
  13187. RealICQContacterTreeView: TRealICQContacterTreeView;
  13188. Employee: TRealICQEmployee;
  13189. Friend: TRealICQEmployee;
  13190. iIndex, iLoop, jLoop: Integer;
  13191. GroupName: string;
  13192. GroupMembers: TStringList;
  13193. begin
  13194. if UserCardForm <> nil then
  13195. begin
  13196. if AnsiSameText(UserCardForm.LoginName, RealICQUser.LoginName) then
  13197. UserCardForm.LoginName := RealICQUser.LoginName;
  13198. end;
  13199. {$region '如果正处于过滤用户的状态,则同时也更新FSearchListView中的数据'}
  13200. if FSearchListViewInVisible then
  13201. begin
  13202. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  13203. if ItemIndex >= 0 then
  13204. begin
  13205. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13206. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13207. end;
  13208. end;
  13209. {$endregion}
  13210. {$region '更新“最近联系人列表”中的数据'}
  13211. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  13212. if ItemIndex >= 0 then
  13213. begin
  13214. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13215. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13216. end;
  13217. {$endregion}
  13218. if TUsersService.GetUsersService.IsWorkmateOrFriend(RealICQUser.LoginName) then
  13219. begin
  13220. {$region 'wmCorporation工作模式或采用了树型方式组织好友列表'}
  13221. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  13222. ShowMeInformation;
  13223. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  13224. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13225. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13226. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13227. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13228. if Employee <> nil then
  13229. begin
  13230. UpdateEmployeeNode(Employee, RealICQUser, True);
  13231. end;
  13232. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  13233. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13234. Friend := RealICQFriendTreeView.GetEmployee(RealICQUser.LoginName);
  13235. if Friend <> nil then
  13236. begin
  13237. UpdateFriendNode(Friend, RealICQUser, True);
  13238. end;
  13239. if RealICQClient.WorkingMode = wmCorporation then
  13240. begin
  13241. {$region '更新自定义组中的信息'}
  13242. for iLoop := 0 to FGroups.Count - 1 do
  13243. begin
  13244. GroupName := FGroups[iLoop];
  13245. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  13246. for jLoop := 0 to GroupMembers.Count - 1 do
  13247. begin
  13248. if AnsiSameText(GroupMembers[jLoop], RealICQClient.LoginName) then
  13249. begin
  13250. iIndex := FContacterListViews.IndexOf(GroupName);
  13251. if iIndex >= 0 then
  13252. begin
  13253. RealICQContacterListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  13254. if RealICQContacterListView.Items.IndexOf(RealICQClient.LoginName) = -1 then
  13255. RealICQContacterListView.Items.Add(RealICQClient.LoginName);
  13256. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  13257. if ItemIndex >= 0 then
  13258. begin
  13259. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13260. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13261. end;
  13262. end; //if
  13263. end; //if
  13264. end; //for jLoop
  13265. end; //for iLoop
  13266. {$endregion}
  13267. end;
  13268. {$endregion}
  13269. end;
  13270. if RealICQClient.MoreUsers.IndexOf(RealICQUser.LoginName) >= 0 then
  13271. begin
  13272. {$region '更新“全市”中的数据'}
  13273. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  13274. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13275. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13276. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13277. RealICQContacterTreeView.OnItemOnline := nil;
  13278. RealICQContacterTreeView.OnItemOffline := nil;
  13279. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  13280. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13281. if Employee <> nil then
  13282. begin
  13283. UpdateEmployeeNode(Employee, RealICQUser, True);
  13284. end;
  13285. {$endregion}
  13286. end;
  13287. // UpdateSeeInformationForm(RealICQUser);
  13288. UpdateTalkingForm(RealICQUser);
  13289. UpdateSMSForm(RealICQUser);
  13290. UpdateMemberInfoOfTeamOptionsForm(RealICQUser);
  13291. UpdateAddrBookInfo(RealICQUser);
  13292. end;
  13293. procedure TMainForm.UpdateAddrBookInfo(RealICQUser: TRealICQUser);
  13294. var
  13295. iLoop, ItemIndex: Integer;
  13296. Employee: TRealICQEmployee;
  13297. TmpRealICQUser: TRealICQUser;
  13298. RealICQContacterTreeView: TRealICQContacterTreeView;
  13299. begin
  13300. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  13301. if ItemIndex < 0 then
  13302. Exit;
  13303. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13304. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13305. if (Employee <> nil) then
  13306. begin
  13307. Employee.Mobile := RealICQUser.Mobile;
  13308. Employee.SMSHint := RealICQUser.Mobile;
  13309. Employee.Tel := RealICQUser.Tel;
  13310. Employee.Update;
  13311. end
  13312. else
  13313. Exit;
  13314. ItemIndex := MainForm.RealICQClient.AddrBookUsers.IndexOf(RealICQUser.LoginName);
  13315. if ItemIndex < 0 then
  13316. Exit;
  13317. TmpRealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[ItemIndex] as TRealICQUser;
  13318. TmpRealICQUser.Mobile := RealICQUser.Mobile;
  13319. TmpRealICQUser.Tel := RealICQUser.Tel;
  13320. end;
  13321. //------------------------------------------------------------------------------
  13322. procedure TMainForm.ShowNetWorkDiskSpaceInfo;
  13323. begin
  13324. lblNDSpaceSize.Caption := Format('%0fM/%dM', [RealICQNetWorkDiskClient.UsedSpaceSize / (1024 * 1024), RealICQNetWorkDiskClient.MaxSpaceSize div (1024 * 1024)]);
  13325. end;
  13326. //------------------------------------------------------------------------------
  13327. procedure TMainForm.RealICQNetWorkDiskClientConnectStateChanged(Sender: TObject);
  13328. begin
  13329. if tsNetWorkDisk.Parent = nil then
  13330. Exit;
  13331. try
  13332. FConfirmReplaceResult := -1;
  13333. if RealICQNetWorkDiskClient.Connectting then
  13334. begin
  13335. lblNDState.Caption := '正在连接...';
  13336. lblNDSpaceSize.Caption := '';
  13337. end
  13338. else if RealICQNetWorkDiskClient.Connected then
  13339. begin
  13340. lblNDState.Caption := '已连接';
  13341. ShowNetWorkDiskSpaceInfo;
  13342. end
  13343. else
  13344. begin
  13345. lblNDState.Caption := '连接已断开';
  13346. lblNDSpaceSize.Caption := '';
  13347. try
  13348. if FLVNetWorkDisk <> nil then
  13349. begin
  13350. FLVNetWorkDisk.Items.Clear;
  13351. FLVNetWorkDisk.ReDrawAll;
  13352. end;
  13353. except
  13354. end;
  13355. try
  13356. spbNDCancelAllClick(spbNDCancelAll);
  13357. except
  13358. end;
  13359. end;
  13360. spbNDMoveUp.Enabled := RealICQNetWorkDiskClient.Connected;
  13361. spbNDRefresh.Enabled := spbNDMoveUp.Enabled;
  13362. spbNDNewDir.Enabled := spbNDMoveUp.Enabled;
  13363. spbNDDelete.Enabled := spbNDMoveUp.Enabled;
  13364. shpNDDirBorder.Enabled := spbNDMoveUp.Enabled;
  13365. edNDDir.Enabled := spbNDMoveUp.Enabled;
  13366. spbNDUpload.Enabled := spbNDMoveUp.Enabled;
  13367. spbNDDownload.Enabled := spbNDMoveUp.Enabled;
  13368. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13369. spbNDConnect.Enabled := (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) and (RealICQClient.Connected);
  13370. spbNDDisconnect.Enabled := not spbNDConnect.Enabled and not RealICQNetWorkDiskClient.Connectting;
  13371. if not edNDDir.Enabled then
  13372. edNDDir.Text := '';
  13373. except
  13374. end;
  13375. end;
  13376. //------------------------------------------------------------------------------
  13377. procedure TMainForm.ItemShowHint(Sender: TObject; Item: TRealICQContacterListItem; var HintStr: string);
  13378. var
  13379. AFile: TRealICQNetWorkDiskFile;
  13380. ADirectory: TRealICQNetWorkDiskDirectory;
  13381. AUploadMission: TUploadMission;
  13382. ADownloadMission: TDownloadMission;
  13383. begin
  13384. if Item = nil then
  13385. Exit;
  13386. if Sender = FLVNetWorkDisk then
  13387. begin
  13388. if Copy(Item.LoginName, 1, 1) = 'D' then
  13389. begin
  13390. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  13391. HintStr := '目录名称: ' + Trim(ADirectory.Name) + #$D#$A;
  13392. HintStr := HintStr + '创建时间: ' + DateTimeToStr(ADirectory.CreateDate);
  13393. end
  13394. else if Copy(Item.LoginName, 1, 1) = 'F' then
  13395. begin
  13396. AFile := TRealICQNetWorkDiskFile(Item.Data);
  13397. HintStr := '文件名称: ' + Trim(AFile.Name) + #$D#$A;
  13398. HintStr := HintStr + '创建时间: ' + Trim(DateTimeToStr(AFile.CreateDate)) + #$D#$A;
  13399. HintStr := HintStr + '修改时间: ' + Trim(DateTimeToStr(AFile.ModifyDate)) + #$D#$A;
  13400. HintStr := HintStr + '大小: ' + Trim(Item.Watchword);
  13401. end;
  13402. end;
  13403. if Sender = FLVNetWorkDiskUploadingFiles then
  13404. begin
  13405. if AnsiSameText(HintStr, '取消') then
  13406. Exit;
  13407. AUploadMission := TUploadMission(Item.Data);
  13408. HintStr := AUploadMission.Name;
  13409. end;
  13410. if Sender = FLVNetWorkDiskDownloadingFiles then
  13411. begin
  13412. if AnsiSameText(HintStr, '取消') then
  13413. Exit;
  13414. ADownloadMission := TDownloadMission(Item.Data);
  13415. if ADownloadMission.FDownloadMissionType = mtDir then
  13416. HintStr := ADownloadMission.DirectoryName
  13417. else
  13418. HintStr := ADownloadMission.FileName;
  13419. end;
  13420. end;
  13421. procedure TMainForm.LblHintClick(Sender: TObject);
  13422. var
  13423. FAutoSaveMessage: Boolean;
  13424. begin
  13425. FAutoSaveMessage := AutoSaveMessage;
  13426. AutoSaveMessage := False;
  13427. try
  13428. RealICQClientReceivedSystemMessage(RealICQClient, FTopSystemMessage);
  13429. finally
  13430. btCloseTopMessageClick(nil);
  13431. AutoSaveMessage := FAutoSaveMessage;
  13432. end;
  13433. end;
  13434. //------------------------------------------------------------------------------
  13435. procedure TMainForm.NDSelectItemChanged(Item: TRealICQContacterListItem);
  13436. begin
  13437. if not pnlNDMissions.Visible then
  13438. begin
  13439. spbNDDelete.Enabled := (FLVNetWorkDisk <> nil) and (FLVNetWorkDisk.SelCount > 0);
  13440. spbNDDownload.Enabled := spbNDDelete.Enabled;
  13441. end;
  13442. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13443. end;
  13444. //------------------------------------------------------------------------------
  13445. procedure TMainForm.NDItemMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  13446. begin
  13447. end;
  13448. //------------------------------------------------------------------------------
  13449. procedure TMainForm.NDMissionItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  13450. var
  13451. UploadMission: TUploadMission;
  13452. DownloadMission: TDownloadMission;
  13453. AMissionID: string;
  13454. begin
  13455. if Sender = FLVNetWorkDiskUploadingFiles then
  13456. begin
  13457. try
  13458. if not Assigned(Item) then
  13459. Exit;
  13460. UploadMission := TUploadMission(Item.Data);
  13461. if not Assigned(UploadMission) then
  13462. Exit;
  13463. AMissionID := UploadMission.FID;
  13464. try
  13465. FLVNetWorkDiskUploadingFiles.Items.Delete(Item.ItemIndex);
  13466. FreeAndNil(UploadMission);
  13467. except
  13468. end;
  13469. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  13470. finally
  13471. CheckUploadMissions
  13472. end;
  13473. end;
  13474. if Sender = FLVNetWorkDiskDownloadingFiles then
  13475. begin
  13476. try
  13477. if not Assigned(Item) then
  13478. Exit;
  13479. FLVNetWorkDiskDownloadingFiles.Items.Delete(Item.ItemIndex);
  13480. DownloadMission := TDownloadMission(Item.Data);
  13481. FreeAndNil(DownloadMission);
  13482. RealICQNetWorkDiskClient.StopDownloader;
  13483. finally
  13484. CheckDownloadMissions
  13485. end;
  13486. end;
  13487. end;
  13488. //------------------------------------------------------------------------------
  13489. procedure TMainForm.NDMissionDropFiles(Sender: TObject; var Message: TMessage);
  13490. var
  13491. i: Integer;
  13492. p: array[0..1023] of Char;
  13493. AName: string;
  13494. begin
  13495. try
  13496. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  13497. begin
  13498. MessageBox(Handle, '抱歉,系统正忙!', '提示', MB_ICONINFORMATION);
  13499. Exit;
  13500. end;
  13501. i := DragQueryFile(Message.wParam, $FFFFFFFF, nil, 0);
  13502. for i := 0 to i - 1 do
  13503. begin
  13504. DragQueryFile(Message.wParam, i, p, 1024);
  13505. AName := StrPas(p);
  13506. if FileExists(AName) then
  13507. begin
  13508. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13509. end
  13510. else if DirectoryExists(AName) then
  13511. begin
  13512. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13513. end;
  13514. end;
  13515. finally
  13516. CheckUploadMissions;
  13517. DragFinish(Message.wParam);
  13518. Message.Result := 1;
  13519. end;
  13520. end;
  13521. //------------------------------------------------------------------------------
  13522. procedure TMainForm.miNDCancelClick(Sender: TObject);
  13523. var
  13524. ListItem: TRealICQContacterListItem;
  13525. UploadMission: TUploadMission;
  13526. DownloadMission: TDownloadMission;
  13527. iLoop: Integer;
  13528. begin
  13529. if TabSetNDMissions.TabIndex = 0 then
  13530. begin
  13531. for iLoop := FLVNetWorkDiskUploadingFiles.Items.Count - 1 downto 0 do
  13532. begin
  13533. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13534. if ListItem.Selected then
  13535. begin
  13536. UploadMission := TUploadMission(ListItem.Data);
  13537. if ListItem.LoginState = stOnline then
  13538. begin
  13539. if UploadMission.FUploadMissionType = mtFile then
  13540. begin
  13541. RealICQNetWorkDiskClient.CancelUploadingFile(UploadMission.FID);
  13542. Continue;
  13543. end;
  13544. end;
  13545. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13546. FreeAndNil(UploadMission);
  13547. end;
  13548. end;
  13549. CheckUploadMissions;
  13550. end;
  13551. if TabSetNDMissions.TabIndex = 1 then
  13552. begin
  13553. for iLoop := FLVNetWorkDiskDownloadingFiles.Items.Count - 1 downto 0 do
  13554. begin
  13555. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13556. if ListItem.Selected then
  13557. begin
  13558. DownloadMission := TDownloadMission(ListItem.Data);
  13559. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13560. FreeAndNil(DownloadMission);
  13561. if ListItem.LoginState = stOnline then
  13562. begin
  13563. RealICQNetWorkDiskClient.StopDownloader;
  13564. end;
  13565. end;
  13566. end;
  13567. CheckDownloadMissions;
  13568. end;
  13569. end;
  13570. //------------------------------------------------------------------------------
  13571. procedure TMainForm.spbNDMoveUpClick(Sender: TObject);
  13572. begin
  13573. if RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil then
  13574. begin
  13575. lblNDState.Caption := '正在载入...';
  13576. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13577. end;
  13578. end;
  13579. //------------------------------------------------------------------------------
  13580. procedure TMainForm.miNDRenameClick(Sender: TObject);
  13581. var
  13582. DirectoryName, FileName: string;
  13583. AFile: TRealICQNetWorkDiskFile;
  13584. ADirectory: TRealICQNetWorkDiskDirectory;
  13585. ListItem, ListItem1: TRealICQContacterListItem;
  13586. iLoop, jLoop: Integer;
  13587. begin
  13588. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13589. begin
  13590. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13591. if ListItem.Selected then
  13592. begin
  13593. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13594. begin
  13595. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  13596. DirectoryName := Trim(ShowMyInputBox('重命名目录', '请输入新的目录名称', ADirectory.Name, 200));
  13597. if AnsiSameStr(DirectoryName, ADirectory.Name) then
  13598. Exit;
  13599. if Length(DirectoryName) > 0 then
  13600. begin
  13601. if (Pos('\', DirectoryName) > 0) or (Pos('/', DirectoryName) > 0) or (Pos(':', DirectoryName) > 0) or (Pos('*', DirectoryName) > 0) or (Pos('"', DirectoryName) > 0) or (Pos('<', DirectoryName) > 0) or (Pos('>', DirectoryName) > 0) or (Pos('|', DirectoryName) > 0) then
  13602. begin
  13603. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13604. Exit;
  13605. end;
  13606. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13607. begin
  13608. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13609. if ListItem1 = ListItem then
  13610. continue;
  13611. if Copy(ListItem1.LoginName, 1, 1) = 'D' then
  13612. begin
  13613. if AnsiSameText(DirectoryName, ListItem1.DisplayName) then
  13614. begin
  13615. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13616. Exit;
  13617. end;
  13618. end;
  13619. end;
  13620. RealICQNetWorkDiskClient.Rename(rtDir, ADirectory.ID, DirectoryName);
  13621. end;
  13622. end
  13623. else if Copy(ListItem.LoginName, 1, 1) = 'F' then
  13624. begin
  13625. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  13626. FileName := Trim(ShowMyInputBox('重命名文件', '请输入新的文件名称', AFile.Name, 200));
  13627. if AnsiSameStr(FileName, AFile.Name) then
  13628. Exit;
  13629. if Length(FileName) > 0 then
  13630. begin
  13631. if (Pos('\', FileName) > 0) or (Pos('/', FileName) > 0) or (Pos(':', FileName) > 0) or (Pos('*', FileName) > 0) or (Pos('"', FileName) > 0) or (Pos('<', FileName) > 0) or (Pos('>', FileName) > 0) or (Pos('|', FileName) > 0) then
  13632. begin
  13633. MessageBox(Handle, '文件名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13634. Exit;
  13635. end;
  13636. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13637. begin
  13638. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13639. if ListItem1 = ListItem then
  13640. continue;
  13641. if Copy(ListItem1.LoginName, 1, 1) = 'F' then
  13642. begin
  13643. if AnsiSameText(FileName, ListItem1.DisplayName) then
  13644. begin
  13645. MessageBox(Handle, '指定的文件已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13646. Exit;
  13647. end;
  13648. end;
  13649. end;
  13650. RealICQNetWorkDiskClient.Rename(rtFile, AFile.ID, FileName);
  13651. end;
  13652. end;
  13653. Exit;
  13654. end;
  13655. end;
  13656. end;
  13657. //------------------------------------------------------------------------------
  13658. procedure TMainForm.spbNDNewDirClick(Sender: TObject);
  13659. var
  13660. DirectoryName: string;
  13661. iLoop: Integer;
  13662. ListItem: TRealICQContacterListItem;
  13663. begin
  13664. DirectoryName := Trim(ShowMyInputBox('新建目录', '请输入目录名称', '', 200));
  13665. if Length(DirectoryName) > 0 then
  13666. begin
  13667. if (Pos('\', DirectoryName) > 0) or (Pos('/', DirectoryName) > 0) or (Pos(':', DirectoryName) > 0) or (Pos('*', DirectoryName) > 0) or (Pos('"', DirectoryName) > 0) or (Pos('<', DirectoryName) > 0) or (Pos('>', DirectoryName) > 0) or (Pos('|', DirectoryName) > 0) then
  13668. begin
  13669. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13670. Exit;
  13671. end;
  13672. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13673. begin
  13674. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13675. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13676. begin
  13677. if AnsiSameText(DirectoryName, ListItem.DisplayName) then
  13678. begin
  13679. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13680. Exit;
  13681. end;
  13682. end;
  13683. end;
  13684. RealICQNetWorkDiskClient.NewDirectory(DirectoryName);
  13685. end;
  13686. end;
  13687. //------------------------------------------------------------------------------
  13688. procedure TMainForm.spbNDRefreshClick(Sender: TObject);
  13689. begin
  13690. RealICQNetWorkDiskClient.Refresh;
  13691. end;
  13692. //------------------------------------------------------------------------------
  13693. procedure TMainForm.GoNextLevelUploadMissions(UploadMission: TUploadMission);
  13694. var
  13695. iLoop: Integer;
  13696. Missions: TStringList;
  13697. ListItem: TRealICQContacterListItem;
  13698. AUploadMission: TUploadMission;
  13699. DSearchRec: TSearchRec;
  13700. FindResult: Integer;
  13701. begin
  13702. if UploadMission.FUploadMissionType <> mtDir then
  13703. Exit;
  13704. Missions := TStringList.Create;
  13705. for iLoop := 0 to FLVNetWorkDiskUploadingFiles.Items.Count - 1 do
  13706. begin
  13707. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13708. AUploadMission := TUploadMission(ListItem.Data);
  13709. Missions.AddObject(AUploadMission.FID, AUploadMission);
  13710. try
  13711. FUploadMissions.Delete(FUploadMissions.IndexOf(AUploadMission.ID));
  13712. except
  13713. end;
  13714. end;
  13715. FSavedUploadMissions.Add(Missions);
  13716. FLVNetWorkDiskUploadingFiles.Items.Clear;
  13717. FindResult := FindFirst(UploadMission.FName + '\*.*', faDirectory, DSearchRec);
  13718. while FindResult = 0 do
  13719. begin
  13720. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13721. begin
  13722. if DirectoryExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13723. begin
  13724. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13725. end;
  13726. end;
  13727. FindResult := FindNext(DSearchRec);
  13728. end;
  13729. FindResult := FindFirst(UploadMission.FName + '\*.*', faAnyFile - faDirectory, DSearchRec);
  13730. while FindResult = 0 do
  13731. begin
  13732. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13733. begin
  13734. if FileExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13735. begin
  13736. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13737. end;
  13738. end;
  13739. FindResult := FindNext(DSearchRec);
  13740. end;
  13741. CheckUploadMissions;
  13742. end;
  13743. //------------------------------------------------------------------------------
  13744. procedure TMainForm.CheckUploadMissions;
  13745. var
  13746. ListItem: TRealICQContacterListItem;
  13747. UploadMission: TUploadMission;
  13748. Missions: TStringList;
  13749. iLoop: Integer;
  13750. ADirectory: TRealICQNetWorkDiskDirectory;
  13751. AFile: TRealICQNetWorkDiskFile;
  13752. Finded: Boolean;
  13753. MessageBoxResult: Integer;
  13754. ConfirmReplaceNDFileForm: TConfirmReplaceNDFileForm;
  13755. begin
  13756. if FLVNetWorkDiskUploadingFiles.OnlineNumeric = 0 then
  13757. begin
  13758. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  13759. begin
  13760. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  13761. UploadMission := TUploadMission(ListItem.Data);
  13762. if UploadMission.UploadMissionType = mtFile then
  13763. begin
  13764. with ListItem do
  13765. begin
  13766. LoginState := stOnline;
  13767. HasSMS := True;
  13768. Watchword := '';
  13769. SMSHint := '取消';
  13770. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13771. ReDrawItem;
  13772. end;
  13773. for iLoop := RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 downto 0 do
  13774. begin
  13775. AFile := RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop];
  13776. if AnsiSameText(ExtractFileName(AFile.Name), ExtractFileName(UploadMission.Name)) then
  13777. begin
  13778. if FConfirmReplaceResult <> mrYesToAll then
  13779. begin
  13780. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  13781. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(AFile.Name)]);
  13782. try
  13783. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  13784. finally
  13785. FreeAndNil(ConfirmReplaceNDFileForm);
  13786. end;
  13787. end;
  13788. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  13789. begin
  13790. //FreeAndNil(AFile);
  13791. RealICQNetWorkDiskClient.Delete('F' + IntToStr(AFile.ID));
  13792. Sleep(100);
  13793. Application.ProcessMessages;
  13794. Break;
  13795. end
  13796. else if FConfirmReplaceResult = mrNO then
  13797. begin
  13798. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  13799. FreeAndNil(UploadMission);
  13800. CheckUploadMissions;
  13801. Exit;
  13802. end
  13803. else if FConfirmReplaceResult = mrCancel then
  13804. begin
  13805. spbNDCancelAllClick(spbNDCancelAll);
  13806. Exit;
  13807. end;
  13808. end;
  13809. end;
  13810. while True do
  13811. begin
  13812. try
  13813. RealICQNetWorkDiskClient.UploadFile(UploadMission.Name, UploadMission.DirectoryID, UploadMission.ID);
  13814. Break;
  13815. except
  13816. on E: Exception do
  13817. begin
  13818. MessageBoxResult := MessageBox(Handle, PChar('上传文件时出错:'#$D#$A#$D#$A + E.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  13819. if MessageBoxResult = ID_ABORT then
  13820. begin
  13821. spbNDCancelAllClick(spbNDCancelAll);
  13822. Exit;
  13823. end
  13824. else if MessageBoxResult = ID_RETRY then
  13825. begin
  13826. Continue;
  13827. end
  13828. else if MessageBoxResult = ID_IGNORE then
  13829. begin
  13830. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  13831. FreeAndNil(UploadMission);
  13832. CheckUploadMissions;
  13833. Exit;
  13834. end;
  13835. end;
  13836. end; //try
  13837. end; //while
  13838. end
  13839. else
  13840. begin
  13841. with ListItem do
  13842. begin
  13843. LoginState := stOnline;
  13844. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13845. ReDrawItem;
  13846. end;
  13847. Finded := False;
  13848. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  13849. begin
  13850. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop];
  13851. if Length(ExtractFileName(UploadMission.Name)) > 0 then
  13852. begin
  13853. if AnsiSameText(ADirectory.Name, ExtractFileName(UploadMission.Name)) then
  13854. begin
  13855. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  13856. Finded := True;
  13857. end;
  13858. end
  13859. else
  13860. begin
  13861. if AnsiSameText(ADirectory.Name, '[' + Copy(UploadMission.Name, 1, 1) + ']') then
  13862. begin
  13863. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  13864. Finded := True;
  13865. end;
  13866. end;
  13867. end;
  13868. if not Finded then
  13869. begin
  13870. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  13871. RealICQNetWorkDiskClient.NewDirectory('[' + Copy(UploadMission.Name, 1, 1) + ']')
  13872. else
  13873. RealICQNetWorkDiskClient.NewDirectory(ExtractFileName(UploadMission.Name));
  13874. end;
  13875. end;
  13876. end;
  13877. end;
  13878. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  13879. if FLVNetWorkDiskUploadingFiles.Items.Count = 0 then
  13880. begin
  13881. if FSavedUploadMissions.Count > 0 then
  13882. begin
  13883. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  13884. begin
  13885. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  13886. begin
  13887. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13888. Missions := TStringList(FSavedUploadMissions[FSavedUploadMissions.Count - 1]);
  13889. FSavedUploadMissions.Remove(Missions);
  13890. for iLoop := 0 to Missions.Count - 1 do
  13891. begin
  13892. UploadMission := Missions.Objects[iLoop] as TUploadMission;
  13893. AddUploadMission(UploadMission.UploadMissionType, UploadMission.DirectoryID, UploadMission.Name, False);
  13894. FreeAndNil(UploadMission);
  13895. end;
  13896. Missions.Clear;
  13897. FreeAndNil(Missions);
  13898. CheckUploadMissions;
  13899. Exit;
  13900. end;
  13901. end;
  13902. end
  13903. else
  13904. begin
  13905. RealICQNetWorkDiskClient.GetUsedSpaceSize;
  13906. end;
  13907. end;
  13908. CheckNDControlState;
  13909. end;
  13910. //------------------------------------------------------------------------------
  13911. procedure TMainForm.CheckNDControlState;
  13912. begin
  13913. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count = 0) and (FLVNetWorkDiskDownloadingFiles.Items.Count = 0) and (FSavedUploadMissions.Count = 0) and (FSavedDownloadMissions.Count = 0) then
  13914. begin
  13915. pnlNDMissions.Visible := False;
  13916. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13917. end;
  13918. spbNDMoveUp.Enabled := not pnlNDMissions.Visible;
  13919. spbNDNewDir.Enabled := not pnlNDMissions.Visible;
  13920. spbNDDelete.Enabled := not pnlNDMissions.Visible;
  13921. spbNDUpload.Enabled := not pnlNDMissions.Visible;
  13922. spbNDDownload.Enabled := not pnlNDMissions.Visible;
  13923. spbNDRefresh.Enabled := not pnlNDMissions.Visible;
  13924. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13925. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  13926. if not pnlNDMissions.Visible then
  13927. begin
  13928. FConfirmReplaceResult := -1;
  13929. FLastDownloadDirectory := '';
  13930. NDSelectItemChanged(nil);
  13931. end;
  13932. end;
  13933. //------------------------------------------------------------------------------
  13934. procedure TMainForm.AddUploadMission(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string; CheckMission: Boolean = True);
  13935. var
  13936. UploadMission: TUploadMission;
  13937. ItemIndex: Integer;
  13938. ListItem: TRealICQContacterListItem;
  13939. begin
  13940. UploadMission := TUploadMission.Create(AUploadMissionType, ADirectoryID, AName);
  13941. if FUploadMissions.IndexOf(UploadMission.ID) >= 0 then
  13942. begin
  13943. MessageBox(Handle, PChar(AName + ' 已在任务队列中!'), '提示', MB_ICONINFORMATION);
  13944. Exit;
  13945. end;
  13946. FUploadMissions.AddObject(UploadMission.ID, UploadMission);
  13947. if not pnlNDMissions.Visible then
  13948. pnlNDMissions.Visible := True;
  13949. TabSetNDMissions.TabIndex := 0;
  13950. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13951. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  13952. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(UploadMission.ID);
  13953. if ItemIndex >= 0 then
  13954. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  13955. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.Add(UploadMission.ID);
  13956. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13957. with ListItem do
  13958. begin
  13959. LoginState := stOffline;
  13960. Data := UploadMission;
  13961. DisplayName := (UploadMission.Name);
  13962. Watchword := '队列中';
  13963. if UploadMission.UploadMissionType = mtFile then
  13964. begin
  13965. try
  13966. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(UploadMission.Name));
  13967. except
  13968. end;
  13969. end;
  13970. ReDrawItem;
  13971. end;
  13972. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  13973. if CheckMission then
  13974. CheckUploadMissions;
  13975. end;
  13976. //------------------------------------------------------------------------------
  13977. procedure TMainForm.AddDownloadMission(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = ''; CheckMission: Boolean = True);
  13978. var
  13979. DownloadMission: TDownloadMission;
  13980. ItemIndex: Integer;
  13981. ListItem: TRealICQContacterListItem;
  13982. begin
  13983. DownloadMission := TDownloadMission.Create(ADownloadMissionType, ADirectoryName, AFileID, AFileName);
  13984. if not pnlNDMissions.Visible then
  13985. pnlNDMissions.Visible := True;
  13986. TabSetNDMissions.TabIndex := 1;
  13987. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13988. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  13989. ItemIndex := FLVNetWorkDiskDownloadingFiles.Items.Add(DownloadMission.ID);
  13990. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13991. with ListItem do
  13992. begin
  13993. LoginState := stOffline;
  13994. Data := DownloadMission;
  13995. Watchword := '队列中';
  13996. if DownloadMission.DownloadMissionType = mtFile then
  13997. begin
  13998. DisplayName := (DownloadMission.FileName);
  13999. try
  14000. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(DownloadMission.FileName));
  14001. except
  14002. end;
  14003. end
  14004. else
  14005. begin
  14006. DisplayName := (DownloadMission.DirectoryName);
  14007. end;
  14008. ReDrawItem;
  14009. end;
  14010. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  14011. if CheckMission then
  14012. CheckDownloadMissions;
  14013. end;
  14014. //------------------------------------------------------------------------------
  14015. procedure TMainForm.CheckDownloadMissions;
  14016. var
  14017. iLoop, jLoop: Integer;
  14018. ListItem: TRealICQContacterListItem;
  14019. DownloadMission: TDownloadMission;
  14020. ADownloadMission: TDownloadMission;
  14021. ADirectory: TRealICQNetWorkDiskDirectory;
  14022. Missions: TStringList;
  14023. begin
  14024. if FLVNetWorkDiskDownloadingFiles.OnlineNumeric = 0 then
  14025. begin
  14026. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14027. begin
  14028. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14029. DownloadMission := TDownloadMission(ListItem.Data);
  14030. if DownloadMission.DownloadMissionType = mtFile then
  14031. begin
  14032. with ListItem do
  14033. begin
  14034. LoginState := stOnline;
  14035. HasSMS := True;
  14036. Watchword := '';
  14037. SMSHint := '取消';
  14038. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14039. ReDrawItem;
  14040. end;
  14041. if FileExists(DownloadMission.FFileName) then
  14042. begin
  14043. if FConfirmReplaceResult <> mrYesToAll then
  14044. begin
  14045. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  14046. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(DownloadMission.FFileName)]);
  14047. try
  14048. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  14049. finally
  14050. FreeAndNil(ConfirmReplaceNDFileForm);
  14051. end;
  14052. end;
  14053. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  14054. begin
  14055. end
  14056. else if FConfirmReplaceResult = mrNO then
  14057. begin
  14058. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14059. FreeAndNil(DownloadMission);
  14060. CheckDownloadMissions;
  14061. Exit;
  14062. end
  14063. else if FConfirmReplaceResult = mrCancel then
  14064. begin
  14065. spbNDCancelAllClick(spbNDCancelAll);
  14066. Exit;
  14067. end;
  14068. end;
  14069. try
  14070. RealICQNetWorkDiskClient.DownloadFile(DownloadMission.FFileID, DownloadMission.FFileName);
  14071. except
  14072. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14073. FreeAndNil(DownloadMission);
  14074. CheckDownloadMissions;
  14075. Exit;
  14076. end;
  14077. end
  14078. else
  14079. begin
  14080. with ListItem do
  14081. begin
  14082. LoginState := stOnline;
  14083. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14084. ReDrawItem;
  14085. end;
  14086. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14087. begin
  14088. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14089. if AnsiSameText(ExtractFileName(ADirectory.Name), ExtractFileName(DownloadMission.DirectoryName)) then
  14090. begin
  14091. if not DirectoryExists(DownloadMission.DirectoryName) then
  14092. CreateDir(DownloadMission.DirectoryName);
  14093. FLastDownloadDirectory := DownloadMission.DirectoryName;
  14094. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14095. FreeAndNil(DownloadMission);
  14096. Missions := TStringList.Create;
  14097. for jLoop := 0 to FLVNetWorkDiskDownloadingFiles.Items.Count - 1 do
  14098. begin
  14099. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[jLoop] as TRealICQContacterListItem;
  14100. ADownloadMission := TDownloadMission(ListItem.Data);
  14101. Missions.AddObject(ADownloadMission.FID, ADownloadMission);
  14102. end;
  14103. FSavedDownloadMissions.Add(Missions);
  14104. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  14105. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14106. Exit;
  14107. end;
  14108. end;
  14109. end;
  14110. end;
  14111. end;
  14112. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  14113. if FLVNetWorkDiskDownloadingFiles.Items.Count = 0 then
  14114. begin
  14115. if FSavedDownloadMissions.Count > 0 then
  14116. begin
  14117. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  14118. begin
  14119. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  14120. begin
  14121. FLastDownloadDirectory := '';
  14122. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  14123. Missions := TStringList(FSavedDownloadMissions[FSavedDownloadMissions.Count - 1]);
  14124. FSavedDownloadMissions.Remove(Missions);
  14125. for iLoop := 0 to Missions.Count - 1 do
  14126. begin
  14127. DownloadMission := Missions.Objects[iLoop] as TDownloadMission;
  14128. AddDownloadMission(DownloadMission.DownloadMissionType, DownloadMission.DirectoryName, DownloadMission.FileID, DownloadMission.FileName, False);
  14129. FreeAndNil(DownloadMission);
  14130. end;
  14131. Missions.Clear;
  14132. FreeAndNil(Missions);
  14133. CheckDownloadMissions;
  14134. Exit;
  14135. end;
  14136. end;
  14137. end;
  14138. end;
  14139. CheckNDControlState;
  14140. end;
  14141. //------------------------------------------------------------------------------
  14142. procedure TMainForm.spbNDUploadClick(Sender: TObject);
  14143. var
  14144. iLoop: Integer;
  14145. begin
  14146. MainForm.FormStyle := fsNormal;
  14147. try
  14148. if UploadFileOpenDialog.Execute then
  14149. begin
  14150. for iLoop := 0 to UploadFileOpenDialog.Files.Count - 1 do
  14151. begin
  14152. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadFileOpenDialog.Files.Strings[iLoop], False);
  14153. end;
  14154. end;
  14155. finally
  14156. // if MainForm.AlwaysOnTop then
  14157. // MainForm.FormStyle := fsStayOnTop
  14158. // else
  14159. // MainForm.FormStyle := fsNormal;
  14160. CheckUploadMissions;
  14161. end;
  14162. end;
  14163. procedure TMainForm.spbNextClick(Sender: TObject);
  14164. var
  14165. TabSheet: TTabSheet;
  14166. WebBrowser: TWebBrowser;
  14167. begin
  14168. try
  14169. TabSheet := pgcMultiWeb.ActivePage;
  14170. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14171. if WebBrowser.Busy then
  14172. WebBrowser.Stop;
  14173. WebBrowser.GoForward;
  14174. except
  14175. end;
  14176. end;
  14177. function TMainForm.GetDefaultBrowser: string;//获取默认浏览器
  14178. var
  14179. reg: TRegistry;
  14180. begin
  14181. reg := TRegistry.Create;
  14182. try
  14183. {reg.RootKey := HKEY_CLASSES_ROOT;
  14184. reg.OpenKey('HTTP\shell\open\ddeexec\Application',false);
  14185. result:=reg.ReadString('');
  14186. reg.CloseKey; }
  14187. reg.RootKey := HKEY_CLASSES_ROOT;
  14188. reg.OpenKey('http\\shell\\open\\command', false);
  14189. result := reg.ReadString('');
  14190. result := Copy(result, Pos('"', result) + 1, Length(result) - 1);
  14191. result := Copy(result, 1, Pos('"', result) - 1);
  14192. reg.CloseKey;
  14193. finally
  14194. if (result = '') then
  14195. result := 'IEXPLORE.EXE';
  14196. reg.Free;
  14197. end;
  14198. end;
  14199. //---用户自助管理平台--------------------------------------
  14200. procedure TMainForm.spbPersonManageClick(Sender: TObject);
  14201. //var
  14202. // EncryptStr,
  14203. // Md5Pwd,
  14204. // Url,
  14205. // TmpStr:String;
  14206. begin
  14207. //Md5Pwd:=Md5En(RealICQClient.Password);
  14208. //TmpStr:='{'+RealICQClient.Me.LoginName+'}{'+Md5Pwd+'}';
  14209. //EncryptStr:=StrToBase64(Encrypt(TmpStr,'B77A5C561934E089'));
  14210. //Url:=RealICQClient.PersonManageUrl+'?'+ EncryptStr;
  14211. // ShellExecute(handle,'open', 'IEXPLORE.EXE', 'http://www.baidu.com', nil,SW_SHOWNORMAL);//
  14212. // ShellExecute(handle, 'open','http://220.191.210.103:8080/Default.aspx?url=', '','',SW_SHOWDEFAULT);
  14213. //MessageBox(Handle, PChar(RealICQClient.WebAppBaseURL), '提示', MB_ICONQUESTION);
  14214. //MessageBox(Handle, PChar(LoginURL), '提示', MB_ICONQUESTION);
  14215. //ShellExecute(handle, 'open', PChar(GetDefaultBrowser),PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), ''])), '',SW_SHOWDEFAULT);
  14216. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(LoginURL)])), '', SW_SHOWDEFAULT);
  14217. end;
  14218. procedure TMainForm.spbPrevClick(Sender: TObject);
  14219. var
  14220. TabSheet: TTabSheet;
  14221. WebBrowser: TWebBrowser;
  14222. begin
  14223. try
  14224. TabSheet := pgcMultiWeb.ActivePage;
  14225. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14226. if WebBrowser.Busy then
  14227. WebBrowser.Stop;
  14228. WebBrowser.GoBack;
  14229. except
  14230. end;
  14231. end;
  14232. procedure TMainForm.spbPrintPrevClick(Sender: TObject);
  14233. var
  14234. TabSheet: TTabSheet;
  14235. WebBrowser: TWebBrowser;
  14236. begin
  14237. MainForm.FormStyle := fsNormal;
  14238. try
  14239. try
  14240. TabSheet := pgcMultiWeb.ActivePage;
  14241. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14242. if WebBrowser.QueryStatusWB(OLECMDID_PRINTPREVIEW) = 3 then
  14243. WebBrowser.ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT, EmptyParam, EmptyParam);
  14244. except
  14245. end;
  14246. finally
  14247. // if MainForm.AlwaysOnTop then
  14248. // MainForm.FormStyle := fsStayOnTop
  14249. // else
  14250. // MainForm.FormStyle := fsNormal;
  14251. end;
  14252. end;
  14253. procedure TMainForm.spbRefreshBranchUsersClick(Sender: TObject);
  14254. begin
  14255. //
  14256. {TimerForGetBranchOnlineStates.Enabled := False;
  14257. TimerForGetBranchOnlineStates.Enabled := True;}
  14258. miChangeServerClick(nil);
  14259. TimerForGetBranchUsersOnlineStates.Enabled := False;
  14260. TimerForGetBranchUsersOnlineStates.Enabled := True;
  14261. end;
  14262. procedure TMainForm.spbRefreshClick(Sender: TObject);
  14263. var
  14264. TabSheet: TTabSheet;
  14265. WebBrowser: TWebBrowser;
  14266. begin
  14267. try
  14268. TabSheet := pgcMultiWeb.ActivePage;
  14269. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14270. if WebBrowser.Busy then
  14271. WebBrowser.Stop;
  14272. WebBrowser.Refresh;
  14273. except
  14274. end;
  14275. end;
  14276. //------------------------------------------------------------------------------
  14277. procedure TMainForm.RealICQNetWorkDiskClientNewDirResult(Sender: TObject; Directory: TRealICQNetWorkDiskDirectory);
  14278. var
  14279. ItemIndex: Integer;
  14280. ListItem: TRealICQContacterListItem;
  14281. UploadMission: TUploadMission;
  14282. NDDirName: string;
  14283. begin
  14284. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14285. begin
  14286. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14287. UploadMission := TUploadMission(ListItem.Data);
  14288. if UploadMission.UploadMissionType = mtDir then
  14289. begin
  14290. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14291. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14292. else
  14293. NDDirName := ExtractFileName(UploadMission.Name);
  14294. if AnsiSameText(NDDirName, Directory.Name) and (Directory.ParentID = UploadMission.DirectoryID) then
  14295. begin
  14296. RealICQNetWorkDiskClient.GetDirectory(Directory);
  14297. Exit;
  14298. end;
  14299. end;
  14300. end;
  14301. if Directory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14302. Exit;
  14303. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(Directory.ID));
  14304. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14305. with ListItem do
  14306. begin
  14307. LoginState := stOnline;
  14308. Data := Directory;
  14309. DisplayName := Directory.Name;
  14310. ReDrawItem;
  14311. end;
  14312. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14313. end;
  14314. //------------------------------------------------------------------------------
  14315. procedure TMainForm.RealICQNetWorkDiskClientNoSpace(Sender: TObject);
  14316. begin
  14317. ShowNetWorkDiskSpaceInfo;
  14318. spbNDCancelAllClick(spbNDCancelAll);
  14319. MessageBox(Handle, '抱歉!您的网络硬盘空间不足,任务已取消!', '提示', MB_ICONINFORMATION);
  14320. end;
  14321. //------------------------------------------------------------------------------
  14322. procedure TMainForm.RealICQNetWorkDiskClientRenamedDir(Sender: TObject; ADirectory: TRealICQNetWorkDiskDirectory);
  14323. var
  14324. ItemIndex: Integer;
  14325. ListItem: TRealICQContacterListItem;
  14326. begin
  14327. FLVNetWorkDisk.AdjustPosition := False;
  14328. try
  14329. if ADirectory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14330. Exit;
  14331. ItemIndex := FLVNetWorkDisk.Items.IndexOf('D' + IntToStr(ADirectory.ID));
  14332. if ItemIndex < 0 then
  14333. Exit;
  14334. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14335. with ListItem do
  14336. begin
  14337. LoginState := stOnline;
  14338. Data := ADirectory;
  14339. DisplayName := ADirectory.Name;
  14340. ReDrawItem;
  14341. end;
  14342. finally
  14343. FLVNetWorkDisk.AdjustPosition := True;
  14344. end;
  14345. end;
  14346. //------------------------------------------------------------------------------
  14347. procedure TMainForm.RealICQNetWorkDiskClientRenamedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile);
  14348. var
  14349. ItemIndex: Integer;
  14350. ListItem: TRealICQContacterListItem;
  14351. begin
  14352. FLVNetWorkDisk.AdjustPosition := False;
  14353. try
  14354. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14355. Exit;
  14356. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14357. if ItemIndex < 0 then
  14358. Exit;
  14359. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14360. with ListItem do
  14361. begin
  14362. LoginState := stLeave;
  14363. Data := AFile;
  14364. DisplayName := AFile.Name;
  14365. try
  14366. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14367. except
  14368. end;
  14369. ReDrawItem;
  14370. end;
  14371. finally
  14372. FLVNetWorkDisk.AdjustPosition := True;
  14373. end;
  14374. end;
  14375. //------------------------------------------------------------------------------
  14376. procedure TMainForm.RealICQNetWorkDiskClientUploadedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile; AMissionID: string);
  14377. var
  14378. iLoop: Integer;
  14379. ItemIndex: Integer;
  14380. ListItem: TRealICQContacterListItem;
  14381. UploadMission: TUploadMission;
  14382. AFile1: TRealICQNetWorkDiskFile;
  14383. Finded: Boolean;
  14384. begin
  14385. try
  14386. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14387. if ItemIndex >= 0 then
  14388. begin
  14389. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14390. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14391. UploadMission := TUploadMission(ListItem.Data);
  14392. FreeAndNil(UploadMission);
  14393. end;
  14394. FLVNetWorkDisk.AdjustPosition := False;
  14395. try
  14396. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14397. Exit;
  14398. Finded := False;
  14399. ListItem := nil;
  14400. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14401. begin
  14402. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14403. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14404. begin
  14405. AFile1 := TRealICQNetWorkDiskFile(ListItem.Data);
  14406. if AnsiSameText(AFile1.Name, AFile.Name) then
  14407. begin
  14408. Finded := True;
  14409. Break;
  14410. end;
  14411. end;
  14412. end;
  14413. if not Finded then
  14414. begin
  14415. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14416. if ItemIndex >= 0 then
  14417. begin
  14418. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14419. Finded := True;
  14420. end;
  14421. end;
  14422. if not Finded then
  14423. begin
  14424. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14425. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14426. end;
  14427. with ListItem do
  14428. begin
  14429. LoginState := stLeave;
  14430. Data := AFile;
  14431. DisplayName := AFile.Name;
  14432. if AFile.Size >= 1024 * 1024 then
  14433. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14434. else if AFile.Size >= 1024 then
  14435. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14436. else
  14437. Watchword := IntToStr(AFile.Size) + 'B';
  14438. try
  14439. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14440. except
  14441. end;
  14442. ReDrawItem;
  14443. end;
  14444. finally
  14445. FLVNetWorkDisk.AdjustPosition := True;
  14446. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14447. ShowNetWorkDiskSpaceInfo;
  14448. end;
  14449. finally
  14450. CheckUploadMissions;
  14451. end;
  14452. end;
  14453. //------------------------------------------------------------------------------
  14454. procedure TMainForm.RealICQNetWorkDiskClientUploadFileAborted(Sender: TObject; AMissionID: string);
  14455. var
  14456. ItemIndex: Integer;
  14457. ListItem: TRealICQContacterListItem;
  14458. UploadMission: TUploadMission;
  14459. begin
  14460. try
  14461. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14462. if ItemIndex >= 0 then
  14463. begin
  14464. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14465. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14466. UploadMission := TUploadMission(ListItem.Data);
  14467. FreeAndNil(UploadMission);
  14468. end;
  14469. finally
  14470. CheckUploadMissions;
  14471. end;
  14472. end;
  14473. //------------------------------------------------------------------------------
  14474. procedure TMainForm.RealICQNetWorkDiskClientUploadingFile(Sender: TObject; ATransmitter: TResponsionStreamTransmitter; ATransmittedSize: Int64);
  14475. var
  14476. ItemIndex: Integer;
  14477. ListItem: TRealICQContacterListItem;
  14478. Completed: Integer;
  14479. ASpeed: Cardinal;
  14480. SpeedStr: string;
  14481. begin
  14482. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf((ATransmitter as TNetWorkFileTransmitter).MissionID);
  14483. if ItemIndex >= 0 then
  14484. begin
  14485. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14486. with ListItem do
  14487. begin
  14488. Completed := ATransmittedSize * 100 div ATransmitter.StreamLength;
  14489. try
  14490. ASpeed := Round(ATransmittedSize div ((GetTickCount - ATransmitter.StartTicket) div 1000) * 1.2);
  14491. except
  14492. Exit;
  14493. end;
  14494. if ASpeed > 1000 * 1000 then
  14495. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14496. else if ASpeed > 1000 then
  14497. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14498. else
  14499. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14500. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14501. DisplayName := DisplayName + ((ATransmitter as TNetWorkFileTransmitter).FileName);
  14502. ReDrawItem;
  14503. end;
  14504. end;
  14505. end;
  14506. function ServiceGetStatus(sMachine, sService: string): DWord;
  14507. var
  14508. //service control
  14509. //manager handle
  14510. schm,
  14511. //service handle
  14512. schs: SC_Handle;
  14513. //service status
  14514. ss: TServiceStatus;
  14515. //current service status
  14516. dwStat: DWord;
  14517. begin
  14518. dwStat := 0;
  14519. //connect to the service
  14520. //control manager
  14521. schm := OpenSCManager(pchar(sMachine), Nil, SC_MANAGER_CONNECT);
  14522. //if successful...
  14523. if (schm > 0) then
  14524. begin
  14525. //open a handle to
  14526. //the specified service
  14527. schs := OpenService(schm, PChar(sService), SERVICE_QUERY_STATUS);
  14528. //if successful...
  14529. if (schs > 0) then
  14530. begin
  14531. //retrieve the current status
  14532. //of the specified service
  14533. if (QueryServiceStatus(schs, ss)) then
  14534. begin
  14535. dwStat := ss.dwCurrentState;
  14536. end;
  14537. //close service handle
  14538. CloseServiceHandle(schs);
  14539. end;
  14540. // close service control
  14541. // manager handle
  14542. CloseServiceHandle(schm);
  14543. end;
  14544. Result := dwStat;
  14545. end;
  14546. function ServiceUninstalled(sMachine, sService: string): boolean;
  14547. begin
  14548. Result := 0 = ServiceGetStatus(sMachine, sService);
  14549. end;
  14550. //------------------------------------------------------------------------------
  14551. //调用360杀毒软件
  14552. //------------------------------------------------------------------------------
  14553. procedure TMainForm.spb360SDClick(Sender: TObject);
  14554. begin
  14555. //
  14556. end;
  14557. //------------------------------------------------------------------------------
  14558. //调用360安全卫士
  14559. //------------------------------------------------------------------------------
  14560. procedure TMainForm.spb360SafeClick(Sender: TObject);
  14561. var
  14562. URL: string;
  14563. TempReg: TRegistry;
  14564. safePath: string;
  14565. begin
  14566. URL := 'http://' + self.RealICQClient.RemoteAddress + '/client/setup.exe';
  14567. try
  14568. TempReg := TRegistry.Create;
  14569. try
  14570. TempReg.RootKey := HKEY_LOCAL_MACHINE;
  14571. if not TempReg.OpenKey('\Software\360Safe\menuext\LiveUpdate360', False) then
  14572. //DownloadUpdate(URL)
  14573. else
  14574. begin
  14575. safePath := ExtractFilePath(TempReg.ReadString('Application'));
  14576. //WinExec(PChar(safePath+'\360Safe.exe'),SW_SHOW);
  14577. end;
  14578. finally
  14579. TempReg.Free;
  14580. end;
  14581. except
  14582. end;
  14583. end;
  14584. //------------------------------------------------------------------------------
  14585. procedure TMainForm.spbNDDeleteClick(Sender: TObject);
  14586. var
  14587. ListItem: TRealICQContacterListItem;
  14588. iLoop: Integer;
  14589. AList: string;
  14590. begin
  14591. if FLVNetWorkDisk.SelCount <= 0 then
  14592. Exit;
  14593. if (GetKeyState(VK_Shift) and - 128) = 0 then
  14594. begin
  14595. if MessageBox(Handle, '确认要删除选中的文件吗?', '提示', MB_ICONQUESTION or MB_OKCANCEL) <> ID_OK then
  14596. Exit;
  14597. end;
  14598. AList := '';
  14599. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14600. begin
  14601. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14602. if ListItem.Selected then
  14603. begin
  14604. AList := AList + ListItem.LoginName + Chr(10);
  14605. end;
  14606. if Length(AList) >= 1024 then
  14607. begin
  14608. RealICQNetWorkDiskClient.Delete(AList);
  14609. AList := '';
  14610. Sleep(1000);
  14611. end;
  14612. end;
  14613. if Length(AList) > 0 then
  14614. RealICQNetWorkDiskClient.Delete(AList);
  14615. end;
  14616. //------------------------------------------------------------------------------
  14617. procedure TMainForm.spbNDDisconnectClick(Sender: TObject);
  14618. begin
  14619. RealICQNetWorkDiskClient.Logout;
  14620. end;
  14621. //------------------------------------------------------------------------------
  14622. procedure TMainForm.spbNDDownloadClick(Sender: TObject);
  14623. var
  14624. iLoop: Integer;
  14625. ListItem: TRealICQContacterListItem;
  14626. Dir: string;
  14627. AFile: TRealICQNetWorkDiskFile;
  14628. ADirectory: TRealICQNetWorkDiskDirectory;
  14629. begin
  14630. if FLVNetWorkDisk.SelCount = 0 then
  14631. Exit;
  14632. if FLVNetWorkDisk.SelCount = 1 then
  14633. begin
  14634. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14635. begin
  14636. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14637. if ListItem.Selected then
  14638. begin
  14639. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14640. begin
  14641. NDItemDoubleClick(ListItem);
  14642. Exit;
  14643. end;
  14644. end;
  14645. end;
  14646. end;
  14647. MainForm.FormStyle := fsNormal;
  14648. try
  14649. if SelectDirectory('请选择目录', '', Dir) then
  14650. begin
  14651. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14652. begin
  14653. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14654. if ListItem.Selected then
  14655. begin
  14656. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14657. begin
  14658. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14659. AddDownloadMission(mtDir, Dir + '\' + ADirectory.Name, 0, '', False);
  14660. end
  14661. else
  14662. begin
  14663. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14664. AddDownloadMission(mtFile, ExtractFilePath(Dir), AFile.ID, Dir + '\' + AFile.Name, False);
  14665. end;
  14666. end;
  14667. end; //for
  14668. CheckDownloadMissions;
  14669. end;
  14670. finally
  14671. // if MainForm.AlwaysOnTop then
  14672. // MainForm.FormStyle := fsStayOnTop
  14673. // else
  14674. // MainForm.FormStyle := fsNormal;
  14675. end;
  14676. end;
  14677. //------------------------------------------------------------------------------
  14678. procedure TMainForm.NDItemDoubleClick(Item: TRealICQContacterListItem);
  14679. var
  14680. AFile: TRealICQNetWorkDiskFile;
  14681. ADirectory: TRealICQNetWorkDiskDirectory;
  14682. begin
  14683. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  14684. begin
  14685. Exit;
  14686. end;
  14687. if Copy(Item.LoginName, 1, 1) = 'D' then
  14688. begin
  14689. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  14690. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14691. end
  14692. else if Copy(Item.LoginName, 1, 1) = 'F' then
  14693. begin
  14694. AFile := TRealICQNetWorkDiskFile(Item.Data);
  14695. MainForm.FormStyle := fsNormal;
  14696. try
  14697. DownloadFileSaveDialog.FileName := AFile.Name;
  14698. if DownloadFileSaveDialog.Execute then
  14699. begin
  14700. AddDownloadMission(mtFile, ExtractFilePath(DownloadFileSaveDialog.FileName), AFile.ID, DownloadFileSaveDialog.FileName, True);
  14701. end;
  14702. finally
  14703. // if MainForm.AlwaysOnTop then
  14704. // MainForm.FormStyle := fsStayOnTop
  14705. // else
  14706. // MainForm.FormStyle := fsNormal;
  14707. end;
  14708. end;
  14709. end;
  14710. //------------------------------------------------------------------------------
  14711. procedure TMainForm.RealICQNetWorkDiskClientDeleteResult(Sender: TObject; AList: string);
  14712. var
  14713. AStringList: TStringList;
  14714. iLoop, iIndex: Integer;
  14715. begin
  14716. AStringList := SplitString(AList, Chr(10));
  14717. FLVNetWorkDisk.DisableAlign;
  14718. try
  14719. for iLoop := 0 to AStringList.Count - 1 do
  14720. begin
  14721. iIndex := FLVNetWorkDisk.Items.IndexOf(AStringList.Strings[iLoop]);
  14722. if iIndex >= 0 then
  14723. FLVNetWorkDisk.Items.Delete(iIndex);
  14724. end;
  14725. finally
  14726. FLVNetWorkDisk.EnableAlign;
  14727. FreeAndNil(AStringList);
  14728. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14729. ShowNetWorkDiskSpaceInfo;
  14730. NDSelectItemChanged(nil);
  14731. end;
  14732. end;
  14733. //------------------------------------------------------------------------------
  14734. procedure TMainForm.RealICQNetWorkDiskClientDirectoryListReady(Sender: TObject);
  14735. var
  14736. iLoop, ItemIndex: Integer;
  14737. AFile: TRealICQNetWorkDiskFile;
  14738. ADirectory: TRealICQNetWorkDiskDirectory;
  14739. ListItem: TRealICQContacterListItem;
  14740. Bitmap: TBitmap;
  14741. UploadMission: TUploadMission;
  14742. NDDirName: string;
  14743. begin
  14744. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  14745. edNDDir.Text := '';
  14746. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory;
  14747. while ADirectory <> nil do
  14748. begin
  14749. edNDDir.Text := ADirectory.Name + '\' + edNDDir.Text;
  14750. ADirectory := ADirectory.Parent;
  14751. end;
  14752. try
  14753. FLVNetWorkDisk.AdjustPosition := False;
  14754. FLVNetWorkDisk.DisableAlign;
  14755. FLVNetWorkDisk.Items.Clear;
  14756. NDSelectItemChanged(nil);
  14757. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14758. begin
  14759. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14760. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(ADirectory.ID));
  14761. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14762. with ListItem do
  14763. begin
  14764. LoginState := stOnline;
  14765. Data := ADirectory;
  14766. DisplayName := ADirectory.Name;
  14767. end;
  14768. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, 0, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14769. lblNDState.Update;
  14770. end;
  14771. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 do
  14772. begin
  14773. AFile := TRealICQNetWorkDiskFile(RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop]);
  14774. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14775. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14776. with ListItem do
  14777. begin
  14778. LoginState := stLeave;
  14779. Data := AFile;
  14780. DisplayName := AFile.Name;
  14781. if AFile.Size >= 1024 * 1024 then
  14782. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14783. else if AFile.Size >= 1024 then
  14784. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14785. else
  14786. Watchword := IntToStr(AFile.Size) + 'B';
  14787. try
  14788. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14789. except
  14790. end;
  14791. FreeAndNil(Bitmap);
  14792. end;
  14793. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14794. lblNDState.Update;
  14795. end;
  14796. finally
  14797. FLVNetWorkDisk.ReDrawAll;
  14798. FLVNetWorkDisk.EnableAlign;
  14799. FLVNetWorkDisk.AdjustPosition := True;
  14800. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14801. end;
  14802. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14803. begin
  14804. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14805. UploadMission := TUploadMission(ListItem.Data);
  14806. if UploadMission.UploadMissionType = mtDir then
  14807. begin
  14808. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14809. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14810. else
  14811. NDDirName := ExtractFileName(UploadMission.Name);
  14812. if AnsiSameText(NDDirName, RealICQNetWorkDiskClient.CurrentDirectory.Name) and (RealICQNetWorkDiskClient.CurrentDirectory.ParentID = UploadMission.DirectoryID) then
  14813. begin
  14814. try
  14815. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  14816. except
  14817. end;
  14818. try
  14819. GoNextLevelUploadMissions(UploadMission);
  14820. finally
  14821. FreeAndNil(UploadMission);
  14822. end;
  14823. Exit;
  14824. end;
  14825. end;
  14826. end;
  14827. if Length(Trim(FLastDownloadDirectory)) > 0 then
  14828. begin
  14829. if (DirectoryExists(FLastDownloadDirectory)) then
  14830. begin
  14831. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14832. begin
  14833. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14834. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14835. begin
  14836. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14837. AddDownloadMission(mtDir, FLastDownloadDirectory + '\' + ADirectory.Name, 0, '', False);
  14838. end
  14839. else
  14840. begin
  14841. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14842. AddDownloadMission(mtFile, ExtractFilePath(FLastDownloadDirectory), AFile.ID, FLastDownloadDirectory + '\' + AFile.Name, False);
  14843. end;
  14844. end; //for
  14845. CheckDownloadMissions;
  14846. end;
  14847. end;
  14848. end;
  14849. //------------------------------------------------------------------------------
  14850. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileAborted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14851. begin
  14852. end;
  14853. //------------------------------------------------------------------------------
  14854. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileCompleted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14855. var
  14856. ListItem: TRealICQContacterListItem;
  14857. DownloadMission: TDownloadMission;
  14858. MessageBoxResult: Integer;
  14859. begin
  14860. if not RealICQNetWorkDiskClient.Connected then
  14861. Exit;
  14862. try
  14863. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14864. begin
  14865. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14866. DownloadMission := TDownloadMission(ListItem.Data);
  14867. if DownloadMission.FFileID = AFileDownloader.FileID then
  14868. begin
  14869. if not AFileDownloader.Completed then
  14870. begin
  14871. if AFileDownloader.Exp <> nil then
  14872. begin
  14873. MessageBoxResult := MessageBox(Handle, PChar('下载文件时出错:'#$D#$A#$D#$A + AFileDownloader.Exp.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  14874. if MessageBoxResult = ID_ABORT then
  14875. begin
  14876. spbNDCancelAllClick(spbNDCancelAll);
  14877. Exit;
  14878. end
  14879. else if MessageBoxResult = ID_RETRY then
  14880. begin
  14881. CheckDownloadMissions;
  14882. Exit;
  14883. end
  14884. else if MessageBoxResult = ID_IGNORE then
  14885. begin
  14886. end;
  14887. end;
  14888. end;
  14889. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14890. FreeAndNil(DownloadMission);
  14891. end;
  14892. end;
  14893. except
  14894. end;
  14895. CheckDownloadMissions;
  14896. end;
  14897. //------------------------------------------------------------------------------
  14898. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileTransmitting(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14899. var
  14900. ListItem: TRealICQContacterListItem;
  14901. Completed: Integer;
  14902. ASpeed: Cardinal;
  14903. SpeedStr: string;
  14904. begin
  14905. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14906. begin
  14907. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14908. with ListItem do
  14909. begin
  14910. Completed := AFileDownloader.RecvedSize * 100 div AFileDownloader.FileSize;
  14911. try
  14912. ASpeed := Round(AFileDownloader.RecvedSize div ((GetTickCount - AFileDownloader.StartTicket) div 1000) * 1.2);
  14913. except
  14914. Exit;
  14915. end;
  14916. if ASpeed > 1000 * 1000 then
  14917. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14918. else if ASpeed > 1000 then
  14919. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14920. else
  14921. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14922. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14923. DisplayName := DisplayName + (AFileDownloader.LocalFileName);
  14924. ReDrawItem;
  14925. end;
  14926. end;
  14927. end;
  14928. //------------------------------------------------------------------------------
  14929. procedure TMainForm.RealICQNetWorkDiskClientGettedUsedSpaceSize(Sender: TObject);
  14930. begin
  14931. ShowNetWorkDiskSpaceInfo;
  14932. end;
  14933. //------------------------------------------------------------------------------
  14934. procedure TMainForm.RealICQNetWorkDiskClientLoginFailed(Sender: TObject; E: Exception);
  14935. begin
  14936. lblNDState.Caption := '连接失败(' + E.Message + ')';
  14937. end;
  14938. //------------------------------------------------------------------------------
  14939. procedure TMainForm.RealICQNetWorkDiskClientLoginResult(Sender: TObject; LoginResultType: Byte);
  14940. begin
  14941. if LoginResultType = 0 then
  14942. begin
  14943. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory);
  14944. end
  14945. else if LoginResultType = 1 then
  14946. begin
  14947. lblNDState.Caption := '连接失败,服务器版本错误';
  14948. end
  14949. else if LoginResultType = 2 then
  14950. begin
  14951. lblNDState.Caption := '连接失败,用户验证错误';
  14952. end;
  14953. end;
  14954. //------------------------------------------------------------------------------
  14955. procedure TMainForm.RealICQClientBeDropped(Sender: TObject; Excuse: string);
  14956. begin
  14957. MessageBox(Handle, PChar(Excuse), '你已被强制下线', MB_ICONINFORMATION or MB_OK);
  14958. TTeamsAdapter.Stop;
  14959. end;
  14960. //------------------------------------------------------------------------------
  14961. procedure TMainForm.RealICQClientDownloadFile(Sender: TObject; AFileName: string);
  14962. var
  14963. iLoop: Integer;
  14964. WebPanel: TWebPanel;
  14965. TabSheet: TTabSheet;
  14966. Bitmap: TBitmap;
  14967. begin
  14968. for iLoop := 0 to FWebTabs.Count - 1 do
  14969. begin
  14970. TabSheet := FWebTabs[iLoop];
  14971. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  14972. if AnsiSameText(WebPanel.Image, AFileName) then
  14973. begin
  14974. Bitmap := TBitmap.Create;
  14975. try
  14976. try
  14977. Bitmap.LoadFromFile(AFileName);
  14978. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  14979. ImgLstPageControl.Add(Bitmap, Bitmap);
  14980. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  14981. except
  14982. end;
  14983. finally
  14984. FreeAndNil(Bitmap);
  14985. end;
  14986. end;
  14987. end;
  14988. end;
  14989. //------------------------------------------------------------------------------
  14990. procedure TMainForm.RealICQClientDownloadTeamFace(Sender: TObject; AFileName: string);
  14991. begin
  14992. ShowGettedFace(AFileName);
  14993. end;
  14994. //------------------------------------------------------------------------------
  14995. procedure TMainForm.RealICQClientLoginFailed(Sender: TObject; E: Exception);
  14996. begin
  14997. TimerForLogining.Enabled := False;
  14998. SetUIState;
  14999. MessageBox(Handle, PChar('抱歉,您现在无法登录至服务器: ' + E.Message), '登录失败', MB_ICONINFORMATION or MB_OK);
  15000. end;
  15001. //------------------------------------------------------------------------------
  15002. procedure TMainForm.actShowLoginNameExecute(Sender: TObject);
  15003. var
  15004. iLoop: Integer;
  15005. RealICQContacterListView: TRealICQContacterListView;
  15006. RealICQContacterTreeView: TRealICQContacterTreeView;
  15007. begin
  15008. for iLoop := 0 to FContacterListViews.Count - 1 do
  15009. begin
  15010. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15011. RealICQContacterListView.CaptionStyle := csLoginName;
  15012. end;
  15013. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15014. begin
  15015. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15016. RealICQContacterTreeView.CaptionStyle := csLoginName;
  15017. RealICQContacterTreeView.ReDrawAll;
  15018. end;
  15019. FLVCaptionStyle := csLoginName;
  15020. SaveStyleConfigs;
  15021. end;
  15022. //------------------------------------------------------------------------------
  15023. procedure TMainForm.actShowDisplayNameExecute(Sender: TObject);
  15024. var
  15025. iLoop: Integer;
  15026. RealICQContacterListView: TRealICQContacterListView;
  15027. RealICQContacterTreeView: TRealICQContacterTreeView;
  15028. begin
  15029. for iLoop := 0 to FContacterListViews.Count - 1 do
  15030. begin
  15031. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15032. RealICQContacterListView.CaptionStyle := csDisplayName;
  15033. end;
  15034. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15035. begin
  15036. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15037. RealICQContacterTreeView.CaptionStyle := csDisplayName;
  15038. RealICQContacterTreeView.ReDrawAll;
  15039. end;
  15040. FLVCaptionStyle := csDisplayName;
  15041. SaveStyleConfigs;
  15042. end;
  15043. //------------------------------------------------------------------------------
  15044. procedure TMainForm.actShowGIFInMailFormExecute(Sender: TObject);
  15045. begin
  15046. actShowGIFInMailForm.Checked := not actShowGIFInMailForm.Checked;
  15047. FShowGIFInMailForm := actShowGIFInMailForm.Checked;
  15048. SaveStyleConfigs;
  15049. if RealICQClient.Me = nil then
  15050. Exit;
  15051. if RealICQClient.Me.HeadImageFileType = htGIF then
  15052. begin
  15053. ShowMeInformation;
  15054. end;
  15055. end;
  15056. //------------------------------------------------------------------------------
  15057. procedure TMainForm.actShowGIFInTalkingFormExecute(Sender: TObject);
  15058. begin
  15059. actShowGIFInTalkingForm.Checked := not actShowGIFInTalkingForm.Checked;
  15060. FShowGIFInTalkingForm := actShowGIFInTalkingForm.Checked;
  15061. SaveStyleConfigs;
  15062. UpdateAllTakingFormGIFHeadImage;
  15063. end;
  15064. //------------------------------------------------------------------------------
  15065. procedure TMainForm.actShowGroupExecute(Sender: TObject);
  15066. begin
  15067. FShowGroup := not FShowGroup;
  15068. actShowGroup.Checked := FShowGroup;
  15069. SaveIfShowGroupConfig;
  15070. ShowGroupInterface;
  15071. end;
  15072. //------------------------------------------------------------------------------
  15073. function TMainForm.GetSelectedLoginName: string;
  15074. var
  15075. GroupIndex, iLoop: Integer;
  15076. GroupName: string;
  15077. ListView: TRealICQContacterListView;
  15078. ListItem: TRealICQContacterListItem;
  15079. ItemIndex: Integer;
  15080. RealICQFriendTreeView: TRealICQContacterTreeView;
  15081. RealICQContacterTreeView: TRealICQContacterTreeView;
  15082. Employee: TRealICQEmployee;
  15083. Friend: TRealICQEmployee;
  15084. begin
  15085. Result := '';
  15086. if FSearchListViewInVisible then
  15087. begin
  15088. for iLoop := 0 to FSearchListView.Items.Count - 1 do
  15089. begin
  15090. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15091. if ListItem.Selected then
  15092. begin
  15093. Result := ListItem.LoginName;
  15094. Exit;
  15095. end;
  15096. end;
  15097. end;
  15098. GroupName := GetActiveTabSheetName;
  15099. if GroupName = LVMyContacters then
  15100. begin
  15101. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  15102. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15103. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15104. if Employee <> nil then
  15105. begin
  15106. Result := Employee.LoginName;
  15107. end;
  15108. Exit;
  15109. end;
  15110. if GroupName = LVMoreUsers then
  15111. begin
  15112. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  15113. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15114. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15115. if Employee <> nil then
  15116. begin
  15117. Result := Employee.LoginName;
  15118. end;
  15119. Exit;
  15120. end;
  15121. if GroupName = LVFriends then
  15122. begin
  15123. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  15124. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15125. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  15126. if Friend <> nil then
  15127. begin
  15128. Result := Friend.LoginName;
  15129. end;
  15130. Exit;
  15131. end;
  15132. GroupIndex := FContacterListViews.IndexOf(GroupName);
  15133. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  15134. for iLoop := 0 to ListView.Items.Count - 1 do
  15135. begin
  15136. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15137. if ListItem.Selected then
  15138. begin
  15139. Result := ListItem.LoginName;
  15140. Break;
  15141. end;
  15142. end;
  15143. end;
  15144. //------------------------------------------------------------------------------
  15145. procedure TMainForm.actShowHistoryExecute(Sender: TObject);
  15146. var
  15147. LoginName: string;
  15148. begin
  15149. LoginName := GetSelectedLoginName;
  15150. if LoginName <> '' then
  15151. begin
  15152. OpenMessagesManagerForm;
  15153. Application.ProcessMessages;
  15154. MessagesManagerForm.ShowUsersMessages(LoginName);
  15155. end;
  15156. end;
  15157. //------------------------------------------------------------------------------
  15158. procedure TMainForm.actSeeInformationExecute(Sender: TObject);
  15159. var
  15160. LoginName: string;
  15161. begin
  15162. LoginName := GetSelectedLoginName;
  15163. if LoginName <> '' then
  15164. begin
  15165. SeeUserInformation(LoginName);
  15166. end;
  15167. end;
  15168. //------------------------------------------------------------------------------
  15169. procedure TMainForm.actChangeRemarkExecute(Sender: TObject);
  15170. var
  15171. LoginName: string;
  15172. Remark: string;
  15173. RealICQUser: TRealICQUser;
  15174. begin
  15175. LoginName := GetSelectedLoginName;
  15176. if LoginName <> '' then
  15177. begin
  15178. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  15179. if RealICQUser = nil then
  15180. Exit;
  15181. if (RealICQUser.LoginName = RealICQClient.Me.LoginName) then
  15182. begin
  15183. ShowMessage('不允许修改自己的备注名称!');
  15184. Exit;
  15185. end;
  15186. Remark := RealICQUser.Remark;
  15187. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  15188. if not AnsiSameStr(Remark, RealICQUser.Remark) then
  15189. RealICQClient.ChangeRemark(LoginName, Remark);
  15190. end;
  15191. end;
  15192. //------------------------------------------------------------------------------
  15193. procedure TMainForm.actSendMessageExecute(Sender: TObject);
  15194. var
  15195. LoginName: string;
  15196. begin
  15197. LoginName := GetSelectedLoginName;
  15198. if LoginName <> '' then
  15199. begin
  15200. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  15201. begin
  15202. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  15203. Exit;
  15204. end;
  15205. //----------------------------------------
  15206. {if GetActiveTabSheetName=MoreUser then
  15207. begin
  15208. RealICQClient.GetUserInformation(LoginName,True);
  15209. end;}
  15210. OpenTalkingForm(LoginName);
  15211. end;
  15212. end;
  15213. //------------------------------------------------------------------------------
  15214. procedure TMainForm.actSendTeamMessageExecute(Sender: TObject);
  15215. var
  15216. iLoop: Integer;
  15217. ListItem: TRealICQContacterListItem;
  15218. RealICQTeam: TRealICQTeam;
  15219. begin
  15220. if FLVTeams.SelCount = 1 then
  15221. begin
  15222. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15223. begin
  15224. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15225. if ListItem.Selected then
  15226. begin
  15227. RealICQTeam := ListItem.Data;
  15228. OpenTeamTalkingForm(RealICQTeam.TeamID);
  15229. Break;
  15230. end;
  15231. end;
  15232. end;
  15233. end;
  15234. //------------------------------------------------------------------------------
  15235. procedure TMainForm.actSeeTeamInformationExecute(Sender: TObject);
  15236. var
  15237. iLoop: Integer;
  15238. ListItem: TRealICQContacterListItem;
  15239. RealICQTeam: TRealICQTeam;
  15240. begin
  15241. if FLVTeams.SelCount = 1 then
  15242. begin
  15243. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15244. begin
  15245. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15246. if ListItem.Selected then
  15247. begin
  15248. RealICQTeam := ListItem.Data;
  15249. OpenTeamOptionsForm(RealICQTeam);
  15250. Break;
  15251. end;
  15252. end;
  15253. end;
  15254. end;
  15255. //------------------------------------------------------------------------------
  15256. procedure TMainForm.actQuitTeamExecute(Sender: TObject);
  15257. var
  15258. iLoop: Integer;
  15259. ListItem: TRealICQContacterListItem;
  15260. RealICQTeam: TRealICQTeam;
  15261. begin
  15262. if FLVTeams.SelCount = 1 then
  15263. begin
  15264. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15265. begin
  15266. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15267. if ListItem.Selected then
  15268. begin
  15269. RealICQTeam := ListItem.Data;
  15270. if MessageBox(Handle, '真的要退出该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15271. Exit;
  15272. TTeamsAdapter.QuitTeam(RealICQTeam.TeamID);
  15273. Break;
  15274. end;
  15275. end;
  15276. end;
  15277. end;
  15278. //------------------------------------------------------------------------------
  15279. procedure TMainForm.actDisbandTeamExecute(Sender: TObject);
  15280. var
  15281. iLoop: Integer;
  15282. ListItem: TRealICQContacterListItem;
  15283. RealICQTeam: TRealICQTeam;
  15284. begin
  15285. {if FLVTeams.SelCount = 1 then
  15286. begin
  15287. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15288. begin
  15289. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15290. if ListItem.Selected then
  15291. begin
  15292. RealICQTeam := ListItem.Data;
  15293. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then Exit;
  15294. RealICQClient.DisbandTeam(RealICQTeam.TeamID);
  15295. Break;
  15296. end;
  15297. end;
  15298. end; }
  15299. if FLVTeams.SelCount = 1 then
  15300. begin
  15301. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15302. begin
  15303. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15304. if ListItem.Selected then
  15305. begin
  15306. RealICQTeam := ListItem.Data;
  15307. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15308. Exit;
  15309. TTeamsAdapter.DisbandTeam(RealICQTeam.TeamID);
  15310. Break;
  15311. end;
  15312. end;
  15313. end;
  15314. end;
  15315. //------------------------------------------------------------------------------
  15316. procedure TMainForm.actQuitOrDisbandTeamsExecute(Sender: TObject);
  15317. var
  15318. iLoop: Integer;
  15319. ListItem: TRealICQContacterListItem;
  15320. RealICQTeam: TRealICQTeam;
  15321. begin
  15322. if MessageBox(Handle, '真的要退出 / 解散选中的群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15323. Exit;
  15324. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15325. begin
  15326. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15327. if ListItem.Selected then
  15328. begin
  15329. RealICQTeam := ListItem.Data;
  15330. if AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName) then
  15331. RealICQClient.DisbandTeam(RealICQTeam.TeamID)
  15332. else
  15333. RealICQClient.QuitTeam(RealICQTeam.TeamID);
  15334. end;
  15335. end;
  15336. end;
  15337. //------------------------------------------------------------------------------
  15338. procedure TMainForm.actShowAllNameExecute(Sender: TObject);
  15339. var
  15340. iLoop: Integer;
  15341. RealICQContacterListView: TRealICQContacterListView;
  15342. RealICQContacterTreeView: TRealICQContacterTreeView;
  15343. begin
  15344. for iLoop := 0 to FContacterListViews.Count - 1 do
  15345. begin
  15346. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15347. RealICQContacterListView.CaptionStyle := csDisplayNameAndLoginName;
  15348. end;
  15349. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15350. begin
  15351. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15352. RealICQContacterTreeView.CaptionStyle := csDisplayNameAndLoginName;
  15353. RealICQContacterTreeView.ReDrawAll;
  15354. end;
  15355. FLVCaptionStyle := csDisplayNameAndLoginName;
  15356. SaveStyleConfigs;
  15357. end;
  15358. //------------------------------------------------------------------------------
  15359. procedure TMainForm.actShowBigHeadImageExecute(Sender: TObject);
  15360. var
  15361. iLoop: Integer;
  15362. RealICQContacterListView: TRealICQContacterListView;
  15363. RealICQContacterTreeView: TRealICQContacterTreeView;
  15364. begin
  15365. for iLoop := 0 to FContacterListViews.Count - 1 do
  15366. begin
  15367. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15368. RealICQContacterListView.Style := lsBigHeadImage;
  15369. end;
  15370. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15371. begin
  15372. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15373. RealICQContacterTreeView.Style := lsBigHeadImage;
  15374. RealICQContacterTreeView.ReDrawAll;
  15375. end;
  15376. FLVStyle := lsBigHeadImage;
  15377. SaveStyleConfigs;
  15378. end;
  15379. procedure TMainForm.actShowMiddleHeadImageExecute(Sender: TObject);
  15380. var
  15381. iLoop: Integer;
  15382. RealICQContacterListView: TRealICQContacterListView;
  15383. RealICQContacterTreeView: TRealICQContacterTreeView;
  15384. begin
  15385. for iLoop := 0 to FContacterListViews.Count - 1 do
  15386. begin
  15387. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15388. RealICQContacterListView.Style := lsMiddleHeadImage;
  15389. end;
  15390. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15391. begin
  15392. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15393. RealICQContacterTreeView.Style := lsMiddleHeadImage;
  15394. RealICQContacterTreeView.ReDrawAll;
  15395. end;
  15396. FLVStyle := lsMiddleHeadImage;
  15397. SaveStyleConfigs;
  15398. end;
  15399. //------------------------------------------------------------------------------
  15400. procedure TMainForm.actShowSmallHeadImageExecute(Sender: TObject);
  15401. var
  15402. iLoop: Integer;
  15403. RealICQContacterListView: TRealICQContacterListView;
  15404. RealICQContacterTreeView: TRealICQContacterTreeView;
  15405. begin
  15406. for iLoop := 0 to FContacterListViews.Count - 1 do
  15407. begin
  15408. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15409. RealICQContacterListView.Style := lsSmallHeadImage;
  15410. end;
  15411. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15412. begin
  15413. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15414. RealICQContacterTreeView.Style := lsSmallHeadImage;
  15415. RealICQContacterTreeView.ReDrawAll;
  15416. end;
  15417. FLVStyle := lsSmallHeadImage;
  15418. SaveStyleConfigs;
  15419. end;
  15420. //------------------------------------------------------------------------------
  15421. procedure TMainForm.actShowStrangersExecute(Sender: TObject);
  15422. begin
  15423. // SaveStyleConfigs;
  15424. end;
  15425. //------------------------------------------------------------------------------
  15426. procedure TMainForm.actShowBlacklistsExecute(Sender: TObject);
  15427. begin
  15428. // SaveStyleConfigs;
  15429. end;
  15430. //------------------------------------------------------------------------------
  15431. procedure TMainForm.actShowTeamHistoryExecute(Sender: TObject);
  15432. var
  15433. iLoop: Integer;
  15434. ListItem: TRealICQContacterListItem;
  15435. RealICQTeam: TRealICQTeam;
  15436. begin
  15437. if FLVTeams.SelCount = 1 then
  15438. begin
  15439. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15440. begin
  15441. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15442. if ListItem.Selected then
  15443. begin
  15444. RealICQTeam := ListItem.Data;
  15445. OpenMessagesManagerForm;
  15446. Application.ProcessMessages;
  15447. MessagesManagerForm.ShowTeamsMessages(RealICQTeam.TeamID);
  15448. Break;
  15449. end;
  15450. end;
  15451. end;
  15452. end;
  15453. //------------------------------------------------------------------------------
  15454. procedure TMainForm.actShowTeamsExecute(Sender: TObject);
  15455. begin
  15456. // SaveStyleConfigs;
  15457. end;
  15458. //------------------------------------------------------------------------------
  15459. procedure TMainForm.actShowTreeExecute(Sender: TObject);
  15460. begin
  15461. FShowTree := not FShowTree;
  15462. actShowTree.Checked := FShowTree;
  15463. actShowBigHeadImage.Visible := not actShowTree.Checked;
  15464. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  15465. if FShowTree then
  15466. begin
  15467. if FLVStyle <> lsNoHeadImage then
  15468. begin
  15469. FLVStyle := lsSmallHeadImage;
  15470. actShowSmallHeadImage.Execute;
  15471. end;
  15472. end;
  15473. SaveStyleConfigs;
  15474. ShowGroupInterface;
  15475. end;
  15476. //------------------------------------------------------------------------------
  15477. procedure TMainForm.actShowLatestsExecute(Sender: TObject);
  15478. begin
  15479. //
  15480. end;
  15481. //------------------------------------------------------------------------------
  15482. procedure TMainForm.actAboutExecute(Sender: TObject);
  15483. begin
  15484. AboutForm := TAboutForm.Create(Self);
  15485. try
  15486. AboutForm.ShowModal;
  15487. finally
  15488. FreeAndNil(AboutForm);
  15489. end;
  15490. end;
  15491. //------------------------------------------------------------------------------
  15492. procedure TMainForm.actAlwaysOnTopExecute(Sender: TObject);
  15493. begin
  15494. FAlwaysOnTop := not FAlwaysOnTop;
  15495. // if FAlwaysOnTop then
  15496. // FormStyle := fsStayOnTop
  15497. // else
  15498. FormStyle := fsNormal;
  15499. actAlwaysOnTop.Checked := FAlwaysOnTop;
  15500. SaveDefaultConfigs;
  15501. end;
  15502. //------------------------------------------------------------------------------
  15503. procedure TMainForm.actShowNormalHeadImageExecute(Sender: TObject);
  15504. var
  15505. iLoop: Integer;
  15506. RealICQContacterListView: TRealICQContacterListView;
  15507. RealICQContacterTreeView: TRealICQContacterTreeView;
  15508. begin
  15509. for iLoop := 0 to FContacterListViews.Count - 1 do
  15510. begin
  15511. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15512. RealICQContacterListView.Style := lsNoHeadImage;
  15513. end;
  15514. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15515. begin
  15516. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15517. RealICQContacterTreeView.Style := lsNoHeadImage;
  15518. RealICQContacterTreeView.ReDrawAll;
  15519. end;
  15520. FLVStyle := lsNoHeadImage;
  15521. SaveStyleConfigs;
  15522. end;
  15523. //------------------------------------------------------------------------------
  15524. procedure TMainForm.actShowRemarkExecute(Sender: TObject);
  15525. var
  15526. iLoop, jLoop: Integer;
  15527. RealICQContacterListView: TRealICQContacterListView;
  15528. RealICQContacterTreeView: TRealICQContacterTreeView;
  15529. RealICQContacterListItem: TRealICQContacterListItem;
  15530. RealICQUser: TRealICQUser;
  15531. Employee: TRealICQEmployee;
  15532. begin
  15533. actShowRemark.Checked := not actShowRemark.Checked;
  15534. RealICQClient.ShowRemark := actShowRemark.Checked;
  15535. for iLoop := 0 to FContacterListViews.Count - 1 do
  15536. begin
  15537. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15538. for jLoop := 0 to RealICQContacterListView.Items.Count - 1 do
  15539. begin
  15540. RealICQContacterListItem := RealICQContacterListView.Items.Objects[jLoop] as TRealICQContacterListItem;
  15541. RealICQUser := RealICQContacterListItem.Data;
  15542. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  15543. end;
  15544. end;
  15545. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15546. begin
  15547. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15548. for jLoop := 0 to RealICQContacterTreeView.Count - 1 do
  15549. begin
  15550. Employee := RealICQContacterTreeView.EmployeeItems.Objects[jLoop] as TRealICQEmployee;
  15551. RealICQUser := Employee.Data;
  15552. UpdateEmployeeNode(Employee, RealICQUser, False);
  15553. end;
  15554. RealICQContacterTreeView.ReDrawAll;
  15555. end;
  15556. end;
  15557. //------------------------------------------------------------------------------
  15558. procedure TMainForm.actFindUsersExecute(Sender: TObject);
  15559. begin
  15560. if SearchForm <> nil then
  15561. begin
  15562. SearchForm.BringToFront;
  15563. Exit;
  15564. end;
  15565. SearchForm := TSearchForm.Create(Application);
  15566. SearchForm.Show;
  15567. end;
  15568. procedure TMainForm.actGroupManagerExecute(Sender: TObject);
  15569. begin
  15570. if GroupManagerForm <> nil then
  15571. Exit;
  15572. GroupManagerForm := TGroupManagerForm.Create(Self);
  15573. try
  15574. GroupManagerForm.ShowModal;
  15575. finally
  15576. FreeAndNil(GroupManagerForm);
  15577. end;
  15578. end;
  15579. //------------------------------------------------------------------------------
  15580. procedure TMainForm.OpenMessagesManagerForm;
  15581. begin
  15582. actMsgManagerExecute(nil);
  15583. end;
  15584. //------------------------------------------------------------------------------
  15585. procedure TMainForm.pgcMainWorkAreaTabChanging(Sender: TObject; NewIndex: Integer; var AllowChanged: Boolean);
  15586. var
  15587. TabSheet: TTabSheet;
  15588. WebPanel: TWebPanel;
  15589. Point: TPoint;
  15590. begin
  15591. {if NewIndex = 1 then
  15592. begin
  15593. MainForm.RealICQClient.OnGettedAddrBookGroups:=GettedAddrBookGroups;
  15594. MainForm.RealICQClient.OnManageAddrBookResult:=GettedManageAddrBookResult;
  15595. RealICQClient.SendGetAddrBookGroup;
  15596. end;}
  15597. if NewIndex > 2 then
  15598. begin
  15599. AllowChanged := False;
  15600. //if not DisplayWebs then Exit;
  15601. TabSheet := pgcMainWorkArea.Pages[NewIndex];
  15602. WebPanel := FWebPanels.Objects[TabSheet.Tag] as TWebPanel;
  15603. //if WebPanel.FNavigateType = ntFill then AllowChanged := True;
  15604. if WebPanel.Acounts.Count > 1 then
  15605. begin
  15606. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  15607. begin
  15608. Point.X := Mouse.CursorPos.X;
  15609. Point.Y := Mouse.CursorPos.Y;
  15610. FreeAndNil(SelWebTabAcountsForm);
  15611. SelWebTabAcountsForm := TSelWebTabAcountsForm.Create(Self);
  15612. SelWebTabAcountsForm.WebPanel := WebPanel;
  15613. SelWebTabAcountsForm.TabSheet := TabSheet;
  15614. SelWebTabAcountsForm.Left := Point.X;
  15615. SelWebTabAcountsForm.Top := Point.Y - 20;
  15616. if Left <= SelWebTabAcountsForm.Width then
  15617. SelWebTabAcountsForm.Left := Left + Width
  15618. else
  15619. SelWebTabAcountsForm.Left := Left - SelWebTabAcountsForm.Width;
  15620. if WebPanel.Acounts.Count < 10 then
  15621. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := WebPanel.Acounts.Count * cntHeightOfBigHeadImage + 3
  15622. else
  15623. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := 10 * cntHeightOfBigHeadImage + 3;
  15624. SelWebTabAcountsForm.pnlClient.Constraints.MaxHeight := SelWebTabAcountsForm.pnlClient.Constraints.MinHeight;
  15625. SelWebTabAcountsForm.Show;
  15626. Exit;
  15627. end;
  15628. end;
  15629. WebTabShow(TabSheet);
  15630. end;
  15631. end;
  15632. procedure TMainForm.pgcMainWorkAreaWebPanelButtonClick(Sender: TObject);
  15633. begin
  15634. pgcMainWorkArea.OnWebPanelButtonClick := nil;
  15635. if OptionsForm = nil then
  15636. OptionsForm := TOptionsForm.Create(Self);
  15637. try
  15638. OptionsForm.PageIndex := 10;
  15639. OptionsForm.ShowModal;
  15640. finally
  15641. FreeAndNil(OptionsForm);
  15642. pgcMainWorkArea.OnWebPanelButtonClick := pgcMainWorkAreaWebPanelButtonClick;
  15643. end;
  15644. end;
  15645. procedure TMainForm.pnlToolBarResize(Sender: TObject);
  15646. var
  15647. AvgWidth: Integer;
  15648. iLeft: Integer;
  15649. begin
  15650. AvgWidth := (pnlToolBar.Width - 2) div 5;
  15651. iLeft := 1;
  15652. MyContacters.Left := iLeft;
  15653. MyContacters.Width := AvgWidth;
  15654. MyContactersIcon.Left := iLeft + (AvgWidth - MyContactersIcon.Width) div 2;
  15655. iLeft := iLeft + AvgWidth;
  15656. SysMsg.Left := iLeft;
  15657. SysMsg.Width := AvgWidth;
  15658. SysMsgIcon.Left := iLeft + (AvgWidth - SysMsgIcon.Width) div 2;
  15659. iLeft := iLeft + AvgWidth;
  15660. MyFriend.Left := iLeft;
  15661. MyFriend.Width := AvgWidth;
  15662. MyFriendIcon.Left := iLeft + (AvgWidth - MyFriendIcon.Width) div 2;
  15663. iLeft := iLeft + AvgWidth;
  15664. MyTeam.Left := iLeft;
  15665. MyTeam.Width := AvgWidth;
  15666. MyTeamIcon.Left := iLeft + (AvgWidth - MyTeamIcon.Width) div 2;
  15667. iLeft := iLeft + AvgWidth;
  15668. Latests.Left := iLeft;
  15669. Latests.Width := pnlToolBar.Width - (AvgWidth * 4);
  15670. LatestsIcon.Left := iLeft + (AvgWidth - LatestsIcon.Width) div 2;
  15671. iLeft := iLeft + AvgWidth;
  15672. end;
  15673. procedure TMainForm.pnlWorkAreaClick(Sender: TObject);
  15674. begin
  15675. end;
  15676. {设置WebBrowser的样式}
  15677. //------------------------------------------------------------------------------
  15678. procedure TMainForm.SetDOMStyle(Doc: IHTMLDocument2);
  15679. var
  15680. CurrentColor, CssColor: string;
  15681. begin
  15682. try
  15683. CurrentColor := IntToHex(ConvertColorToColor(FormColor, MainForm.UIMainColor), 6);
  15684. CssColor := '#' + Copy(CurrentColor, 5, 2) + Copy(CurrentColor, 3, 2) + Copy(CurrentColor, 1, 2);
  15685. Doc.body.style.cssText := 'word-break: break-all;';
  15686. Doc.body.style.border := '0px solid';
  15687. Doc.body.style.fontFamily := '宋体';
  15688. Doc.body.style.fontSize := '9pt';
  15689. Doc.body.style.margin := '0pt';
  15690. Doc.body.setAttribute('scroll', 'no', 0);
  15691. Doc.body.style.backgroundColor := CssColor;
  15692. except
  15693. end;
  15694. end;
  15695. //------------------------------------------------------------------------------
  15696. procedure TMainForm.WebBrowserRightStatusTextChange(ASender: TObject; const Text: WideString);
  15697. var
  15698. TabSheet: TTabSheet;
  15699. begin
  15700. try
  15701. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15702. if pgcMultiWeb.ActivePage = TabSheet then
  15703. lblIEStatus.Caption := Text
  15704. else
  15705. lblIEStatus.Caption := '';
  15706. except
  15707. lblIEStatus.Caption := Text
  15708. end;
  15709. end;
  15710. //------------------------------------------------------------------------------
  15711. procedure TMainForm.WebBrowserRightTitleChange(ASender: TObject; const Text: WideString);
  15712. var
  15713. IETitle: WideString;
  15714. TabSheet: TTabSheet;
  15715. begin
  15716. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15717. IETitle := Text;
  15718. //字符串长度过长时,截短字符串并在后面显示“...”
  15719. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) > 138 do
  15720. begin
  15721. if Length(IETitle) > 3 then
  15722. begin
  15723. if Copy(IETitle, Length(IETitle) - 2, Length(IETitle)) = '...' then
  15724. IETitle := Copy(IETitle, 1, Length(IETitle) - 3);
  15725. IETitle := Copy(IETitle, 1, Length(IETitle) - 1) + '...';
  15726. end
  15727. else
  15728. begin
  15729. IETitle := '...';
  15730. end;
  15731. end;
  15732. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) < 88 do
  15733. begin
  15734. IETitle := IETitle + ' ';
  15735. end;
  15736. TabSetMuiltWeb.Tabs.Strings[TabSheet.TabIndex] := IETitle + ' ';
  15737. end;
  15738. //------------------------------------------------------------------------------
  15739. procedure TMainForm.WebBrowserRightWindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
  15740. var
  15741. TabSheet: TTabSheet;
  15742. WebBrowser: TWebBrowser;
  15743. begin
  15744. CoInitialize(nil);
  15745. try
  15746. WebBrowser := ASender as TWebBrowser;
  15747. TabSheet := (WebBrowser.Owner as TPanel).Owner as TTabSheet;
  15748. if pgcMultiWeb.PageCount > 1 then
  15749. begin
  15750. try
  15751. if WebBrowser.Busy then
  15752. WebBrowser.Stop;
  15753. except
  15754. end;
  15755. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  15756. TabSheet.PageControl := nil;
  15757. FreeAndNil(TabSheet);
  15758. end
  15759. else
  15760. begin
  15761. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15762. WebBrowser.Navigate('about:blank');
  15763. end;
  15764. finally
  15765. CoUninitialize;
  15766. Cancel := True;
  15767. end;
  15768. end;
  15769. {procedure TMainForm.WebSocketBroadCastMesssage(var msg: TMessage);
  15770. var
  15771. pdata: PBroadCastMessage;
  15772. RealICQTeamMessage: TRealICQTeamMessage;
  15773. begin
  15774. showmessage(pdata.GroupID);
  15775. RealICQTeamMessage:= TRealICQTeamMessage.Create(pdata.GroupID,pdata.Sayer,{pdata.Style}//'"宋体",9,[],[clBlack]',pdata.Msg,False);
  15776. { RealICQTeamMessage.MessageID := gettickcount();
  15777. RealICQTeamMessage.SendDateTime := pdata.timestamp;
  15778. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15779. end; }
  15780. { TODO -olqq -c : WebSocket群通讯功能 2014/12/12 9:02:40 }
  15781. procedure TMainForm.WebSocketJionTeamRequest(TeamID, ALoginName, ATag: string);
  15782. var
  15783. ATeam: TRealICQTeam;
  15784. ATeamCaption: string;
  15785. begin
  15786. ATeam := TTeamsAdapter.GetTeam(TeamID);
  15787. if ATeam <> nil then
  15788. ATeamCaption := ATeam.TeamCaption;
  15789. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ATeamCaption, TeamID]), nil);
  15790. ShowJoinTeamRequestWindow(Self, TeamID, ATeamCaption, ALoginName, ATag);
  15791. end;
  15792. procedure TMainForm.WebSocketQuitTeam(aTeamID: string);
  15793. var
  15794. iIndex: Integer;
  15795. AlertMessage: string;
  15796. ARealICQTeam: TRealICQTeam;
  15797. AForm: TForm;
  15798. begin
  15799. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15800. if iIndex >= 0 then
  15801. begin
  15802. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15803. if ARealICQTeam = nil then
  15804. Exit;
  15805. FLVTeams.Items.Delete(iIndex);
  15806. if ARealICQTeam.IsTempTeam then
  15807. AlertMessage := '您 退出了 多人对话'
  15808. else
  15809. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  15810. ShowNotifyAlertForm(AlertMessage);
  15811. AddMessageHistory(smSimple, AlertMessage, nil);
  15812. ShowNavBarNumeric;
  15813. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  15814. AForm := GetTeamTalkingForm(aTeamID);
  15815. FreeAndNil(AForm);
  15816. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  15817. UpdateTeamTalkingForm(ARealICQTeam);
  15818. end;
  15819. end;
  15820. procedure TMainForm.WebSocketRecivedbroadcastmesssage(aID, aGroupID, aSayer, aStyle, aMsg: string; aTimesTamp: TDateTime);
  15821. var
  15822. RealICQTeamMessage: TRealICQTeamMessage;
  15823. aDateTime: TDateTime;
  15824. begin
  15825. RealICQTeamMessage := TRealICQTeamMessage.Create(aGroupID, aSayer, aStyle{'"宋体",9,[],[clBlack]'}, aMsg, False);
  15826. RealICQTeamMessage.MessageID := gettickcount();
  15827. RealICQTeamMessage.SendDateTime := aTimesTamp;
  15828. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15829. end;
  15830. procedure TMainForm.WebSocketRemoveTeamResponse(aTeamID: string);
  15831. var
  15832. iIndex: Integer;
  15833. AlertMessage: string;
  15834. RealICQUser: TRealICQUser;
  15835. ARealICQTeam: TRealICQTeam;
  15836. AForm: TForm;
  15837. begin
  15838. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15839. if iIndex >= 0 then
  15840. begin
  15841. FLVTeams.Items.Delete(iIndex);
  15842. FLVTeams.ReDrawAll;
  15843. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15844. if ARealICQTeam = nil then
  15845. Exit;
  15846. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  15847. if RealICQUser = RealICQClient.Me then
  15848. AlertMessage := '您'
  15849. else if RealICQUser.DisplayName = '' then
  15850. AlertMessage := RealICQUser.LoginName
  15851. else
  15852. AlertMessage := RealICQUser.DisplayName;
  15853. if ARealICQTeam.IsTempTeam then
  15854. AlertMessage := AlertMessage + ' 解散了 多人对话'
  15855. else
  15856. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  15857. ShowNotifyAlertForm(AlertMessage);
  15858. AddMessageHistory(smSimple, AlertMessage, nil);
  15859. ShowNavBarNumeric;
  15860. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  15861. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  15862. AForm := GetTeamTalkingForm(aTeamID);
  15863. FreeAndNil(AForm);
  15864. end;
  15865. end;
  15866. procedure TMainForm.WebSocketSendReadTeamInfo(aTeamID: string);
  15867. var
  15868. iLoop, iIndex: Integer;
  15869. ListItem: TRealICQContacterListItem;
  15870. MemberList: TStringList;
  15871. ARealICQTeam: TRealICQTeam;
  15872. begin
  15873. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15874. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  15875. if iIndex = -1 then
  15876. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  15877. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  15878. if ARealICQTeam.IsTempTeam then
  15879. ListItem.Watchword := ''
  15880. else
  15881. ListItem.Watchword := ARealICQTeam.TeamIntro;
  15882. ListItem.LoginState := stLeave;
  15883. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  15884. try
  15885. for iLoop := MemberList.Count - 1 downto 0 do
  15886. begin
  15887. if Length(Trim(MemberList[iLoop])) = 0 then
  15888. MemberList.Delete(iLoop);
  15889. end;
  15890. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  15891. finally
  15892. MemberList.Free;
  15893. end;
  15894. {try
  15895. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  15896. except
  15897. ListItem.HeadImagePicture.Graphic := nil;
  15898. end; }
  15899. if ARealICQTeam.IsTempTeam then
  15900. ListItem.DisplayName := '多人对话'
  15901. else
  15902. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  15903. ListItem.Data := ARealICQTeam;
  15904. ListItem.ReDrawItem;
  15905. ShowNavBarNumeric;
  15906. UpdateTeamOptionsForm(ARealICQTeam);
  15907. UpdateTeamTalkingForm(ARealICQTeam);
  15908. end;
  15909. { TODO -olqq -c : EndWebsocket 2014/12/12 9:05:23 }
  15910. //------------------------------------------------------------------------------
  15911. procedure TMainForm.WebBrowserRightNewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
  15912. var
  15913. WebBrowser1, WebBrowser: TWebBrowser;
  15914. begin
  15915. CoInitialize(nil);
  15916. try
  15917. try
  15918. WebBrowser1 := ASender as TWebBrowser;
  15919. if WebBrowser1.Busy then
  15920. begin
  15921. Cancel := True;
  15922. Exit;
  15923. end;
  15924. WebBrowser := AddWebBrowserToPageControl('about:blank', -3);
  15925. if WebBrowser = nil then
  15926. begin
  15927. Cancel := True;
  15928. Exit;
  15929. end;
  15930. try
  15931. if (WebBrowser.Busy) then
  15932. WebBrowser.Stop;
  15933. except
  15934. end;
  15935. ppDisp := WebBrowser.ControlInterface;
  15936. except
  15937. Cancel := True;
  15938. end;
  15939. finally
  15940. CoUninitialize;
  15941. end;
  15942. end;
  15943. //------------------------------------------------------------------------------
  15944. function TMainForm.AddWebBrowserToPageControl(AUrl: string; WebPanelTag: Integer = -1): TWebBrowser;
  15945. var
  15946. TabSheet: TTabSheet;
  15947. PanelForIE: TPanel;
  15948. WebBrowser: TWebBrowser;
  15949. begin
  15950. if (WebPanelTag = -1) or (WebPanelTag = -3) or (pgcMultiWeb.PageCount <= 0) then
  15951. begin
  15952. TabSheet := TTabSheet.Create(pgcMultiWeb);
  15953. try
  15954. TabSheet.Parent := pgcMultiWeb;
  15955. TabSheet.PageControl := pgcMultiWeb;
  15956. TabSheet.DoubleBuffered := True;
  15957. PanelForIE := TPanel.Create(TabSheet);
  15958. PanelForIE.Parent := TabSheet;
  15959. PanelForIE.DoubleBuffered := True;
  15960. PanelForIE.Color := clWhite;
  15961. PanelForIE.Align := alClient;
  15962. PanelForIE.BevelInner := bvNone;
  15963. PanelForIE.BevelOuter := bvNone;
  15964. PanelForIE.Visible := True;
  15965. PanelForIE.Padding.Left := 2;
  15966. PanelForIE.Padding.Top := 2;
  15967. PanelForIE.Padding.Right := 2;
  15968. PanelForIE.Padding.Bottom := 2;
  15969. WebBrowser := TWebBrowser.Create(PanelForIE);
  15970. WebBrowser.DoubleBuffered := True;
  15971. WebBrowser.ParentWindow := PanelForIE.Handle;
  15972. WebBrowser.Align := alClient;
  15973. WebBrowser.OnStatusTextChange := WebBrowserRightStatusTextChange;
  15974. WebBrowser.OnTitleChange := WebBrowserRightTitleChange;
  15975. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15976. WebBrowser.OnNewWindow2 := WebBrowserRightNewWindow2;
  15977. WebBrowser.OnWindowClosing := WebBrowserRightWindowClosing;
  15978. WebBrowser.Tag := WebPanelTag;
  15979. PanelForIE.InsertControl(WebBrowser);
  15980. except
  15981. TabSheet.PageControl := nil;
  15982. FreeAndNil(TabSheet);
  15983. Result := nil;
  15984. Exit;
  15985. end;
  15986. TabSetMuiltWeb.Tabs.Add(AUrl + ' ');
  15987. try
  15988. TabSetMuiltWeb.TabIndex := TabSetMuiltWeb.Tabs.Count - 1;
  15989. except
  15990. end;
  15991. pgcMultiWeb.ActivePageIndex := pgcMultiWeb.PageCount - 1;
  15992. end
  15993. else
  15994. begin
  15995. TabSheet := pgcMultiWeb.Pages[0];
  15996. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  15997. WebBrowser.Tag := WebPanelTag;
  15998. TabSetMuiltWeb.Tabs.Strings[0] := (AUrl + ' ');
  15999. TabSetMuiltWeb.TabIndex := 0;
  16000. pgcMultiWeb.ActivePageIndex := 0;
  16001. end;
  16002. {
  16003. if not pnlMiddleRight.Visible then
  16004. begin
  16005. if RealICQClient.Logined and RealICQClient.Connected then
  16006. begin
  16007. ShowOrHideMuiltiWeb;
  16008. end;
  16009. end;
  16010. try
  16011. if (WebBrowser.Busy) then WebBrowser.Stop;
  16012. except
  16013. end;
  16014. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16015. //if not ((WebPanelTag = -3) and AnsiSameText(AUrl, 'about:blank')) then
  16016. try
  16017. WebBrowser.Navigate(AUrl);
  16018. except
  16019. end;
  16020. Result := WebBrowser;
  16021. }
  16022. end;
  16023. //------------------------------------------------------------------------------
  16024. {
  16025. procedure TMainForm.WebTabShow(Sender: TObject);
  16026. var
  16027. iIndex: Integer;
  16028. TabSheet: TTabSheet;
  16029. WebPanel: TWebPanel;
  16030. WebURL: String;
  16031. begin
  16032. TabSheet := Sender as TTabSheet;
  16033. //TabSheet.OnShow := nil;
  16034. iIndex := FWebTabs.IndexOf(TabSheet);
  16035. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16036. while TabSheet.ControlCount > 0 do
  16037. begin
  16038. TabSheet.Controls[0].Free;
  16039. //TabSheet.RemoveControl(TabSheet.Controls[0]);
  16040. end;
  16041. if WebPanel.NavigateType = ntGET then
  16042. begin
  16043. WebURL := WebPanel.URL;
  16044. if WebPanel.UserIMLoginName then
  16045. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', RealICQClient.LoginName)
  16046. else
  16047. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebPanel.CustomLoginName);
  16048. if WebPanel.UserIMPassword then
  16049. WebURL := AnsiReplaceText(WebURL, '[%Password%]', RealICQClient.Password)
  16050. else
  16051. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebPanel.CustomPassword);
  16052. AddWebBrowserToPageControl(WebUrl, iIndex);
  16053. end
  16054. else
  16055. AddWebBrowserToPageControl('about:blank', iIndex);
  16056. end;
  16057. }
  16058. //------------------------------------------------------------------------------
  16059. //新Post方式
  16060. procedure TMainForm.WebBrowserRightDocumentCompleteForPost(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16061. var
  16062. WebBrowser: TWebBrowser;
  16063. WebPanel: TWebPanel;
  16064. WebTabAcount: TWebTabAcount;
  16065. FieldName, ALoginName, FieldValue: string;
  16066. PostFields, Field: TStringList;
  16067. iLoop, jLoop, kLoop: Integer;
  16068. WebItem: Olevariant;
  16069. WebItemChild: Olevariant;
  16070. WebItemForm: Olevariant;
  16071. AFindedForm: Boolean;
  16072. ASubmitID: string;
  16073. begin
  16074. WebBrowser := ASender as TWebBrowser;
  16075. WebBrowser.OnDocumentComplete := nil;
  16076. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16077. if WebPanel.Acounts.Count > 0 then
  16078. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16079. else
  16080. WebTabAcount := nil;
  16081. ASubmitID := '';
  16082. ;
  16083. AFindedForm := False;
  16084. PostFields := SplitString(WebPanel.PostFields, ',');
  16085. try
  16086. for kLoop := 0 to PostFields.Count - 1 do
  16087. begin
  16088. Field := SplitStringEx(PostFields.Strings[kLoop], '=');
  16089. try
  16090. try
  16091. FieldName := Field.Strings[0];
  16092. FieldValue := Field.Strings[1];
  16093. if FieldName = 'LXTALK_SUBMIT_BTN' then
  16094. ASubmitID := FieldValue;
  16095. if WebTabAcount <> nil then
  16096. begin
  16097. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16098. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16099. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16100. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16101. end;
  16102. WebBrowser.OleObject.Document.getElementByID(FieldName).value := FieldValue;
  16103. //找到Form
  16104. if not AFindedForm then
  16105. begin
  16106. WebItem := WebBrowser.Document;
  16107. for iLoop := 0 to WebItem.Forms.length - 1 do
  16108. begin
  16109. //ShowMessage(WebItem.Forms.Item(iLoop, 0).name);
  16110. WebItemChild := WebItem.Forms.Item(iLoop, 0);
  16111. for jLoop := 0 to WebItemChild.all.length - 1 do
  16112. begin
  16113. if AnsiSameText(WebItemChild.all.item(jLoop).tagName, 'INPUT') then
  16114. begin
  16115. if AnsiSameText(WebItemChild.all.item(jLoop).name, FieldName) then
  16116. begin
  16117. AFindedForm := True;
  16118. WebItemForm := WebItemChild;
  16119. Break;
  16120. end;
  16121. //ShowMessage(WebItemChild.all.item(jLoop).tagName);
  16122. //ShowMessage(WebItemChild.all.item(jLoop).type);
  16123. //ShowMessage(WebItemChild.all.item(jLoop).name);
  16124. end;
  16125. end; //for
  16126. end; //for
  16127. end; //if
  16128. except
  16129. end;
  16130. finally
  16131. Field.Free;
  16132. end;
  16133. end;
  16134. finally
  16135. PostFields.Free;
  16136. end;
  16137. //ShowMessage(WebItemForm.Action);
  16138. //Exit;
  16139. WebItemForm.target := '_blank';
  16140. //Exit;
  16141. if ASubmitID <> '' then
  16142. begin
  16143. for jLoop := 0 to WebItemForm.all.length - 1 do
  16144. begin
  16145. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16146. begin
  16147. if AnsiSameText(WebItemForm.all.item(jLoop).name, ASubmitID) then
  16148. begin
  16149. WebItemForm.all.item(jLoop).click;
  16150. end;
  16151. end;
  16152. end;
  16153. end
  16154. else
  16155. begin
  16156. for jLoop := 0 to WebItemForm.all.length - 1 do
  16157. begin
  16158. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16159. begin
  16160. if AnsiSameText(WebItemForm.all.item(jLoop).type, 'submit') then
  16161. begin
  16162. WebItemForm.all.item(jLoop).click;
  16163. end;
  16164. end;
  16165. end;
  16166. end;
  16167. Application.ProcessMessages;
  16168. Sleep(100);
  16169. Application.ProcessMessages;
  16170. //FreeAndNil(WebBrowser);
  16171. end;
  16172. //------------------------------------------------------------------------------
  16173. //Get方式加旧版本Post方式
  16174. procedure TMainForm.WebBrowserRightDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16175. var
  16176. PanelForIE: TPanel;
  16177. WebBrowser: TWebBrowser;
  16178. WebPanel: TWebPanel;
  16179. v: Variant;
  16180. parameters: string;
  16181. OldTag, iLoop: Integer;
  16182. PostFields, Field: TStringList;
  16183. WebURL, FieldName, ALoginName, FieldValue: string;
  16184. WebTabAcount: TWebTabAcount;
  16185. SetTagAsZero: Boolean;
  16186. begin
  16187. WebBrowser := ASender as TWebBrowser;
  16188. OldTag := WebBrowser.Tag;
  16189. SetTagAsZero := True;
  16190. PanelForIE := WebBrowser.Owner as TPanel;
  16191. try
  16192. if (not PanelForIE.Visible) and (not AnsiSameText(URL, 'about:blank')) then
  16193. begin
  16194. //PanelForIE.Visible := True;
  16195. WebBrowser.OnDocumentComplete := nil;
  16196. WebBrowser.Navigate('about:blank');
  16197. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar(String(URL)),'',SW_SHOWMAXIMIZED);
  16198. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(URL)), '', SW_SHOWMAXIMIZED);
  16199. Exit;
  16200. end;
  16201. {if not AnsiSameText(URL, 'about:blank') then
  16202. begin
  16203. WebBrowser.OnDocumentComplete := nil;
  16204. with cbxURLInputer.ItemsEx.Add do
  16205. begin
  16206. Caption := URL;
  16207. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  16208. ImageIndex := 2
  16209. else if Copy(Caption, 1, 4) = 'ftp:' then
  16210. ImageIndex := 1
  16211. else
  16212. ImageIndex := 0;
  16213. end;
  16214. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  16215. if WebBrowser.Document <> nil then
  16216. begin
  16217. (WebBrowser.Application as IOleobject).DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser, 0, Handle, GetClientRect);
  16218. end;
  16219. end;}
  16220. if AnsiSameText(URL, 'about:blank') and (WebBrowser.Tag >= 0) and (TabAcountIndex >= 0) then
  16221. begin
  16222. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16223. if WebPanel.Acounts.Count > 0 then
  16224. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16225. else
  16226. WebTabAcount := nil;
  16227. WebBrowser.Tag := -1;
  16228. WebURL := WebPanel.URL;
  16229. if WebPanel.FName = '网络存储' then
  16230. begin
  16231. OpenNewWorkDisk(WebPanel.FURL);
  16232. Exit;
  16233. end;
  16234. if WebPanel.FNavigateType = ntGET then
  16235. begin
  16236. if Length(Trim(WebPanel.PostFields)) > 0 then
  16237. begin
  16238. if Pos('?', WebPanel.URL) > 0 then
  16239. WebURL := WebPanel.URL + '&' + ReplaceStr(WebPanel.PostFields, ',', '&')
  16240. else
  16241. WebURL := WebPanel.URL + '?' + ReplaceStr(WebPanel.PostFields, ',', '&');
  16242. end;
  16243. if WebTabAcount <> nil then
  16244. begin
  16245. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebTabAcount.LoginName);
  16246. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebTabAcount.Password);
  16247. WebURL := AnsiReplaceText(WebURL, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16248. WebURL := AnsiReplaceText(WebURL, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16249. WebURL := AnsiReplaceText(WebURL, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16250. WebURL := AnsiReplaceText(WebURL, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16251. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16252. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16253. end;
  16254. parameters := ALoginName + ' ' + RealICQClient.Password;
  16255. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(Trim(WebURL))), PChar(parameters), SW_SHOWMAXIMIZED);
  16256. end
  16257. else
  16258. begin
  16259. v := VarArrayCreate([0, 0], varVariant);
  16260. v[0] := '<body>' + '<form method="post" action="' + WebURL + '" target="_blank">';
  16261. PostFields := SplitString(WebPanel.PostFields, ',');
  16262. for iLoop := 0 to PostFields.Count - 1 do
  16263. begin
  16264. Field := SplitStringEx(PostFields.Strings[iLoop], '=');
  16265. try
  16266. FieldName := Field.Strings[0];
  16267. FieldValue := Field.Strings[1];
  16268. if WebTabAcount <> nil then
  16269. begin
  16270. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16271. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16272. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16273. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16274. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16275. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16276. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16277. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16278. end;
  16279. v[0] := v[0] + '<input type="hidden" ' + 'name="' + FieldName + '" ' + 'value="' + FieldValue + '">';
  16280. except
  16281. end;
  16282. Field.Free;
  16283. end;
  16284. PostFields.Free;
  16285. v[0] := v[0] + '</form>' + '</body>';
  16286. (WebBrowser.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16287. WebBrowser.oleobject.document.Forms.Item(0, 0).Submit;
  16288. end;
  16289. end;
  16290. finally
  16291. ClearMemory;
  16292. if SetTagAsZero then
  16293. WebBrowser.Tag := -1;
  16294. //pgcMainWorkArea.ActivePageIndex := 0;
  16295. end;
  16296. end;
  16297. procedure TMainForm.WebBrowserForPostWorkOrderDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16298. begin
  16299. //
  16300. { if URL='about:blank' then
  16301. begin
  16302. v := VarArrayCreate([0, 0], varVariant);
  16303. v[0] := '<body>' +
  16304. '<form method="post" action="' + WebURL + '" target="_blank">';
  16305. v[0] := v[0] +
  16306. '<input type="hidden" ' +
  16307. 'name="' + FieldName +'" ' +
  16308. 'value="'+ FieldValue + '">';
  16309. v[0] := v[0] +
  16310. '</form>' +
  16311. '</body>';
  16312. (WebBrowserForPostWorkOrder.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16313. WebBrowserForPostWorkOrder.oleobject.document.Forms.Item(0, 0).Submit;
  16314. end; }
  16315. end;
  16316. procedure TMainForm.UploadWebTabAccounts;
  16317. var
  16318. iLoop, jLoop: Integer;
  16319. WebPanel: TWebPanel;
  16320. StrTemp: string;
  16321. WebTabAcount: TWebTabAcount;
  16322. begin
  16323. StrTemp := '';
  16324. for iLoop := 0 to WebPanels.Count - 1 do
  16325. begin
  16326. WebPanel := WebPanels.Objects[iLoop] as TWebPanel;
  16327. for jLoop := 0 to WebPanel.Acounts.Count - 1 do
  16328. begin
  16329. WebTabAcount := WebPanel.Acounts[jLoop];
  16330. StrTemp := StrTemp + IntToStr(WebTabAcount.WebTabID) + Chr(10) + WebTabAcount.LoginName + Chr(10) + WebTabAcount.Password + Chr(10) + WebTabAcount.Title + Chr(10) + WebTabAcount.Explain + Chr(10) + Chr(13);
  16331. end;
  16332. end;
  16333. MainForm.RealICQClient.CallServerDBProcedure('SetWebTabAcounts', StrTemp);
  16334. end;
  16335. //------------------------------------------------------------------------------
  16336. procedure TMainForm.WebTabShow(Sender: TObject);
  16337. var
  16338. iIndex: Integer;
  16339. TabSheet: TTabSheet;
  16340. WebPanel: TWebPanel;
  16341. WebTabAcount: TWebTabAcount;
  16342. iLoop: Integer;
  16343. begin
  16344. if not DisplayWebs then
  16345. Exit;
  16346. TabSheet := Sender as TTabSheet;
  16347. //TabSheet.OnShow := nil;
  16348. iIndex := FWebTabs.IndexOf(TabSheet);
  16349. iIndex := TabSheet.Tag;
  16350. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16351. TabAcountIndex := 0;
  16352. if WebPanel.Acounts.Count = 0 then
  16353. begin
  16354. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  16355. begin
  16356. AddWebTabForm := TAddWebTabForm.Create(Self);
  16357. try
  16358. AddWebTabForm.NewWebPanel := True;
  16359. AddWebTabForm.Left := Mouse.CursorPos.X;
  16360. AddWebTabForm.Top := Mouse.CursorPos.Y - 20;
  16361. if Left <= AddWebTabForm.Width then
  16362. AddWebTabForm.Left := Left + Width - 10
  16363. else
  16364. AddWebTabForm.Left := Left - AddWebTabForm.Width + 10;
  16365. if (AddWebTabForm.Top + AddWebTabForm.Height) > Screen.Height then
  16366. AddWebTabForm.Top := Screen.Height - AddWebTabForm.Height;
  16367. if AddWebTabForm.ShowModal = mrOK then
  16368. begin
  16369. WebTabAcount := TWebTabAcount.Create;
  16370. WebTabAcount.WebTabID := StrToInt(WebPanel.ID);
  16371. WebTabAcount.Title := Trim(AddWebTabForm.edTitle.Text);
  16372. WebTabAcount.LoginName := AddWebTabForm.ALoginName;
  16373. WebTabAcount.Password := AddWebTabForm.APassword;
  16374. WebTabAcount.Explain := Trim(AddWebTabForm.edExplain.Text);
  16375. WebPanel.Acounts.Add(WebTabAcount);
  16376. UploadWebTabAccounts;
  16377. end
  16378. else
  16379. begin
  16380. TabAcountIndex := -1;
  16381. end;
  16382. finally
  16383. FreeAndNil(AddWebTabForm);
  16384. end;
  16385. end;
  16386. end;
  16387. OpenWebTab(TabSheet, WebPanel, TabAcountIndex);
  16388. end;
  16389. //------------------------------------------------------------------------------
  16390. procedure TMainForm.ShowOrHideMuiltiWeb;
  16391. var
  16392. OldWidth: Integer;
  16393. begin
  16394. LockWindowUpdate(GetDesktopWindow);
  16395. OldWidth := pnlMiddleClient.Width;
  16396. try
  16397. //if not pnlMiddleRight.Visible then pnlMiddleRight.Width := 680;
  16398. pnlMiddleRight.Visible := not pnlMiddleRight.Visible;
  16399. Spl.Visible := pnlMiddleRight.Visible;
  16400. if not pnlMiddleRight.Visible then
  16401. begin
  16402. Width := Width - pnlMiddleRight.Width - Spl.Width;
  16403. Spl.Align := alRight;
  16404. pnlMiddleClient.Align := alClient;
  16405. pnlMiddleRight.Align := alRight;
  16406. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  16407. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  16408. end
  16409. else
  16410. begin
  16411. // Width := Width + pnlMiddleRight.Width + Spl.Width;
  16412. Top := Screen.Height div 2 - 290;
  16413. Left := Screen.Width div 2 - 440;
  16414. Width := 880;
  16415. Height := 580;
  16416. Spl.Align := alLeft;
  16417. pnlMiddleClient.Align := alLeft;
  16418. pnlMiddleRight.Align := alClient;
  16419. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth + pnlMiddleRight.Constraints.MinWidth + Spl.Width;
  16420. pnlAll.Constraints.MaxWidth := 0;
  16421. pnlMiddleClient.Left := 0;
  16422. spl.Left := pnlMiddleClient.Left + pnlMiddleClient.Width + 1;
  16423. end;
  16424. finally
  16425. pnlMiddleClient.Width := OldWidth;
  16426. LockWindowUpdate(0);
  16427. end;
  16428. end;
  16429. //------------------------------------------------------------------------------
  16430. procedure TMainForm.actMsgManagerExecute(Sender: TObject);
  16431. begin
  16432. if MessagesManagerForm <> nil then
  16433. begin
  16434. MessagesManagerForm.BringToFront;
  16435. Exit;
  16436. end;
  16437. MessagesManagerForm := TMessagesManagerForm.Create(Application);
  16438. MessagesManagerForm.Width := Round(Screen.WorkAreaWidth * 0.95);
  16439. MessagesManagerForm.Height := Round(Screen.WorkAreaHeight * 0.95);
  16440. MessagesManagerForm.Show;
  16441. end;
  16442. //------------------------------------------------------------------------------
  16443. procedure TMainForm.RealICQClientAddedBlacklists(Sender: TObject; ALoginName: string);
  16444. var
  16445. ItemIndex: Integer;
  16446. RealICQUser: TRealICQUser;
  16447. RealICQContacterListView: TRealICQContacterListView;
  16448. RealICQContacterListItem: TRealICQContacterListItem;
  16449. begin
  16450. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  16451. if RealICQContacterListView.Items.IndexOf(ALoginName) = -1 then
  16452. begin
  16453. ItemIndex := RealICQClient.Blacklists.IndexOf(ALoginName);
  16454. RealICQUser := RealICQClient.Blacklists.Objects[ItemIndex] as TRealICQUser;
  16455. RealICQContacterListView := GetListViewByLoginName(RealICQUser.LoginName);
  16456. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  16457. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  16458. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  16459. end;
  16460. end;
  16461. procedure TMainForm.RealICQClientAddFriendRequest(Sender: TObject; ALoginName, ATag: string);
  16462. begin
  16463. AddMessageHistory(smSimple, ALoginName + ' 请求加您为好友', nil);
  16464. ShowAddFriendRequestWindow(Self, ALoginName, ATag);
  16465. end;
  16466. procedure TMainForm.RealICQClientAddFriendResponse(Sender: TObject; ALoginName, ATag: string; AAcceptted: Boolean);
  16467. var
  16468. RealICQUser: TRealICQUser;
  16469. itemIndex: Integer;
  16470. begin
  16471. if AAcceptted then
  16472. begin
  16473. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  16474. AddMessageHistory(smSimple, '您已将 ' + ALoginName + ' 添加至好友列表', nil);
  16475. FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  16476. //显示好友
  16477. // ShowGroupInterface;
  16478. ShowNotifyAlertForm('已将 ' + ALoginName + ' 添加至好友列表');
  16479. end
  16480. else
  16481. begin
  16482. if Length(ATag) = 0 then
  16483. ATag := '无';
  16484. AddMessageHistory(smSimple, ALoginName + ' 拒绝了您添加好友的请求', nil);
  16485. ShowNotifyAlertForm(ALoginName + ' 拒绝添加好友的请求' + #$D#$A + '附言:' + ATag);
  16486. end;
  16487. end;
  16488. //------------------------------------------------------------------------------
  16489. procedure TMainForm.actOpenMainFormExecute(Sender: TObject);
  16490. begin
  16491. //if FHidden then ZoomEffect(Self, zaMaximize);
  16492. Show;
  16493. ShowWindow(Handle, SW_SHOW);
  16494. ForceForeGroundWindow(Handle);
  16495. FHidden := False;
  16496. if FMainFormHidden then
  16497. begin
  16498. FDblClickedTrayIcon := True;
  16499. TimerForShowMainForm.Enabled := False;
  16500. //TimerForShowMainForm.Enabled := True;
  16501. SetForegroundWindow(TrueHiddenMainForm.Handle);
  16502. ShowMainForm;
  16503. end
  16504. else
  16505. HideMainForm;
  16506. end;
  16507. //------------------------------------------------------------------------------
  16508. procedure TMainForm.actOpenRecvFileDirExecute(Sender: TObject);
  16509. begin
  16510. ShellExecute(handle, 'open', PChar('"' + RecvFileDir + '"'), '', '', SW_SHOWNORMAL);
  16511. end;
  16512. //------------------------------------------------------------------------------
  16513. procedure TMainForm.actOptionsExecute(Sender: TObject);
  16514. begin
  16515. if OptionsForm <> nil then
  16516. Exit;
  16517. OptionsForm := TOptionsForm.Create(Self);
  16518. try
  16519. OptionsForm.ShowModal;
  16520. finally
  16521. FreeAndNil(OptionsForm);
  16522. end;
  16523. end;
  16524. //------------------------------------------------------------------------------
  16525. procedure TMainForm.actPersonalSetExecute(Sender: TObject);
  16526. var
  16527. AForm: IUIForm;
  16528. begin
  16529. // AForm := TViewManager.Current.GetView('TSettingViewForm');
  16530. // AForm.SetFormInfo('{"center":true, "unsizeable":true}');
  16531. // AForm.Show;
  16532. if OptionsForm <> nil then
  16533. Exit;
  16534. OptionsForm := TOptionsForm.Create(Self);
  16535. try
  16536. OptionsForm.PageIndex := 0;
  16537. OptionsForm.ShowModal;
  16538. finally
  16539. FreeAndNil(OptionsForm);
  16540. end;
  16541. end;
  16542. procedure TMainForm.actQuitExecute(Sender: TObject);
  16543. var
  16544. iWaitTimes: Integer;
  16545. begin
  16546. if RealICQClient.Connected then
  16547. begin
  16548. if GetTalkingFormCount > 0 then
  16549. begin
  16550. if MessageBox(Handle, '确实要退出吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  16551. Exit;
  16552. if Showing then
  16553. Close;
  16554. CloseAllTalkingForm;
  16555. iWaitTimes := 0;
  16556. while GetTalkingFormCount > 0 do
  16557. begin
  16558. Sleep(100);
  16559. Inc(iWaitTimes);
  16560. if iWaitTimes > 100 then
  16561. Break;
  16562. Application.ProcessMessages;
  16563. end;
  16564. end;
  16565. RealICQClient.Logout;
  16566. TTeamsAdapter.Stop;
  16567. end;
  16568. if Showing then
  16569. Close;
  16570. MainForm.OnClose := nil;
  16571. MainForm.Close;
  16572. TrueHiddenMainForm.Close;
  16573. end;
  16574. //------------------------------------------------------------------------------
  16575. procedure TMainForm.actConnectSetExecute(Sender: TObject);
  16576. begin
  16577. if OptionsForm <> nil then
  16578. Exit;
  16579. OptionsForm := TOptionsForm.Create(Self);
  16580. try
  16581. OptionsForm.PageIndex := 6;
  16582. OptionsForm.ShowModal;
  16583. finally
  16584. FreeAndNil(OptionsForm);
  16585. end;
  16586. end;
  16587. //------------------------------------------------------------------------------
  16588. procedure TMainForm.actCreateTeamExecute(Sender: TObject);
  16589. //var
  16590. // iLoop: Integer;
  16591. // Team: TRealICQTeam;
  16592. begin
  16593. // for iLoop := 0 to RealICQClient.Teams.Count - 1 do
  16594. // begin
  16595. // Team := RealICQClient.Teams.Objects[iLoop] as TRealICQTeam;
  16596. // if (not Team.IsTempTeam) and AnsiSameText(Team.TeamCreater, RealICQClient.LoginName) then
  16597. // begin
  16598. // MessageBox(Handle, '抱歉,您已经创建了一个群组了!', '提示', MB_ICONINFORMATION);
  16599. // Exit;
  16600. // end;
  16601. // end;
  16602. //if CreateTeamForm = nil then CreateTeamForm := TCreateTeamForm.Create(Self);
  16603. //CreateTeamForm.Show;
  16604. try
  16605. CreateTeamForm := TCreateTeamForm.Create(Self);
  16606. try
  16607. CreateTeamForm.ShowModal;
  16608. finally
  16609. FreeAndNil(CreateTeamForm);
  16610. end;
  16611. except
  16612. end;
  16613. end;
  16614. //------------------------------------------------------------------------------
  16615. procedure TMainForm.actCustomFacesManagerExecute(Sender: TObject);
  16616. begin
  16617. if CustomFacesManagerForm = nil then
  16618. CustomFacesManagerForm := TCustomFacesManagerForm.Create(Application);
  16619. CustomFacesManagerForm.Show;
  16620. end;
  16621. //------------------------------------------------------------------------------
  16622. procedure TMainForm.actAVSetExecute(Sender: TObject);
  16623. begin
  16624. WinExec(PChar('"' + ExtractFilePath(Application.ExeName) + AVSetExeFile + '" "' + ExtractFilePath(Application.ExeName) + 'Languages\' + MainForm.Language + '.ini' + '"'), SW_SHOWNORMAL);
  16625. end;
  16626. //------------------------------------------------------------------------------
  16627. procedure TMainForm.actChangePassExecute(Sender: TObject);
  16628. begin
  16629. if ChangePassForm <> nil then
  16630. Exit;
  16631. ChangePassForm := TChangePassForm.Create(Self);
  16632. try
  16633. ChangePassForm.ShowModal;
  16634. finally
  16635. FreeAndNil(ChangePassForm);
  16636. end;
  16637. end;
  16638. //------------------------------------------------------------------------------
  16639. procedure TMainForm.actCloseExecute(Sender: TObject);
  16640. begin
  16641. Close;
  16642. end;
  16643. //--------------------------------------------------------------
  16644. procedure ClearFileMissions;
  16645. var
  16646. iLoop, jLoop: Integer;
  16647. UploadMission: TUploadMission;
  16648. DownloadMission: TDownloadMission;
  16649. Missions: TStringList;
  16650. begin
  16651. for iLoop := FUploadMissions.Count - 1 downto 0 do
  16652. begin
  16653. UploadMission := FUploadMissions.Objects[iLoop] as TUploadMission;
  16654. try
  16655. FreeAndNil(UploadMission);
  16656. except
  16657. end;
  16658. end;
  16659. FUploadMissions.Clear;
  16660. for iLoop := FSavedUploadMissions.Count - 1 downto 0 do
  16661. begin
  16662. Missions := TStringList(FSavedUploadMissions[iLoop]);
  16663. for jLoop := Missions.Count - 1 downto 0 do
  16664. begin
  16665. UploadMission := Missions.Objects[jLoop] as TUploadMission;
  16666. try
  16667. FreeAndNil(UploadMission);
  16668. except
  16669. end;
  16670. end;
  16671. Missions.Clear;
  16672. FreeAndNil(Missions);
  16673. end;
  16674. FSavedUploadMissions.Clear;
  16675. for iLoop := FSavedDownloadMissions.Count - 1 downto 0 do
  16676. begin
  16677. Missions := TStringList(FSavedDownloadMissions[iLoop]);
  16678. for jLoop := Missions.Count - 1 downto 0 do
  16679. begin
  16680. DownloadMission := Missions.Objects[jLoop] as TDownloadMission;
  16681. try
  16682. FreeAndNil(DownloadMission);
  16683. except
  16684. end;
  16685. end;
  16686. Missions.Clear;
  16687. FreeAndNil(Missions);
  16688. end;
  16689. FSavedDownloadMissions.Clear;
  16690. for iLoop := FDownloadMissions.Count - 1 downto 0 do
  16691. begin
  16692. DownloadMission := FDownloadMissions.Objects[iLoop] as TDownloadMission;
  16693. try
  16694. FreeAndNil(DownloadMission);
  16695. except
  16696. end;
  16697. end;
  16698. FDownloadMissions.Clear;
  16699. end;
  16700. //---退出主程序-----------------------------------------------------
  16701. procedure TMainForm.QuitWindows;
  16702. var
  16703. iWaitTimes: Integer;
  16704. begin
  16705. RealICQClient.OnLoginFailed := nil;
  16706. if RealICQClient.Connected then
  16707. begin
  16708. if GetTalkingFormCount > 0 then
  16709. begin
  16710. if Showing then
  16711. Close;
  16712. CloseAllTalkingForm;
  16713. iWaitTimes := 0;
  16714. while GetTalkingFormCount > 0 do
  16715. begin
  16716. Sleep(100);
  16717. Inc(iWaitTimes);
  16718. if iWaitTimes > 100 then
  16719. Break;
  16720. Application.ProcessMessages;
  16721. end;
  16722. end;
  16723. RealICQClient.Logout;
  16724. end;
  16725. if Showing then
  16726. Close;
  16727. MainForm.OnClose := nil;
  16728. MainForm.Close;
  16729. TrueHiddenMainForm.Close;
  16730. end;
  16731. //-----获的天气信息--------------------------------------------------------
  16732. procedure TMainForm.GetWeather(City, Weatheren, Weather: string);
  16733. var
  16734. Data: CopyDataStruct;
  16735. Args: PChar;
  16736. weatherImgPath: string;
  16737. WeatherList: TStringList;
  16738. WeatherPanelWidth: Integer;
  16739. begin
  16740. lblWeatherCity.Caption := City;
  16741. lblWeatheren.Caption := Weatheren;
  16742. lblWeather.Caption := Weather;
  16743. weatherImgPath := ExtractFilePath(paramstr(0)) + 'Images\Weather\' + GetWeatherImgName(lblWeather.Caption);
  16744. if fileexists(weatherImgPath) then
  16745. imgWeather.Picture.LoadFromFile(weatherImgPath);
  16746. WeatherPanelWidth := lblWeatherCity.Left + lblWeatherCity.Width + 5 + imgWeather.Width + 5 + lblWeather.Width + 5 + lblWeatheren.Width;
  16747. if pnlWebSearch.Width - spbAddFriend.Left >= WeatherPanelWidth then
  16748. lblWeatherCity.Left := spbAddFriend.Left
  16749. else
  16750. lblWeatherCity.Left := btMainMenu.Left + btMainMenu.Width + 5;
  16751. imgWeather.Left := lblWeatherCity.Left + lblWeatherCity.Width + 5;
  16752. lblWeather.Left := imgWeather.Left + imgWeather.Width + 5;
  16753. lblWeatheren.Left := lblWeather.Left + lblWeather.Width + 5;
  16754. end;
  16755. procedure TMainForm.SetGetMoreUserEvent;
  16756. begin
  16757. RealICQClient.OnGettedMoreBranchList := RealICQClientGettedMoreBranchList;
  16758. RealICQClient.OnGettedMoreUserList := RealICQClientGettedMoreUserList;
  16759. if (MessageBoxForm <> nil) then
  16760. begin
  16761. FreeAndNil(MessageBoxForm);
  16762. MessageBoxForm := nil;
  16763. end;
  16764. end;
  16765. //------------------------------------------------------------------------------
  16766. procedure TMainForm.OpenWebTab(TabSheet: TTabSheet; WebPanel: TWebPanel; AcountIndex: Integer);
  16767. var
  16768. Panel, PanelForIE: TPanel;
  16769. WebBrowser: TWebBrowser;
  16770. begin
  16771. TabAcountIndex := AcountIndex;
  16772. Panel := TPanel.Create(TabSheet);
  16773. Panel.Parent := TabSheet;
  16774. Panel.DoubleBuffered := True;
  16775. Panel.Font.Color := spbDisplayName.Font.Color;
  16776. Panel.Caption := '页面加载中...';
  16777. Panel.Color := clWhite;
  16778. Panel.Align := alClient;
  16779. Panel.BevelInner := bvNone;
  16780. Panel.BevelOuter := bvNone;
  16781. Panel.Visible := True;
  16782. Application.ProcessMessages;
  16783. PanelForIE := TPanel.Create(Panel);
  16784. PanelForIE.Parent := Panel;
  16785. PanelForIE.Tag := TabSheet.Tag;
  16786. PanelForIE.DoubleBuffered := True;
  16787. PanelForIE.Color := clWhite;
  16788. PanelForIE.Align := alClient;
  16789. PanelForIE.BevelInner := bvNone;
  16790. PanelForIE.BevelOuter := bvNone;
  16791. PanelForIE.Visible := True;
  16792. Application.ProcessMessages;
  16793. WebBrowser := TWebBrowser.Create(PanelForIE);
  16794. WebBrowser.DoubleBuffered := True;
  16795. WebBrowser.ParentWindow := PanelForIE.Handle;
  16796. WebBrowser.Align := alClient;
  16797. WebBrowser.Visible := True;
  16798. WebBrowser.Tag := TabSheet.Tag;
  16799. WebBrowser.RegisterAsBrowser := True;
  16800. WebBrowser.RegisterAsDropTarget := True;
  16801. //WebBrowser.OnBeforeNavigate2 := WebBrowserRightBeforeNavigate2;
  16802. if WebPanel.FNavigateType = ntFill then
  16803. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentCompleteForPost
  16804. else
  16805. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16806. PanelForIE.InsertControl(WebBrowser);
  16807. Application.ProcessMessages;
  16808. if DisplayWebs then
  16809. begin
  16810. if WebPanel.FNavigateType = ntFill then
  16811. WebBrowser.Navigate(WebPanel.FURL)
  16812. else
  16813. WebBrowser.Navigate('about:blank');
  16814. end;
  16815. end;
  16816. //-------------------------------------------------------
  16817. procedure TMainForm.LoadMainTabImage;
  16818. begin
  16819. MyContactersIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '1.bmp');
  16820. SysMsgIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '2.bmp');
  16821. MyFriendIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '3.bmp');
  16822. MyTeamIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '4.bmp');
  16823. LatestsIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '5.bmp');
  16824. end;
  16825. //------------------------------------------------------------------------------
  16826. //下载升级配置文件
  16827. //------------------------------------------------------------------------------
  16828. procedure TMainForm.DownLoadUpdateConfig;
  16829. var
  16830. TempDir: string;
  16831. begin
  16832. TempDir := GetMyDocument + '\Update';
  16833. if not DirectoryExists(TempDir) then
  16834. ForceDirectories(TempDir);
  16835. if FileExists(GetMyDocument + '\Update\Update.dat') then
  16836. begin
  16837. SetFileAttributes(pchar(GetMyDocument + '\Update\Update.dat'), file_attribute_normal);
  16838. DeleteFile(GetMyDocument + '\Update\Update.dat');
  16839. end;
  16840. FDownFile.ThreadDownFile('http://' + MainForm.RealICQClient.RemoteAddress + '/Update/Update.dat', TempDir + '\Update.dat');
  16841. end;
  16842. //------------------------------------------------------------------------------
  16843. //文件下载完成事件处理函数
  16844. //-----------------------------------------------------------------------------=
  16845. procedure TMainForm.DownFaceFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  16846. begin
  16847. ShowGettedFace(Dest_file);
  16848. end;
  16849. procedure TMainForm.DownFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  16850. var
  16851. OldVersion, Version: string;
  16852. F: Textfile;
  16853. City, Weatheren, Weather: string;
  16854. function GetVersionFromIniFile(FileName: string): string;
  16855. var
  16856. IniFile: TIniFile;
  16857. begin
  16858. IniFile := TIniFile.Create(ExtractFilePath(paramstr(0)) + 'Update.dat');
  16859. try
  16860. OldVersion := IniFile.ReadString('Version', 'Version', '1.0.0.0');
  16861. finally
  16862. IniFile.Free;
  16863. end;
  16864. end;
  16865. begin
  16866. if FileExists(Dest_file) then
  16867. begin
  16868. if UpperCase(ExtractFileExt(Dest_file)) = '.DAT' then
  16869. begin
  16870. OldVersion := '1.0.0.0';
  16871. if FileExists(ExtractFilePath(paramstr(0)) + 'Update.dat') then
  16872. OldVersion := GetVersionFromIniFile(ExtractFilePath(paramstr(0)) + 'Update.dat');
  16873. if FileExists(GetMyDocument + '\Update\Update.dat') then
  16874. Version := GetVersionFromIniFile(GetMyDocument + '\Update\Update.dat');
  16875. if trim(OldVersion) <> trim(Version) then
  16876. WinExec('Update.exe', SW_SHOW);
  16877. end
  16878. else
  16879. begin
  16880. AssignFile(F, Dest_file);
  16881. try
  16882. Reset(F);
  16883. Readln(F, City);
  16884. Readln(F, Weatheren);
  16885. Readln(F, Weather);
  16886. GetWeather(City, Weatheren, Weather);
  16887. finally
  16888. Closefile(F); {关闭文件 F}
  16889. end;
  16890. end;
  16891. end;
  16892. end;
  16893. //------------------------------------------------------------------------------
  16894. //
  16895. //------------------------------------------------------------------------------
  16896. procedure TMainForm.RealICQClientGettedSysMsgInterfaces(Sender: TObject);
  16897. begin
  16898. //
  16899. end;
  16900. //------------------------------------------------------------------------------
  16901. function TMainForm.GetBranchName(LoginName: string): string;
  16902. var
  16903. ItemIndex: Integer;
  16904. Branch: TRealICQBranch;
  16905. Employee: TRealICQEmployee;
  16906. Node: TTreeNode;
  16907. RealICQContacterTreeView: TRealICQContacterTreeView;
  16908. begin
  16909. Result := '';
  16910. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  16911. begin
  16912. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  16913. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  16914. end
  16915. else
  16916. begin
  16917. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMyContacters);
  16918. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  16919. end;
  16920. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  16921. if (Employee = nil) then
  16922. Exit;
  16923. Node := Employee.Node.Parent;
  16924. Result := Node.Text;
  16925. while Node.Parent <> nil do
  16926. begin
  16927. Node := Node.Parent;
  16928. if Node = nil then
  16929. Break;
  16930. if Node.Parent <> nil then
  16931. Result := Node.Text + '/' + Result;
  16932. end;
  16933. end;
  16934. //------------------------------------------------------------------------------
  16935. function TMainForm.GetCompany: string;
  16936. var
  16937. iIndex: Integer;
  16938. ServerInfo: TServerInfo;
  16939. begin
  16940. Result := '';
  16941. if (FServerInfoList.IndexOf(MainForm.CurrentServerID) < 0) or (FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID) < 0) then
  16942. Exit;
  16943. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  16944. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.CurrentServerID)] as (TServerInfo)
  16945. else
  16946. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID)] as (TServerInfo);
  16947. if Assigned(ServerInfo) then
  16948. Result := ServerInfo.ServerName;
  16949. end;
  16950. //------------------------------------------------------------------------------
  16951. //用post方式提交XML文件到服务器
  16952. //------------------------------------------------------------------------------
  16953. procedure TMainForm.PostUpdateLog;
  16954. function ReadUpdateLog: string;
  16955. var
  16956. XMLFile: string;
  16957. ConfigNode: IXMLNode;
  16958. XMLDocument: TXMLDocument;
  16959. begin
  16960. Result := '';
  16961. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  16962. XMLDocument := TXMLDocument.Create(Self);
  16963. try
  16964. try
  16965. if FileExists(XMLFile) then
  16966. begin
  16967. XMLDocument.Active := True;
  16968. XMLDocument.LoadFromFile(XMLFile);
  16969. ConfigNode := XMLDocument.DocumentElement;
  16970. if ConfigNode.ChildNodes.FindNode('product').Attributes['status'] then
  16971. begin
  16972. Result := XMLDocument.XML.Text;
  16973. end;
  16974. end;
  16975. except
  16976. on E: EXception do
  16977. end;
  16978. finally
  16979. XMLDocument.Free;
  16980. end;
  16981. end;
  16982. var
  16983. XMLStr, Url: string;
  16984. begin
  16985. Url := GetUpdateLogPostUrl(ExtractFilePath(paramstr(0)) + 'Online.ini');
  16986. if Url = '' then
  16987. Url := DefaultUpdateLogPostUrl;
  16988. Url := Url + '?LoginName=' + RealICQClient.LoginName + '&DisplayName=' + HttpEncode(AnsiToUtf8(RealICQClient.Me.DisplayName)) + '&ServerName=' + HttpEncode(AnsiToUtf8(edServerList.Text));
  16989. XMLStr := ReadUpdateLog;
  16990. if XMLStr <> '' then
  16991. begin
  16992. TThreadPost.Create(Url, XMLStr);
  16993. end;
  16994. end;
  16995. //------------------------------------------------------------------------------
  16996. procedure TMainForm.UpdatePostLogState(Status: Boolean);
  16997. var
  16998. XMLFile: string;
  16999. ConfigNode: IXMLNode;
  17000. XMLDocument: TXMLDocument;
  17001. begin
  17002. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  17003. XMLDocument := TXMLDocument.Create(Self);
  17004. try
  17005. try
  17006. if FileExists(XMLFile) then
  17007. begin
  17008. XMLDocument.Active := True;
  17009. XMLDocument.LoadFromFile(XMLFile);
  17010. ConfigNode := XMLDocument.DocumentElement;
  17011. ConfigNode.ChildNodes.FindNode('product').Attributes['status'] := Status;
  17012. XMLDocument.SaveToFile(XMLFile);
  17013. end;
  17014. except
  17015. end;
  17016. finally
  17017. XMLDocument.Free;
  17018. end;
  17019. end;
  17020. constructor TThreadPost.Create(URL, Content: string);
  17021. begin
  17022. inherited Create(True);
  17023. FURL := URL;
  17024. FContent := Content;
  17025. FreeOnTerminate := True;
  17026. Resume;
  17027. end;
  17028. procedure TThreadPost.Execute;
  17029. var
  17030. IdHttp: TIdHTTP;
  17031. Sends: TStrings;
  17032. begin
  17033. IdHttp := TIdHTTP.Create(nil);
  17034. Sends := TStringList.Create;
  17035. try
  17036. IdHttp.Request.ContentType := 'application/x-www-form-urlencoded';
  17037. Sends.Add('XmlStr=' + StrToBase64(FContent));
  17038. IdHttp.Post(FUrl, Sends);
  17039. MainForm.UpdatePostLogState(False);
  17040. finally
  17041. FreeAndNil(IdHttp);
  17042. Sends.Free;
  17043. end;
  17044. end;
  17045. //---------------检测指定的进程是否运行-----------------------------------------
  17046. constructor TCheckRunProcessThread.Create(AProgramName, AProcessPath: string);
  17047. begin
  17048. inherited Create(True);
  17049. ProgramName := AProgramName;
  17050. ProcessPath := AProcessPath;
  17051. FreeOnTerminate := True;
  17052. Resume;
  17053. end;
  17054. //------------得到进程的执行路径------------------------------------------------
  17055. function TCheckRunProcessThread.GetProcessPath(ProcessID: DWORD): string;
  17056. var
  17057. Hand: THandle;
  17058. ModName: array[0..Max_Path - 1] of Char;
  17059. hMod: HModule;
  17060. n: DWORD;
  17061. begin
  17062. Result := '';
  17063. Hand := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, ProcessID);
  17064. if Hand > 0 then
  17065. try
  17066. ENumProcessModules(Hand, @hMod, Sizeof(hMod), n);
  17067. if GetModuleFileNameEx(Hand, hMod, ModName, Sizeof(ModName)) > 0 then
  17068. Result := ModName; //得到路径和文见名
  17069. except
  17070. end;
  17071. end;
  17072. //根据可执行文件名称查找进程列表,以判断程序是否正在运行。
  17073. function TCheckRunProcessThread.FindProcess(AFileName: string): boolean;
  17074. var
  17075. hSnapshot: THandle; //用于获得进程列表
  17076. lppe: TProcessEntry32; //用于查找进程
  17077. Found: Boolean; //用于判断进程遍历是否完成
  17078. ProcessPath: string;
  17079. begin
  17080. Result := False;
  17081. hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); //获得系统进程列表
  17082. lppe.dwSize := SizeOf(TProcessEntry32); //在调用Process32First API之前,需要初始化lppe记录的大小
  17083. Found := Process32First(hSnapshot, lppe); //将进程列表的第一个进程信息读入ppe记录中
  17084. while Found do
  17085. begin
  17086. ProcessPath := GetProcessPath(lppe.th32ProcessID);
  17087. if UpperCase(ProcessPath) = UpperCase(AFileName) then
  17088. begin
  17089. Result := True;
  17090. end;
  17091. Found := Process32Next(hSnapshot, lppe); //将进程列表的下一个进程信息读入lppe记录中
  17092. end;
  17093. end;
  17094. //------------------------------------------------------------------------------
  17095. procedure TCheckRunProcessThread.Execute;
  17096. begin
  17097. while FindProcess(ProcessPath) do
  17098. begin
  17099. Sleep(1000);
  17100. end;
  17101. MainForm.PostUpdateLog;
  17102. end;
  17103. procedure TMainForm.btOAClick(Sender: TObject);
  17104. begin
  17105. MessageBox(Handle, '协同办公系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17106. end;
  17107. procedure TMainForm.btSwapClick(Sender: TObject);
  17108. begin
  17109. MessageBox(Handle, '公文交换系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17110. end;
  17111. initialization
  17112. HookID := 0;
  17113. FUploadMissions := TStringList.Create;
  17114. FSavedUploadMissions := TList.Create;
  17115. FDownloadMissions := TStringList.Create;
  17116. FSavedDownloadMissions := TList.Create;
  17117. CoInitialize(nil);
  17118. OleInitialize(nil);
  17119. finalization
  17120. try
  17121. ClearFileMissions;
  17122. FreeAndNil(FSavedDownloadMissions);
  17123. FreeAndNil(FSavedUploadMissions);
  17124. FreeAndNil(FUploadMissions);
  17125. FreeAndNil(FDownloadMissions);
  17126. OleUninitialize;
  17127. CoUninitialize;
  17128. except
  17129. end;
  17130. end.