MainFrm.pas 674 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937
  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. end;
  12681. {$endregion}
  12682. {$region '添加部门'}
  12683. for iLoop := RealICQClient.MoreBranchs2.Count - 1 downto 0 do
  12684. begin
  12685. BranchInfo := RealICQClient.MoreBranchs2.Objects[iLoop] as TRealICQBranchInfo;
  12686. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12687. begin
  12688. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12689. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12690. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12691. Branch.Update;
  12692. Continue;
  12693. end;
  12694. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12695. Branch.BranchID := BranchInfo.ID;
  12696. Branch.ParentID := BranchInfo.ParentID;
  12697. if Branch.ParentID = '0' then
  12698. begin
  12699. TopBranch := Branch;
  12700. //EmployeeCount:=EmployeeCount-BranchInfo.EmployeeCount;
  12701. if BranchInfo.EmployeeCount > 0 then
  12702. begin
  12703. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12704. end;
  12705. end;
  12706. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12707. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12708. //if Branch.BranchID<>TmpBranch.BranchID then continue;
  12709. RealICQContacterTreeView.AddBranch(Branch);
  12710. Application.ProcessMessages;
  12711. end;
  12712. {$endregion}
  12713. if TmpBranch <> nil then
  12714. begin
  12715. TmpBranch.Node.Expanded := True;
  12716. TmpBranch.IsGetUserList := True;
  12717. // ItemIndex := FGetUsersTask.IndexOf(TmpBranch.BranchID);
  12718. // if ItemIndex >= 0 then FGetUsersTask.Delete(ItemIndex);
  12719. // if FGetUsersTask.Count > 0 then GetBranchUser(FGetUsersTask.Objects[0] as TRealICQBranch);
  12720. end;
  12721. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12722. finally
  12723. RealICQContacterTreeView.EndUpdate;
  12724. tsContacters.EnableAlign;
  12725. end;
  12726. end;
  12727. procedure TMainForm.RealICQClientGettedPermission(Sender: TObject);
  12728. begin
  12729. //
  12730. spbNetworkBackup.Visible := RealICQClient.UserPermission.EnableBackup;
  12731. end;
  12732. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteBeControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12733. var
  12734. TalkingForm: TTalkingForm;
  12735. begin
  12736. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12737. if TalkingForm = nil then
  12738. Exit;
  12739. if TalkingForm.CanWriteMessage then
  12740. TalkingForm.ShowGettedRemoteControlTransmiteControlBeControlResponse(AAcceptted);
  12741. end;
  12742. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteConnectted(Sender: TObject; ALoginName: string);
  12743. var
  12744. TalkingForm: TTalkingForm;
  12745. begin
  12746. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12747. if TalkingForm = nil then
  12748. Exit;
  12749. if TalkingForm.CanWriteMessage then
  12750. TalkingForm.ShowGettedRemoteControlTransmiteConnectted;
  12751. end;
  12752. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  12753. var
  12754. TalkingForm: TTalkingForm;
  12755. begin
  12756. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12757. if TalkingForm = nil then
  12758. Exit;
  12759. if TalkingForm.CanWriteMessage then
  12760. TalkingForm.ShowGettedRemoteControlTransmiteControlRequest;
  12761. end;
  12762. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12763. var
  12764. TalkingForm: TTalkingForm;
  12765. begin
  12766. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12767. if TalkingForm = nil then
  12768. Exit;
  12769. if TalkingForm.CanWriteMessage then
  12770. TalkingForm.ShowGettedRemoteControlTransmiteControlControlResponse(AAcceptted);
  12771. end;
  12772. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  12773. var
  12774. AShowActive: Boolean;
  12775. TalkingForm: TTalkingForm;
  12776. iWaitTimes: Integer;
  12777. begin
  12778. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  12779. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12780. if TalkingForm = nil then
  12781. begin
  12782. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  12783. end;
  12784. iWaitTimes := 0;
  12785. while not TalkingForm.CanWriteMessage do
  12786. begin
  12787. Application.ProcessMessages;
  12788. Inc(iWaitTimes);
  12789. if iWaitTimes > 1000 then
  12790. break;
  12791. Sleep(10);
  12792. end;
  12793. if (GetForegroundWindow <> TalkingForm.Handle) then
  12794. begin
  12795. FlashWindow(TalkingForm.Handle, True);
  12796. if PlaySoundOnGetMessage then
  12797. PlayEventSound(FMessageEventSound);
  12798. end;
  12799. TalkingForm.ShowGettedRemoteControlTransmiteRequest;
  12800. end;
  12801. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12802. var
  12803. TalkingForm: TTalkingForm;
  12804. begin
  12805. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12806. if TalkingForm = nil then
  12807. Exit;
  12808. if TalkingForm.CanWriteMessage then
  12809. TalkingForm.ShowGettedRemoteControlTransmiteResponse(AAcceptted);
  12810. end;
  12811. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenImage(Sender: TObject; ALoginName: string; ALeft, ATop, AWidth, AHeight: Integer; AP: TPoint; ABitmap: TBitmap);
  12812. begin
  12813. if RemoteControlForm = nil then
  12814. Exit;
  12815. RemoteControlForm.imgRCScreen.Picture.Bitmap.Canvas.CopyRect(Rect(ALeft, ATop, ALeft + AWidth, ATop + AHeight), ABitmap.canvas, Rect(0, 0, ABitmap.width, ABitmap.height)); //拷贝
  12816. end;
  12817. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenSize(Sender: TObject; ALoginName: string; AWidth, AHeight: Integer);
  12818. var
  12819. TalkingForm: TTalkingForm;
  12820. begin
  12821. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12822. if TalkingForm = nil then
  12823. Exit;
  12824. TalkingForm.ShowGettedRemoteControlTransmiteRecvedScreenSize(AWidth, AHeight);
  12825. end;
  12826. //------------------------------------------------------------------------------
  12827. procedure TMainForm.CheckCacheDir;
  12828. var
  12829. DSearchRec: TSearchRec;
  12830. FindResult: Integer;
  12831. begin
  12832. FindResult := FindFirst(CacheDir + '*' + CacheFileExt, faAnyFile, DSearchRec);
  12833. while FindResult = 0 do
  12834. begin
  12835. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  12836. begin
  12837. try
  12838. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  12839. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12840. except
  12841. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  12842. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12843. end;
  12844. end;
  12845. FindResult := FindNext(DSearchRec);
  12846. end;
  12847. FindResult := FindFirst(CacheDir + '*' + CacheResumeSizeFileExt, faAnyFile, DSearchRec);
  12848. while FindResult = 0 do
  12849. begin
  12850. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  12851. begin
  12852. try
  12853. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  12854. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12855. except
  12856. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  12857. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12858. end;
  12859. end;
  12860. FindResult := FindNext(DSearchRec);
  12861. end;
  12862. if GetDirectorySize(CacheDir) > MaxCacheDirSize * 1024 * 1024 then
  12863. begin
  12864. if MessageBox(Handle, PChar('Cache目录的大小已经超过 ' + IntToStr(MaxCacheDirSize) + 'MB,是否打开Cache目录进行管理?'), '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_OK then
  12865. WinExec(PChar('explorer "' + CacheDir + '"'), SW_SHOWNORMAL);
  12866. end;
  12867. end;
  12868. //------------------------------------------------------------------------------
  12869. procedure TMainForm.ShowWebTabs;
  12870. var
  12871. iLoop: Integer;
  12872. TabSheet: TTabSheet;
  12873. Bitmap: TBitmap;
  12874. WebPanel: TWebPanel;
  12875. EUser, EPass: string;
  12876. begin
  12877. //先删除
  12878. try
  12879. for iLoop := 0 to FWebTabs.Count - 1 do
  12880. begin
  12881. TabSheet := FWebTabs[iLoop];
  12882. TabSheet.OnShow := nil;
  12883. TabSheet.PageControl := nil;
  12884. FreeAndNil(TabSheet);
  12885. end;
  12886. except
  12887. end;
  12888. FWebTabs.Clear;
  12889. //显示
  12890. pgcMainWorkArea.DisableAlign;
  12891. try
  12892. for iLoop := 0 to FWebPanels.Count - 1 do
  12893. begin
  12894. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12895. if (not WebPanel.Show) and (not WebPanel.MustShow) then
  12896. Continue;
  12897. if ((AnsiPos('邮件', WebPanel.FName) > 0) or (AnsiPos('邮箱', WebPanel.FName) > 0) or (AnsiPos('信箱', WebPanel.FName) > 0)) and (WebPanel.MustShow) then
  12898. begin
  12899. if WebPanel.UserIMLoginName then
  12900. EUser := RealICQClient.LoginName
  12901. else
  12902. EUser := WebPanel.CustomLoginName;
  12903. if WebPanel.UserIMPassword then
  12904. EPass := RealICQClient.Password
  12905. else
  12906. EPass := WebPanel.CustomPassword;
  12907. //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]));
  12908. end;
  12909. TabSheet := TTabSheet.Create(pgcMainWorkArea);
  12910. TabSheet.Parent := pgcMainWorkArea;
  12911. TabSheet.DoubleBuffered := True;
  12912. TabSheet.Caption := WebPanel.Name;
  12913. TabSheet.ShowHint := False;
  12914. if FileExists(WebPanel.Image) then
  12915. begin
  12916. Bitmap := GetSamllBitmap(WebPanel.Image, 32, 32, False);
  12917. try
  12918. try
  12919. Bitmap.LoadFromFile(WebPanel.Image);
  12920. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  12921. ImgLstPageControl.Add(Bitmap, nil);
  12922. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  12923. except
  12924. //
  12925. end;
  12926. finally
  12927. FreeAndNil(Bitmap);
  12928. end;
  12929. end
  12930. else
  12931. TabSheet.ImageIndex := 2; //?号图标
  12932. TabSheet.OnShow := WebTabShow;
  12933. TabSheet.Tag := iLoop;
  12934. TabSheet.PageControl := pgcMainWorkArea;
  12935. FWebTabs.Add(TabSheet);
  12936. end;
  12937. finally
  12938. pgcMainWorkArea.EnableAlign;
  12939. end;
  12940. end;
  12941. //------------------------------------------------------------------------------
  12942. procedure TMainForm.RealICQClientGetWebTabs(Sender: TObject; ATabCount: Integer; WebTabRecords: array of TWebTabRecord);
  12943. var
  12944. iLoop, jLoop: Integer;
  12945. WebTabRecord: TWebTabRecord;
  12946. WebPanel: TWebPanel;
  12947. FFinded: Boolean;
  12948. AWebPanels: TStringList;
  12949. begin
  12950. LoadWebPanelsFromXML;
  12951. AWebPanels := TStringList.Create;
  12952. for iLoop := 0 to FWebPanels.Count - 1 do
  12953. begin
  12954. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12955. AWebPanels.AddObject(WebPanel.ID, WebPanel);
  12956. end;
  12957. FWebPanels.Clear;
  12958. for iLoop := Low(WebTabRecords) to High(WebTabRecords) do
  12959. begin
  12960. WebTabRecord := WebTabRecords[iLoop];
  12961. if AWebPanels.IndexOf(WebTabRecord.ID) < 0 then
  12962. begin
  12963. WebPanel := TWebPanel.Create;
  12964. //FWebPanels.AddObject(WebTabRecord.Name, WebPanel);
  12965. WebPanel.FUserIMLoginName := True;
  12966. WebPanel.FUserIMPassword := True;
  12967. WebPanel.FCustomLoginName := '';
  12968. WebPanel.FCustomPassword := '';
  12969. WebPanel.FShow := False;
  12970. end
  12971. else
  12972. begin
  12973. WebPanel := AWebPanels.Objects[AWebPanels.IndexOf(WebTabRecord.ID)] as TWebPanel;
  12974. end;
  12975. WebPanel.MustShow := WebTabRecord.MustShow;
  12976. if WebPanel.MustShow then
  12977. WebPanel.FShow := True;
  12978. WebPanel.FID := WebTabRecord.ID;
  12979. WebPanel.FName := WebTabRecord.Name;
  12980. WebPanel.FURL := WebTabRecord.URL;
  12981. WebPanel.FImage := WebTabRecord.IconFile;
  12982. WebPanel.Content := WebTabRecord.Content;
  12983. if AnsiSameText(WebTabRecord.Method, 'GET') then
  12984. WebPanel.FNavigateType := ntGET
  12985. else if AnsiSameText(WebTabRecord.Method, 'POST') then
  12986. WebPanel.FNavigateType := ntPOST
  12987. else
  12988. WebPanel.FNavigateType := ntFill;
  12989. WebPanel.FPostFields := WebTabRecord.PostFields;
  12990. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  12991. end;
  12992. {for iLoop := FWebPanels.Count - 1 downto 0 do
  12993. begin
  12994. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12995. //if WebPanel.MustShow then
  12996. begin
  12997. FFinded := False;
  12998. for jLoop := Low(WebTabRecords) to High(WebTabRecords) do
  12999. begin
  13000. WebTabRecord := WebTabRecords[jLoop];
  13001. if AnsiSameStr(WebTabRecord.ID, WebPanel.ID) then
  13002. begin
  13003. FFinded := True;
  13004. Break;
  13005. end;
  13006. end;
  13007. if not FFinded then
  13008. begin
  13009. FreeAndNil(WebPanel);
  13010. FWebPanels.Delete(iLoop);
  13011. end;
  13012. end;
  13013. end; }
  13014. SaveWebPanelsToXML;
  13015. DisplayWebs := False;
  13016. ShowWebTabs;
  13017. DisplayWebs := True;
  13018. end;
  13019. //------------------------------------------------------------------------------
  13020. procedure TMainForm.RealICQClientInputting(Sender: TObject; ALoginName: string; AInputting: Boolean);
  13021. var
  13022. TalkingForm: TTalkingForm;
  13023. begin
  13024. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  13025. if TalkingForm = nil then
  13026. Exit;
  13027. TalkingForm.ShowInputting(AInputting);
  13028. end;
  13029. //------------------------------------------------------------------------------
  13030. procedure TMainForm.RealICQClientJoinedTeam(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13031. var
  13032. AlertMessage: string;
  13033. RealICQUser: TRealICQUser;
  13034. begin
  13035. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13036. if RealICQUser.DisplayName = '' then
  13037. AlertMessage := RealICQUser.LoginName
  13038. else
  13039. AlertMessage := RealICQUser.DisplayName;
  13040. if ARealICQTeam.IsTempTeam then
  13041. AlertMessage := AlertMessage + ' 将您添加进了 临时多人会话'
  13042. else
  13043. AlertMessage := AlertMessage + ' 将您添加进了群组: ' + ARealICQTeam.TeamCaption;
  13044. ShowNotifyAlertForm(AlertMessage);
  13045. AddMessageHistory(smSimple, AlertMessage, nil);
  13046. UpdateTeamTalkingForm(ARealICQTeam);
  13047. end;
  13048. //------------------------------------------------------------------------------
  13049. procedure TMainForm.RealICQClientJoinTeamRequest(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName, ATag: string);
  13050. begin
  13051. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ARealICQTeam.TeamCaption, ARealICQTeam.TeamID]), nil);
  13052. ShowJoinTeamRequestWindow(Self, ARealICQTeam.TeamID, ARealICQTeam.TeamCaption, ALoginName, ATag);
  13053. end;
  13054. //------------------------------------------------------------------------------
  13055. procedure TMainForm.RealICQClientJoinTeamResponse(Sender: TObject; ATeamID: string; ALoginName: string; ATag: string; AAcceptted: Boolean);
  13056. var
  13057. ATeam: TRealICQTeam;
  13058. begin
  13059. ATeam := TTeamsAdapter.GetTeam(ATeamID);
  13060. if ATeam = nil then
  13061. Exit;
  13062. if AAcceptted then
  13063. begin
  13064. AddMessageHistory(smSimple, ALoginName + ' 接受了您加入群组 ' + ATeam.TeamCaption + ' 的请求', nil);
  13065. ShowNotifyAlertForm(ALoginName + ' 接受您加入群组 ' + ATeam.TeamCaption + ' 的请求');
  13066. end
  13067. else
  13068. begin
  13069. if Length(ATag) = 0 then
  13070. ATag := '无';
  13071. AddMessageHistory(smSimple, ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption, nil);
  13072. ShowNotifyAlertForm(ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption + #$D#$A + '附言 :' + ATag);
  13073. end;
  13074. end;
  13075. //------------------------------------------------------------------------------
  13076. procedure TMainForm.RealICQClientTeamDisbanded(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13077. var
  13078. iIndex: Integer;
  13079. AlertMessage: string;
  13080. RealICQUser: TRealICQUser;
  13081. begin
  13082. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13083. if iIndex >= 0 then
  13084. begin
  13085. FLVTeams.Items.Delete(iIndex);
  13086. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13087. if RealICQUser = RealICQClient.Me then
  13088. AlertMessage := '您'
  13089. else if RealICQUser.DisplayName = '' then
  13090. AlertMessage := RealICQUser.LoginName
  13091. else
  13092. AlertMessage := RealICQUser.DisplayName;
  13093. if ARealICQTeam.IsTempTeam then
  13094. AlertMessage := AlertMessage + ' 解散了 多人对话'
  13095. else
  13096. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  13097. ShowNotifyAlertForm(AlertMessage);
  13098. AddMessageHistory(smSimple, AlertMessage, nil);
  13099. ShowNavBarNumeric;
  13100. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13101. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13102. UpdateTeamTalkingForm(ARealICQTeam);
  13103. end;
  13104. end;
  13105. procedure TMainForm.RealICQClientTeamQuitted(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName: string);
  13106. var
  13107. iIndex: Integer;
  13108. AlertMessage: string;
  13109. begin
  13110. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13111. if iIndex >= 0 then
  13112. begin
  13113. FLVTeams.Items.Delete(iIndex);
  13114. if ARealICQTeam.IsTempTeam then
  13115. AlertMessage := '您 退出了 多人对话'
  13116. else
  13117. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  13118. ShowNotifyAlertForm(AlertMessage);
  13119. AddMessageHistory(smSimple, AlertMessage, nil);
  13120. ShowNavBarNumeric;
  13121. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13122. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13123. UpdateTeamTalkingForm(ARealICQTeam);
  13124. end;
  13125. end;
  13126. //------------------------------------------------------------------------------
  13127. procedure TMainForm.SetFlashCaptionOnOnlineValue(Value: Boolean);
  13128. var
  13129. iLoop: Integer;
  13130. GroupName: string;
  13131. RealICQContacterListView: TRealICQContacterListView;
  13132. RealICQContacterTreeView: TRealICQContacterTreeView;
  13133. begin
  13134. for iLoop := 0 to FContacterListViews.Count - 1 do
  13135. begin
  13136. GroupName := FContacterListViews[iLoop];
  13137. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  13138. RealICQContacterListView.FlashCaptionOnOnline := Value and (GroupName <> LVStrangers) and (GroupName <> LVBlacklists) and (GroupName <> LVLatests);
  13139. end;
  13140. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  13141. begin
  13142. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  13143. RealICQContacterTreeView.FlashCaptionOnOnline := Value;
  13144. RealICQContacterTreeView.ReDrawAll;
  13145. end;
  13146. end;
  13147. //------------------------------------------------------------------------------
  13148. procedure TMainForm.RealICQClientUserExInformationChanged(Sender: TObject; RealICQUser: TRealICQUser);
  13149. begin
  13150. if (OptionsForm <> nil) and (RealICQUser = RealICQClient.Me) then
  13151. begin
  13152. OptionsForm.GetSets;
  13153. end;
  13154. // UpdateSeeInformationForm(RealICQUser);
  13155. UpdateTalkingForm(RealICQUser);
  13156. UpdateSMSForm(RealICQUser);
  13157. end;
  13158. //------------------------------------------------------------------------------
  13159. procedure TMainForm.RealICQClientUserInformationReady(Sender: TObject; RealICQUser: TRealICQUser);
  13160. var
  13161. ItemIndex: Integer;
  13162. RealICQContacterListItem: TRealICQContacterListItem;
  13163. RealICQContacterListView: TRealICQContacterListView;
  13164. RealICQFriendTreeView: TRealICQContacterTreeView;
  13165. RealICQContacterTreeView: TRealICQContacterTreeView;
  13166. Employee: TRealICQEmployee;
  13167. Friend: TRealICQEmployee;
  13168. iIndex, iLoop, jLoop: Integer;
  13169. GroupName: string;
  13170. GroupMembers: TStringList;
  13171. begin
  13172. if UserCardForm <> nil then
  13173. begin
  13174. if AnsiSameText(UserCardForm.LoginName, RealICQUser.LoginName) then
  13175. UserCardForm.LoginName := RealICQUser.LoginName;
  13176. end;
  13177. {$region '如果正处于过滤用户的状态,则同时也更新FSearchListView中的数据'}
  13178. if FSearchListViewInVisible then
  13179. begin
  13180. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  13181. if ItemIndex >= 0 then
  13182. begin
  13183. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13184. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13185. end;
  13186. end;
  13187. {$endregion}
  13188. {$region '更新“最近联系人列表”中的数据'}
  13189. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  13190. if ItemIndex >= 0 then
  13191. begin
  13192. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13193. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13194. end;
  13195. {$endregion}
  13196. if TUsersService.GetUsersService.IsWorkmateOrFriend(RealICQUser.LoginName) then
  13197. begin
  13198. {$region 'wmCorporation工作模式或采用了树型方式组织好友列表'}
  13199. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  13200. ShowMeInformation;
  13201. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  13202. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13203. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13204. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13205. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13206. if Employee <> nil then
  13207. begin
  13208. UpdateEmployeeNode(Employee, RealICQUser, True);
  13209. end;
  13210. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  13211. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13212. Friend := RealICQFriendTreeView.GetEmployee(RealICQUser.LoginName);
  13213. if Friend <> nil then
  13214. begin
  13215. UpdateFriendNode(Friend, RealICQUser, True);
  13216. end;
  13217. if RealICQClient.WorkingMode = wmCorporation then
  13218. begin
  13219. {$region '更新自定义组中的信息'}
  13220. for iLoop := 0 to FGroups.Count - 1 do
  13221. begin
  13222. GroupName := FGroups[iLoop];
  13223. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  13224. for jLoop := 0 to GroupMembers.Count - 1 do
  13225. begin
  13226. if AnsiSameText(GroupMembers[jLoop], RealICQClient.LoginName) then
  13227. begin
  13228. iIndex := FContacterListViews.IndexOf(GroupName);
  13229. if iIndex >= 0 then
  13230. begin
  13231. RealICQContacterListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  13232. if RealICQContacterListView.Items.IndexOf(RealICQClient.LoginName) = -1 then
  13233. RealICQContacterListView.Items.Add(RealICQClient.LoginName);
  13234. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  13235. if ItemIndex >= 0 then
  13236. begin
  13237. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13238. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13239. end;
  13240. end; //if
  13241. end; //if
  13242. end; //for jLoop
  13243. end; //for iLoop
  13244. {$endregion}
  13245. end;
  13246. {$endregion}
  13247. end;
  13248. if RealICQClient.MoreUsers.IndexOf(RealICQUser.LoginName) >= 0 then
  13249. begin
  13250. {$region '更新“全市”中的数据'}
  13251. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  13252. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13253. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13254. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13255. RealICQContacterTreeView.OnItemOnline := nil;
  13256. RealICQContacterTreeView.OnItemOffline := nil;
  13257. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  13258. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13259. if Employee <> nil then
  13260. begin
  13261. UpdateEmployeeNode(Employee, RealICQUser, True);
  13262. end;
  13263. {$endregion}
  13264. end;
  13265. // UpdateSeeInformationForm(RealICQUser);
  13266. UpdateTalkingForm(RealICQUser);
  13267. UpdateSMSForm(RealICQUser);
  13268. UpdateMemberInfoOfTeamOptionsForm(RealICQUser);
  13269. UpdateAddrBookInfo(RealICQUser);
  13270. end;
  13271. procedure TMainForm.UpdateAddrBookInfo(RealICQUser: TRealICQUser);
  13272. var
  13273. iLoop, ItemIndex: Integer;
  13274. Employee: TRealICQEmployee;
  13275. TmpRealICQUser: TRealICQUser;
  13276. RealICQContacterTreeView: TRealICQContacterTreeView;
  13277. begin
  13278. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  13279. if ItemIndex < 0 then
  13280. Exit;
  13281. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13282. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13283. if (Employee <> nil) then
  13284. begin
  13285. Employee.Mobile := RealICQUser.Mobile;
  13286. Employee.SMSHint := RealICQUser.Mobile;
  13287. Employee.Tel := RealICQUser.Tel;
  13288. Employee.Update;
  13289. end
  13290. else
  13291. Exit;
  13292. ItemIndex := MainForm.RealICQClient.AddrBookUsers.IndexOf(RealICQUser.LoginName);
  13293. if ItemIndex < 0 then
  13294. Exit;
  13295. TmpRealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[ItemIndex] as TRealICQUser;
  13296. TmpRealICQUser.Mobile := RealICQUser.Mobile;
  13297. TmpRealICQUser.Tel := RealICQUser.Tel;
  13298. end;
  13299. //------------------------------------------------------------------------------
  13300. procedure TMainForm.ShowNetWorkDiskSpaceInfo;
  13301. begin
  13302. lblNDSpaceSize.Caption := Format('%0fM/%dM', [RealICQNetWorkDiskClient.UsedSpaceSize / (1024 * 1024), RealICQNetWorkDiskClient.MaxSpaceSize div (1024 * 1024)]);
  13303. end;
  13304. //------------------------------------------------------------------------------
  13305. procedure TMainForm.RealICQNetWorkDiskClientConnectStateChanged(Sender: TObject);
  13306. begin
  13307. if tsNetWorkDisk.Parent = nil then
  13308. Exit;
  13309. try
  13310. FConfirmReplaceResult := -1;
  13311. if RealICQNetWorkDiskClient.Connectting then
  13312. begin
  13313. lblNDState.Caption := '正在连接...';
  13314. lblNDSpaceSize.Caption := '';
  13315. end
  13316. else if RealICQNetWorkDiskClient.Connected then
  13317. begin
  13318. lblNDState.Caption := '已连接';
  13319. ShowNetWorkDiskSpaceInfo;
  13320. end
  13321. else
  13322. begin
  13323. lblNDState.Caption := '连接已断开';
  13324. lblNDSpaceSize.Caption := '';
  13325. try
  13326. if FLVNetWorkDisk <> nil then
  13327. begin
  13328. FLVNetWorkDisk.Items.Clear;
  13329. FLVNetWorkDisk.ReDrawAll;
  13330. end;
  13331. except
  13332. end;
  13333. try
  13334. spbNDCancelAllClick(spbNDCancelAll);
  13335. except
  13336. end;
  13337. end;
  13338. spbNDMoveUp.Enabled := RealICQNetWorkDiskClient.Connected;
  13339. spbNDRefresh.Enabled := spbNDMoveUp.Enabled;
  13340. spbNDNewDir.Enabled := spbNDMoveUp.Enabled;
  13341. spbNDDelete.Enabled := spbNDMoveUp.Enabled;
  13342. shpNDDirBorder.Enabled := spbNDMoveUp.Enabled;
  13343. edNDDir.Enabled := spbNDMoveUp.Enabled;
  13344. spbNDUpload.Enabled := spbNDMoveUp.Enabled;
  13345. spbNDDownload.Enabled := spbNDMoveUp.Enabled;
  13346. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13347. spbNDConnect.Enabled := (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) and (RealICQClient.Connected);
  13348. spbNDDisconnect.Enabled := not spbNDConnect.Enabled and not RealICQNetWorkDiskClient.Connectting;
  13349. if not edNDDir.Enabled then
  13350. edNDDir.Text := '';
  13351. except
  13352. end;
  13353. end;
  13354. //------------------------------------------------------------------------------
  13355. procedure TMainForm.ItemShowHint(Sender: TObject; Item: TRealICQContacterListItem; var HintStr: string);
  13356. var
  13357. AFile: TRealICQNetWorkDiskFile;
  13358. ADirectory: TRealICQNetWorkDiskDirectory;
  13359. AUploadMission: TUploadMission;
  13360. ADownloadMission: TDownloadMission;
  13361. begin
  13362. if Item = nil then
  13363. Exit;
  13364. if Sender = FLVNetWorkDisk then
  13365. begin
  13366. if Copy(Item.LoginName, 1, 1) = 'D' then
  13367. begin
  13368. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  13369. HintStr := '目录名称: ' + Trim(ADirectory.Name) + #$D#$A;
  13370. HintStr := HintStr + '创建时间: ' + DateTimeToStr(ADirectory.CreateDate);
  13371. end
  13372. else if Copy(Item.LoginName, 1, 1) = 'F' then
  13373. begin
  13374. AFile := TRealICQNetWorkDiskFile(Item.Data);
  13375. HintStr := '文件名称: ' + Trim(AFile.Name) + #$D#$A;
  13376. HintStr := HintStr + '创建时间: ' + Trim(DateTimeToStr(AFile.CreateDate)) + #$D#$A;
  13377. HintStr := HintStr + '修改时间: ' + Trim(DateTimeToStr(AFile.ModifyDate)) + #$D#$A;
  13378. HintStr := HintStr + '大小: ' + Trim(Item.Watchword);
  13379. end;
  13380. end;
  13381. if Sender = FLVNetWorkDiskUploadingFiles then
  13382. begin
  13383. if AnsiSameText(HintStr, '取消') then
  13384. Exit;
  13385. AUploadMission := TUploadMission(Item.Data);
  13386. HintStr := AUploadMission.Name;
  13387. end;
  13388. if Sender = FLVNetWorkDiskDownloadingFiles then
  13389. begin
  13390. if AnsiSameText(HintStr, '取消') then
  13391. Exit;
  13392. ADownloadMission := TDownloadMission(Item.Data);
  13393. if ADownloadMission.FDownloadMissionType = mtDir then
  13394. HintStr := ADownloadMission.DirectoryName
  13395. else
  13396. HintStr := ADownloadMission.FileName;
  13397. end;
  13398. end;
  13399. procedure TMainForm.LblHintClick(Sender: TObject);
  13400. var
  13401. FAutoSaveMessage: Boolean;
  13402. begin
  13403. FAutoSaveMessage := AutoSaveMessage;
  13404. AutoSaveMessage := False;
  13405. try
  13406. RealICQClientReceivedSystemMessage(RealICQClient, FTopSystemMessage);
  13407. finally
  13408. btCloseTopMessageClick(nil);
  13409. AutoSaveMessage := FAutoSaveMessage;
  13410. end;
  13411. end;
  13412. //------------------------------------------------------------------------------
  13413. procedure TMainForm.NDSelectItemChanged(Item: TRealICQContacterListItem);
  13414. begin
  13415. if not pnlNDMissions.Visible then
  13416. begin
  13417. spbNDDelete.Enabled := (FLVNetWorkDisk <> nil) and (FLVNetWorkDisk.SelCount > 0);
  13418. spbNDDownload.Enabled := spbNDDelete.Enabled;
  13419. end;
  13420. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13421. end;
  13422. //------------------------------------------------------------------------------
  13423. procedure TMainForm.NDItemMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  13424. begin
  13425. end;
  13426. //------------------------------------------------------------------------------
  13427. procedure TMainForm.NDMissionItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  13428. var
  13429. UploadMission: TUploadMission;
  13430. DownloadMission: TDownloadMission;
  13431. AMissionID: string;
  13432. begin
  13433. if Sender = FLVNetWorkDiskUploadingFiles then
  13434. begin
  13435. try
  13436. if not Assigned(Item) then
  13437. Exit;
  13438. UploadMission := TUploadMission(Item.Data);
  13439. if not Assigned(UploadMission) then
  13440. Exit;
  13441. AMissionID := UploadMission.FID;
  13442. try
  13443. FLVNetWorkDiskUploadingFiles.Items.Delete(Item.ItemIndex);
  13444. FreeAndNil(UploadMission);
  13445. except
  13446. end;
  13447. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  13448. finally
  13449. CheckUploadMissions
  13450. end;
  13451. end;
  13452. if Sender = FLVNetWorkDiskDownloadingFiles then
  13453. begin
  13454. try
  13455. if not Assigned(Item) then
  13456. Exit;
  13457. FLVNetWorkDiskDownloadingFiles.Items.Delete(Item.ItemIndex);
  13458. DownloadMission := TDownloadMission(Item.Data);
  13459. FreeAndNil(DownloadMission);
  13460. RealICQNetWorkDiskClient.StopDownloader;
  13461. finally
  13462. CheckDownloadMissions
  13463. end;
  13464. end;
  13465. end;
  13466. //------------------------------------------------------------------------------
  13467. procedure TMainForm.NDMissionDropFiles(Sender: TObject; var Message: TMessage);
  13468. var
  13469. i: Integer;
  13470. p: array[0..1023] of Char;
  13471. AName: string;
  13472. begin
  13473. try
  13474. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  13475. begin
  13476. MessageBox(Handle, '抱歉,系统正忙!', '提示', MB_ICONINFORMATION);
  13477. Exit;
  13478. end;
  13479. i := DragQueryFile(Message.wParam, $FFFFFFFF, nil, 0);
  13480. for i := 0 to i - 1 do
  13481. begin
  13482. DragQueryFile(Message.wParam, i, p, 1024);
  13483. AName := StrPas(p);
  13484. if FileExists(AName) then
  13485. begin
  13486. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13487. end
  13488. else if DirectoryExists(AName) then
  13489. begin
  13490. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13491. end;
  13492. end;
  13493. finally
  13494. CheckUploadMissions;
  13495. DragFinish(Message.wParam);
  13496. Message.Result := 1;
  13497. end;
  13498. end;
  13499. //------------------------------------------------------------------------------
  13500. procedure TMainForm.miNDCancelClick(Sender: TObject);
  13501. var
  13502. ListItem: TRealICQContacterListItem;
  13503. UploadMission: TUploadMission;
  13504. DownloadMission: TDownloadMission;
  13505. iLoop: Integer;
  13506. begin
  13507. if TabSetNDMissions.TabIndex = 0 then
  13508. begin
  13509. for iLoop := FLVNetWorkDiskUploadingFiles.Items.Count - 1 downto 0 do
  13510. begin
  13511. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13512. if ListItem.Selected then
  13513. begin
  13514. UploadMission := TUploadMission(ListItem.Data);
  13515. if ListItem.LoginState = stOnline then
  13516. begin
  13517. if UploadMission.FUploadMissionType = mtFile then
  13518. begin
  13519. RealICQNetWorkDiskClient.CancelUploadingFile(UploadMission.FID);
  13520. Continue;
  13521. end;
  13522. end;
  13523. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13524. FreeAndNil(UploadMission);
  13525. end;
  13526. end;
  13527. CheckUploadMissions;
  13528. end;
  13529. if TabSetNDMissions.TabIndex = 1 then
  13530. begin
  13531. for iLoop := FLVNetWorkDiskDownloadingFiles.Items.Count - 1 downto 0 do
  13532. begin
  13533. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13534. if ListItem.Selected then
  13535. begin
  13536. DownloadMission := TDownloadMission(ListItem.Data);
  13537. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13538. FreeAndNil(DownloadMission);
  13539. if ListItem.LoginState = stOnline then
  13540. begin
  13541. RealICQNetWorkDiskClient.StopDownloader;
  13542. end;
  13543. end;
  13544. end;
  13545. CheckDownloadMissions;
  13546. end;
  13547. end;
  13548. //------------------------------------------------------------------------------
  13549. procedure TMainForm.spbNDMoveUpClick(Sender: TObject);
  13550. begin
  13551. if RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil then
  13552. begin
  13553. lblNDState.Caption := '正在载入...';
  13554. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13555. end;
  13556. end;
  13557. //------------------------------------------------------------------------------
  13558. procedure TMainForm.miNDRenameClick(Sender: TObject);
  13559. var
  13560. DirectoryName, FileName: string;
  13561. AFile: TRealICQNetWorkDiskFile;
  13562. ADirectory: TRealICQNetWorkDiskDirectory;
  13563. ListItem, ListItem1: TRealICQContacterListItem;
  13564. iLoop, jLoop: Integer;
  13565. begin
  13566. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13567. begin
  13568. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13569. if ListItem.Selected then
  13570. begin
  13571. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13572. begin
  13573. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  13574. DirectoryName := Trim(ShowMyInputBox('重命名目录', '请输入新的目录名称', ADirectory.Name, 200));
  13575. if AnsiSameStr(DirectoryName, ADirectory.Name) then
  13576. Exit;
  13577. if Length(DirectoryName) > 0 then
  13578. begin
  13579. 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
  13580. begin
  13581. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13582. Exit;
  13583. end;
  13584. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13585. begin
  13586. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13587. if ListItem1 = ListItem then
  13588. continue;
  13589. if Copy(ListItem1.LoginName, 1, 1) = 'D' then
  13590. begin
  13591. if AnsiSameText(DirectoryName, ListItem1.DisplayName) then
  13592. begin
  13593. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13594. Exit;
  13595. end;
  13596. end;
  13597. end;
  13598. RealICQNetWorkDiskClient.Rename(rtDir, ADirectory.ID, DirectoryName);
  13599. end;
  13600. end
  13601. else if Copy(ListItem.LoginName, 1, 1) = 'F' then
  13602. begin
  13603. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  13604. FileName := Trim(ShowMyInputBox('重命名文件', '请输入新的文件名称', AFile.Name, 200));
  13605. if AnsiSameStr(FileName, AFile.Name) then
  13606. Exit;
  13607. if Length(FileName) > 0 then
  13608. begin
  13609. 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
  13610. begin
  13611. MessageBox(Handle, '文件名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13612. Exit;
  13613. end;
  13614. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13615. begin
  13616. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13617. if ListItem1 = ListItem then
  13618. continue;
  13619. if Copy(ListItem1.LoginName, 1, 1) = 'F' then
  13620. begin
  13621. if AnsiSameText(FileName, ListItem1.DisplayName) then
  13622. begin
  13623. MessageBox(Handle, '指定的文件已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13624. Exit;
  13625. end;
  13626. end;
  13627. end;
  13628. RealICQNetWorkDiskClient.Rename(rtFile, AFile.ID, FileName);
  13629. end;
  13630. end;
  13631. Exit;
  13632. end;
  13633. end;
  13634. end;
  13635. //------------------------------------------------------------------------------
  13636. procedure TMainForm.spbNDNewDirClick(Sender: TObject);
  13637. var
  13638. DirectoryName: string;
  13639. iLoop: Integer;
  13640. ListItem: TRealICQContacterListItem;
  13641. begin
  13642. DirectoryName := Trim(ShowMyInputBox('新建目录', '请输入目录名称', '', 200));
  13643. if Length(DirectoryName) > 0 then
  13644. begin
  13645. 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
  13646. begin
  13647. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13648. Exit;
  13649. end;
  13650. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13651. begin
  13652. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13653. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13654. begin
  13655. if AnsiSameText(DirectoryName, ListItem.DisplayName) then
  13656. begin
  13657. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13658. Exit;
  13659. end;
  13660. end;
  13661. end;
  13662. RealICQNetWorkDiskClient.NewDirectory(DirectoryName);
  13663. end;
  13664. end;
  13665. //------------------------------------------------------------------------------
  13666. procedure TMainForm.spbNDRefreshClick(Sender: TObject);
  13667. begin
  13668. RealICQNetWorkDiskClient.Refresh;
  13669. end;
  13670. //------------------------------------------------------------------------------
  13671. procedure TMainForm.GoNextLevelUploadMissions(UploadMission: TUploadMission);
  13672. var
  13673. iLoop: Integer;
  13674. Missions: TStringList;
  13675. ListItem: TRealICQContacterListItem;
  13676. AUploadMission: TUploadMission;
  13677. DSearchRec: TSearchRec;
  13678. FindResult: Integer;
  13679. begin
  13680. if UploadMission.FUploadMissionType <> mtDir then
  13681. Exit;
  13682. Missions := TStringList.Create;
  13683. for iLoop := 0 to FLVNetWorkDiskUploadingFiles.Items.Count - 1 do
  13684. begin
  13685. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13686. AUploadMission := TUploadMission(ListItem.Data);
  13687. Missions.AddObject(AUploadMission.FID, AUploadMission);
  13688. try
  13689. FUploadMissions.Delete(FUploadMissions.IndexOf(AUploadMission.ID));
  13690. except
  13691. end;
  13692. end;
  13693. FSavedUploadMissions.Add(Missions);
  13694. FLVNetWorkDiskUploadingFiles.Items.Clear;
  13695. FindResult := FindFirst(UploadMission.FName + '\*.*', faDirectory, DSearchRec);
  13696. while FindResult = 0 do
  13697. begin
  13698. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13699. begin
  13700. if DirectoryExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13701. begin
  13702. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13703. end;
  13704. end;
  13705. FindResult := FindNext(DSearchRec);
  13706. end;
  13707. FindResult := FindFirst(UploadMission.FName + '\*.*', faAnyFile - faDirectory, DSearchRec);
  13708. while FindResult = 0 do
  13709. begin
  13710. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13711. begin
  13712. if FileExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13713. begin
  13714. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13715. end;
  13716. end;
  13717. FindResult := FindNext(DSearchRec);
  13718. end;
  13719. CheckUploadMissions;
  13720. end;
  13721. //------------------------------------------------------------------------------
  13722. procedure TMainForm.CheckUploadMissions;
  13723. var
  13724. ListItem: TRealICQContacterListItem;
  13725. UploadMission: TUploadMission;
  13726. Missions: TStringList;
  13727. iLoop: Integer;
  13728. ADirectory: TRealICQNetWorkDiskDirectory;
  13729. AFile: TRealICQNetWorkDiskFile;
  13730. Finded: Boolean;
  13731. MessageBoxResult: Integer;
  13732. ConfirmReplaceNDFileForm: TConfirmReplaceNDFileForm;
  13733. begin
  13734. if FLVNetWorkDiskUploadingFiles.OnlineNumeric = 0 then
  13735. begin
  13736. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  13737. begin
  13738. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  13739. UploadMission := TUploadMission(ListItem.Data);
  13740. if UploadMission.UploadMissionType = mtFile then
  13741. begin
  13742. with ListItem do
  13743. begin
  13744. LoginState := stOnline;
  13745. HasSMS := True;
  13746. Watchword := '';
  13747. SMSHint := '取消';
  13748. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13749. ReDrawItem;
  13750. end;
  13751. for iLoop := RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 downto 0 do
  13752. begin
  13753. AFile := RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop];
  13754. if AnsiSameText(ExtractFileName(AFile.Name), ExtractFileName(UploadMission.Name)) then
  13755. begin
  13756. if FConfirmReplaceResult <> mrYesToAll then
  13757. begin
  13758. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  13759. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(AFile.Name)]);
  13760. try
  13761. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  13762. finally
  13763. FreeAndNil(ConfirmReplaceNDFileForm);
  13764. end;
  13765. end;
  13766. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  13767. begin
  13768. //FreeAndNil(AFile);
  13769. RealICQNetWorkDiskClient.Delete('F' + IntToStr(AFile.ID));
  13770. Sleep(100);
  13771. Application.ProcessMessages;
  13772. Break;
  13773. end
  13774. else if FConfirmReplaceResult = mrNO then
  13775. begin
  13776. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  13777. FreeAndNil(UploadMission);
  13778. CheckUploadMissions;
  13779. Exit;
  13780. end
  13781. else if FConfirmReplaceResult = mrCancel then
  13782. begin
  13783. spbNDCancelAllClick(spbNDCancelAll);
  13784. Exit;
  13785. end;
  13786. end;
  13787. end;
  13788. while True do
  13789. begin
  13790. try
  13791. RealICQNetWorkDiskClient.UploadFile(UploadMission.Name, UploadMission.DirectoryID, UploadMission.ID);
  13792. Break;
  13793. except
  13794. on E: Exception do
  13795. begin
  13796. MessageBoxResult := MessageBox(Handle, PChar('上传文件时出错:'#$D#$A#$D#$A + E.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  13797. if MessageBoxResult = ID_ABORT then
  13798. begin
  13799. spbNDCancelAllClick(spbNDCancelAll);
  13800. Exit;
  13801. end
  13802. else if MessageBoxResult = ID_RETRY then
  13803. begin
  13804. Continue;
  13805. end
  13806. else if MessageBoxResult = ID_IGNORE then
  13807. begin
  13808. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  13809. FreeAndNil(UploadMission);
  13810. CheckUploadMissions;
  13811. Exit;
  13812. end;
  13813. end;
  13814. end; //try
  13815. end; //while
  13816. end
  13817. else
  13818. begin
  13819. with ListItem do
  13820. begin
  13821. LoginState := stOnline;
  13822. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13823. ReDrawItem;
  13824. end;
  13825. Finded := False;
  13826. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  13827. begin
  13828. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop];
  13829. if Length(ExtractFileName(UploadMission.Name)) > 0 then
  13830. begin
  13831. if AnsiSameText(ADirectory.Name, ExtractFileName(UploadMission.Name)) then
  13832. begin
  13833. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  13834. Finded := True;
  13835. end;
  13836. end
  13837. else
  13838. begin
  13839. if AnsiSameText(ADirectory.Name, '[' + Copy(UploadMission.Name, 1, 1) + ']') then
  13840. begin
  13841. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  13842. Finded := True;
  13843. end;
  13844. end;
  13845. end;
  13846. if not Finded then
  13847. begin
  13848. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  13849. RealICQNetWorkDiskClient.NewDirectory('[' + Copy(UploadMission.Name, 1, 1) + ']')
  13850. else
  13851. RealICQNetWorkDiskClient.NewDirectory(ExtractFileName(UploadMission.Name));
  13852. end;
  13853. end;
  13854. end;
  13855. end;
  13856. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  13857. if FLVNetWorkDiskUploadingFiles.Items.Count = 0 then
  13858. begin
  13859. if FSavedUploadMissions.Count > 0 then
  13860. begin
  13861. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  13862. begin
  13863. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  13864. begin
  13865. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13866. Missions := TStringList(FSavedUploadMissions[FSavedUploadMissions.Count - 1]);
  13867. FSavedUploadMissions.Remove(Missions);
  13868. for iLoop := 0 to Missions.Count - 1 do
  13869. begin
  13870. UploadMission := Missions.Objects[iLoop] as TUploadMission;
  13871. AddUploadMission(UploadMission.UploadMissionType, UploadMission.DirectoryID, UploadMission.Name, False);
  13872. FreeAndNil(UploadMission);
  13873. end;
  13874. Missions.Clear;
  13875. FreeAndNil(Missions);
  13876. CheckUploadMissions;
  13877. Exit;
  13878. end;
  13879. end;
  13880. end
  13881. else
  13882. begin
  13883. RealICQNetWorkDiskClient.GetUsedSpaceSize;
  13884. end;
  13885. end;
  13886. CheckNDControlState;
  13887. end;
  13888. //------------------------------------------------------------------------------
  13889. procedure TMainForm.CheckNDControlState;
  13890. begin
  13891. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count = 0) and (FLVNetWorkDiskDownloadingFiles.Items.Count = 0) and (FSavedUploadMissions.Count = 0) and (FSavedDownloadMissions.Count = 0) then
  13892. begin
  13893. pnlNDMissions.Visible := False;
  13894. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13895. end;
  13896. spbNDMoveUp.Enabled := not pnlNDMissions.Visible;
  13897. spbNDNewDir.Enabled := not pnlNDMissions.Visible;
  13898. spbNDDelete.Enabled := not pnlNDMissions.Visible;
  13899. spbNDUpload.Enabled := not pnlNDMissions.Visible;
  13900. spbNDDownload.Enabled := not pnlNDMissions.Visible;
  13901. spbNDRefresh.Enabled := not pnlNDMissions.Visible;
  13902. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13903. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  13904. if not pnlNDMissions.Visible then
  13905. begin
  13906. FConfirmReplaceResult := -1;
  13907. FLastDownloadDirectory := '';
  13908. NDSelectItemChanged(nil);
  13909. end;
  13910. end;
  13911. //------------------------------------------------------------------------------
  13912. procedure TMainForm.AddUploadMission(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string; CheckMission: Boolean = True);
  13913. var
  13914. UploadMission: TUploadMission;
  13915. ItemIndex: Integer;
  13916. ListItem: TRealICQContacterListItem;
  13917. begin
  13918. UploadMission := TUploadMission.Create(AUploadMissionType, ADirectoryID, AName);
  13919. if FUploadMissions.IndexOf(UploadMission.ID) >= 0 then
  13920. begin
  13921. MessageBox(Handle, PChar(AName + ' 已在任务队列中!'), '提示', MB_ICONINFORMATION);
  13922. Exit;
  13923. end;
  13924. FUploadMissions.AddObject(UploadMission.ID, UploadMission);
  13925. if not pnlNDMissions.Visible then
  13926. pnlNDMissions.Visible := True;
  13927. TabSetNDMissions.TabIndex := 0;
  13928. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13929. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  13930. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(UploadMission.ID);
  13931. if ItemIndex >= 0 then
  13932. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  13933. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.Add(UploadMission.ID);
  13934. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13935. with ListItem do
  13936. begin
  13937. LoginState := stOffline;
  13938. Data := UploadMission;
  13939. DisplayName := (UploadMission.Name);
  13940. Watchword := '队列中';
  13941. if UploadMission.UploadMissionType = mtFile then
  13942. begin
  13943. try
  13944. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(UploadMission.Name));
  13945. except
  13946. end;
  13947. end;
  13948. ReDrawItem;
  13949. end;
  13950. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  13951. if CheckMission then
  13952. CheckUploadMissions;
  13953. end;
  13954. //------------------------------------------------------------------------------
  13955. procedure TMainForm.AddDownloadMission(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = ''; CheckMission: Boolean = True);
  13956. var
  13957. DownloadMission: TDownloadMission;
  13958. ItemIndex: Integer;
  13959. ListItem: TRealICQContacterListItem;
  13960. begin
  13961. DownloadMission := TDownloadMission.Create(ADownloadMissionType, ADirectoryName, AFileID, AFileName);
  13962. if not pnlNDMissions.Visible then
  13963. pnlNDMissions.Visible := True;
  13964. TabSetNDMissions.TabIndex := 1;
  13965. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13966. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  13967. ItemIndex := FLVNetWorkDiskDownloadingFiles.Items.Add(DownloadMission.ID);
  13968. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13969. with ListItem do
  13970. begin
  13971. LoginState := stOffline;
  13972. Data := DownloadMission;
  13973. Watchword := '队列中';
  13974. if DownloadMission.DownloadMissionType = mtFile then
  13975. begin
  13976. DisplayName := (DownloadMission.FileName);
  13977. try
  13978. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(DownloadMission.FileName));
  13979. except
  13980. end;
  13981. end
  13982. else
  13983. begin
  13984. DisplayName := (DownloadMission.DirectoryName);
  13985. end;
  13986. ReDrawItem;
  13987. end;
  13988. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  13989. if CheckMission then
  13990. CheckDownloadMissions;
  13991. end;
  13992. //------------------------------------------------------------------------------
  13993. procedure TMainForm.CheckDownloadMissions;
  13994. var
  13995. iLoop, jLoop: Integer;
  13996. ListItem: TRealICQContacterListItem;
  13997. DownloadMission: TDownloadMission;
  13998. ADownloadMission: TDownloadMission;
  13999. ADirectory: TRealICQNetWorkDiskDirectory;
  14000. Missions: TStringList;
  14001. begin
  14002. if FLVNetWorkDiskDownloadingFiles.OnlineNumeric = 0 then
  14003. begin
  14004. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14005. begin
  14006. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14007. DownloadMission := TDownloadMission(ListItem.Data);
  14008. if DownloadMission.DownloadMissionType = mtFile then
  14009. begin
  14010. with ListItem do
  14011. begin
  14012. LoginState := stOnline;
  14013. HasSMS := True;
  14014. Watchword := '';
  14015. SMSHint := '取消';
  14016. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14017. ReDrawItem;
  14018. end;
  14019. if FileExists(DownloadMission.FFileName) then
  14020. begin
  14021. if FConfirmReplaceResult <> mrYesToAll then
  14022. begin
  14023. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  14024. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(DownloadMission.FFileName)]);
  14025. try
  14026. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  14027. finally
  14028. FreeAndNil(ConfirmReplaceNDFileForm);
  14029. end;
  14030. end;
  14031. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  14032. begin
  14033. end
  14034. else if FConfirmReplaceResult = mrNO then
  14035. begin
  14036. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14037. FreeAndNil(DownloadMission);
  14038. CheckDownloadMissions;
  14039. Exit;
  14040. end
  14041. else if FConfirmReplaceResult = mrCancel then
  14042. begin
  14043. spbNDCancelAllClick(spbNDCancelAll);
  14044. Exit;
  14045. end;
  14046. end;
  14047. try
  14048. RealICQNetWorkDiskClient.DownloadFile(DownloadMission.FFileID, DownloadMission.FFileName);
  14049. except
  14050. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14051. FreeAndNil(DownloadMission);
  14052. CheckDownloadMissions;
  14053. Exit;
  14054. end;
  14055. end
  14056. else
  14057. begin
  14058. with ListItem do
  14059. begin
  14060. LoginState := stOnline;
  14061. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14062. ReDrawItem;
  14063. end;
  14064. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14065. begin
  14066. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14067. if AnsiSameText(ExtractFileName(ADirectory.Name), ExtractFileName(DownloadMission.DirectoryName)) then
  14068. begin
  14069. if not DirectoryExists(DownloadMission.DirectoryName) then
  14070. CreateDir(DownloadMission.DirectoryName);
  14071. FLastDownloadDirectory := DownloadMission.DirectoryName;
  14072. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14073. FreeAndNil(DownloadMission);
  14074. Missions := TStringList.Create;
  14075. for jLoop := 0 to FLVNetWorkDiskDownloadingFiles.Items.Count - 1 do
  14076. begin
  14077. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[jLoop] as TRealICQContacterListItem;
  14078. ADownloadMission := TDownloadMission(ListItem.Data);
  14079. Missions.AddObject(ADownloadMission.FID, ADownloadMission);
  14080. end;
  14081. FSavedDownloadMissions.Add(Missions);
  14082. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  14083. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14084. Exit;
  14085. end;
  14086. end;
  14087. end;
  14088. end;
  14089. end;
  14090. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  14091. if FLVNetWorkDiskDownloadingFiles.Items.Count = 0 then
  14092. begin
  14093. if FSavedDownloadMissions.Count > 0 then
  14094. begin
  14095. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  14096. begin
  14097. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  14098. begin
  14099. FLastDownloadDirectory := '';
  14100. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  14101. Missions := TStringList(FSavedDownloadMissions[FSavedDownloadMissions.Count - 1]);
  14102. FSavedDownloadMissions.Remove(Missions);
  14103. for iLoop := 0 to Missions.Count - 1 do
  14104. begin
  14105. DownloadMission := Missions.Objects[iLoop] as TDownloadMission;
  14106. AddDownloadMission(DownloadMission.DownloadMissionType, DownloadMission.DirectoryName, DownloadMission.FileID, DownloadMission.FileName, False);
  14107. FreeAndNil(DownloadMission);
  14108. end;
  14109. Missions.Clear;
  14110. FreeAndNil(Missions);
  14111. CheckDownloadMissions;
  14112. Exit;
  14113. end;
  14114. end;
  14115. end;
  14116. end;
  14117. CheckNDControlState;
  14118. end;
  14119. //------------------------------------------------------------------------------
  14120. procedure TMainForm.spbNDUploadClick(Sender: TObject);
  14121. var
  14122. iLoop: Integer;
  14123. begin
  14124. MainForm.FormStyle := fsNormal;
  14125. try
  14126. if UploadFileOpenDialog.Execute then
  14127. begin
  14128. for iLoop := 0 to UploadFileOpenDialog.Files.Count - 1 do
  14129. begin
  14130. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadFileOpenDialog.Files.Strings[iLoop], False);
  14131. end;
  14132. end;
  14133. finally
  14134. // if MainForm.AlwaysOnTop then
  14135. // MainForm.FormStyle := fsStayOnTop
  14136. // else
  14137. // MainForm.FormStyle := fsNormal;
  14138. CheckUploadMissions;
  14139. end;
  14140. end;
  14141. procedure TMainForm.spbNextClick(Sender: TObject);
  14142. var
  14143. TabSheet: TTabSheet;
  14144. WebBrowser: TWebBrowser;
  14145. begin
  14146. try
  14147. TabSheet := pgcMultiWeb.ActivePage;
  14148. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14149. if WebBrowser.Busy then
  14150. WebBrowser.Stop;
  14151. WebBrowser.GoForward;
  14152. except
  14153. end;
  14154. end;
  14155. function TMainForm.GetDefaultBrowser: string;//获取默认浏览器
  14156. var
  14157. reg: TRegistry;
  14158. begin
  14159. reg := TRegistry.Create;
  14160. try
  14161. {reg.RootKey := HKEY_CLASSES_ROOT;
  14162. reg.OpenKey('HTTP\shell\open\ddeexec\Application',false);
  14163. result:=reg.ReadString('');
  14164. reg.CloseKey; }
  14165. reg.RootKey := HKEY_CLASSES_ROOT;
  14166. reg.OpenKey('http\\shell\\open\\command', false);
  14167. result := reg.ReadString('');
  14168. result := Copy(result, Pos('"', result) + 1, Length(result) - 1);
  14169. result := Copy(result, 1, Pos('"', result) - 1);
  14170. reg.CloseKey;
  14171. finally
  14172. if (result = '') then
  14173. result := 'IEXPLORE.EXE';
  14174. reg.Free;
  14175. end;
  14176. end;
  14177. //---用户自助管理平台--------------------------------------
  14178. procedure TMainForm.spbPersonManageClick(Sender: TObject);
  14179. //var
  14180. // EncryptStr,
  14181. // Md5Pwd,
  14182. // Url,
  14183. // TmpStr:String;
  14184. begin
  14185. //Md5Pwd:=Md5En(RealICQClient.Password);
  14186. //TmpStr:='{'+RealICQClient.Me.LoginName+'}{'+Md5Pwd+'}';
  14187. //EncryptStr:=StrToBase64(Encrypt(TmpStr,'B77A5C561934E089'));
  14188. //Url:=RealICQClient.PersonManageUrl+'?'+ EncryptStr;
  14189. // ShellExecute(handle,'open', 'IEXPLORE.EXE', 'http://www.baidu.com', nil,SW_SHOWNORMAL);//
  14190. // ShellExecute(handle, 'open','http://220.191.210.103:8080/Default.aspx?url=', '','',SW_SHOWDEFAULT);
  14191. //MessageBox(Handle, PChar(RealICQClient.WebAppBaseURL), '提示', MB_ICONQUESTION);
  14192. //MessageBox(Handle, PChar(LoginURL), '提示', MB_ICONQUESTION);
  14193. //ShellExecute(handle, 'open', PChar(GetDefaultBrowser),PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), ''])), '',SW_SHOWDEFAULT);
  14194. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(LoginURL)])), '', SW_SHOWDEFAULT);
  14195. end;
  14196. procedure TMainForm.spbPrevClick(Sender: TObject);
  14197. var
  14198. TabSheet: TTabSheet;
  14199. WebBrowser: TWebBrowser;
  14200. begin
  14201. try
  14202. TabSheet := pgcMultiWeb.ActivePage;
  14203. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14204. if WebBrowser.Busy then
  14205. WebBrowser.Stop;
  14206. WebBrowser.GoBack;
  14207. except
  14208. end;
  14209. end;
  14210. procedure TMainForm.spbPrintPrevClick(Sender: TObject);
  14211. var
  14212. TabSheet: TTabSheet;
  14213. WebBrowser: TWebBrowser;
  14214. begin
  14215. MainForm.FormStyle := fsNormal;
  14216. try
  14217. try
  14218. TabSheet := pgcMultiWeb.ActivePage;
  14219. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14220. if WebBrowser.QueryStatusWB(OLECMDID_PRINTPREVIEW) = 3 then
  14221. WebBrowser.ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT, EmptyParam, EmptyParam);
  14222. except
  14223. end;
  14224. finally
  14225. // if MainForm.AlwaysOnTop then
  14226. // MainForm.FormStyle := fsStayOnTop
  14227. // else
  14228. // MainForm.FormStyle := fsNormal;
  14229. end;
  14230. end;
  14231. procedure TMainForm.spbRefreshBranchUsersClick(Sender: TObject);
  14232. begin
  14233. //
  14234. {TimerForGetBranchOnlineStates.Enabled := False;
  14235. TimerForGetBranchOnlineStates.Enabled := True;}
  14236. miChangeServerClick(nil);
  14237. TimerForGetBranchUsersOnlineStates.Enabled := False;
  14238. TimerForGetBranchUsersOnlineStates.Enabled := True;
  14239. end;
  14240. procedure TMainForm.spbRefreshClick(Sender: TObject);
  14241. var
  14242. TabSheet: TTabSheet;
  14243. WebBrowser: TWebBrowser;
  14244. begin
  14245. try
  14246. TabSheet := pgcMultiWeb.ActivePage;
  14247. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14248. if WebBrowser.Busy then
  14249. WebBrowser.Stop;
  14250. WebBrowser.Refresh;
  14251. except
  14252. end;
  14253. end;
  14254. //------------------------------------------------------------------------------
  14255. procedure TMainForm.RealICQNetWorkDiskClientNewDirResult(Sender: TObject; Directory: TRealICQNetWorkDiskDirectory);
  14256. var
  14257. ItemIndex: Integer;
  14258. ListItem: TRealICQContacterListItem;
  14259. UploadMission: TUploadMission;
  14260. NDDirName: string;
  14261. begin
  14262. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14263. begin
  14264. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14265. UploadMission := TUploadMission(ListItem.Data);
  14266. if UploadMission.UploadMissionType = mtDir then
  14267. begin
  14268. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14269. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14270. else
  14271. NDDirName := ExtractFileName(UploadMission.Name);
  14272. if AnsiSameText(NDDirName, Directory.Name) and (Directory.ParentID = UploadMission.DirectoryID) then
  14273. begin
  14274. RealICQNetWorkDiskClient.GetDirectory(Directory);
  14275. Exit;
  14276. end;
  14277. end;
  14278. end;
  14279. if Directory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14280. Exit;
  14281. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(Directory.ID));
  14282. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14283. with ListItem do
  14284. begin
  14285. LoginState := stOnline;
  14286. Data := Directory;
  14287. DisplayName := Directory.Name;
  14288. ReDrawItem;
  14289. end;
  14290. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14291. end;
  14292. //------------------------------------------------------------------------------
  14293. procedure TMainForm.RealICQNetWorkDiskClientNoSpace(Sender: TObject);
  14294. begin
  14295. ShowNetWorkDiskSpaceInfo;
  14296. spbNDCancelAllClick(spbNDCancelAll);
  14297. MessageBox(Handle, '抱歉!您的网络硬盘空间不足,任务已取消!', '提示', MB_ICONINFORMATION);
  14298. end;
  14299. //------------------------------------------------------------------------------
  14300. procedure TMainForm.RealICQNetWorkDiskClientRenamedDir(Sender: TObject; ADirectory: TRealICQNetWorkDiskDirectory);
  14301. var
  14302. ItemIndex: Integer;
  14303. ListItem: TRealICQContacterListItem;
  14304. begin
  14305. FLVNetWorkDisk.AdjustPosition := False;
  14306. try
  14307. if ADirectory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14308. Exit;
  14309. ItemIndex := FLVNetWorkDisk.Items.IndexOf('D' + IntToStr(ADirectory.ID));
  14310. if ItemIndex < 0 then
  14311. Exit;
  14312. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14313. with ListItem do
  14314. begin
  14315. LoginState := stOnline;
  14316. Data := ADirectory;
  14317. DisplayName := ADirectory.Name;
  14318. ReDrawItem;
  14319. end;
  14320. finally
  14321. FLVNetWorkDisk.AdjustPosition := True;
  14322. end;
  14323. end;
  14324. //------------------------------------------------------------------------------
  14325. procedure TMainForm.RealICQNetWorkDiskClientRenamedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile);
  14326. var
  14327. ItemIndex: Integer;
  14328. ListItem: TRealICQContacterListItem;
  14329. begin
  14330. FLVNetWorkDisk.AdjustPosition := False;
  14331. try
  14332. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14333. Exit;
  14334. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14335. if ItemIndex < 0 then
  14336. Exit;
  14337. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14338. with ListItem do
  14339. begin
  14340. LoginState := stLeave;
  14341. Data := AFile;
  14342. DisplayName := AFile.Name;
  14343. try
  14344. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14345. except
  14346. end;
  14347. ReDrawItem;
  14348. end;
  14349. finally
  14350. FLVNetWorkDisk.AdjustPosition := True;
  14351. end;
  14352. end;
  14353. //------------------------------------------------------------------------------
  14354. procedure TMainForm.RealICQNetWorkDiskClientUploadedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile; AMissionID: string);
  14355. var
  14356. iLoop: Integer;
  14357. ItemIndex: Integer;
  14358. ListItem: TRealICQContacterListItem;
  14359. UploadMission: TUploadMission;
  14360. AFile1: TRealICQNetWorkDiskFile;
  14361. Finded: Boolean;
  14362. begin
  14363. try
  14364. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14365. if ItemIndex >= 0 then
  14366. begin
  14367. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14368. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14369. UploadMission := TUploadMission(ListItem.Data);
  14370. FreeAndNil(UploadMission);
  14371. end;
  14372. FLVNetWorkDisk.AdjustPosition := False;
  14373. try
  14374. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14375. Exit;
  14376. Finded := False;
  14377. ListItem := nil;
  14378. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14379. begin
  14380. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14381. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14382. begin
  14383. AFile1 := TRealICQNetWorkDiskFile(ListItem.Data);
  14384. if AnsiSameText(AFile1.Name, AFile.Name) then
  14385. begin
  14386. Finded := True;
  14387. Break;
  14388. end;
  14389. end;
  14390. end;
  14391. if not Finded then
  14392. begin
  14393. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14394. if ItemIndex >= 0 then
  14395. begin
  14396. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14397. Finded := True;
  14398. end;
  14399. end;
  14400. if not Finded then
  14401. begin
  14402. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14403. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14404. end;
  14405. with ListItem do
  14406. begin
  14407. LoginState := stLeave;
  14408. Data := AFile;
  14409. DisplayName := AFile.Name;
  14410. if AFile.Size >= 1024 * 1024 then
  14411. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14412. else if AFile.Size >= 1024 then
  14413. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14414. else
  14415. Watchword := IntToStr(AFile.Size) + 'B';
  14416. try
  14417. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14418. except
  14419. end;
  14420. ReDrawItem;
  14421. end;
  14422. finally
  14423. FLVNetWorkDisk.AdjustPosition := True;
  14424. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14425. ShowNetWorkDiskSpaceInfo;
  14426. end;
  14427. finally
  14428. CheckUploadMissions;
  14429. end;
  14430. end;
  14431. //------------------------------------------------------------------------------
  14432. procedure TMainForm.RealICQNetWorkDiskClientUploadFileAborted(Sender: TObject; AMissionID: string);
  14433. var
  14434. ItemIndex: Integer;
  14435. ListItem: TRealICQContacterListItem;
  14436. UploadMission: TUploadMission;
  14437. begin
  14438. try
  14439. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14440. if ItemIndex >= 0 then
  14441. begin
  14442. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14443. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14444. UploadMission := TUploadMission(ListItem.Data);
  14445. FreeAndNil(UploadMission);
  14446. end;
  14447. finally
  14448. CheckUploadMissions;
  14449. end;
  14450. end;
  14451. //------------------------------------------------------------------------------
  14452. procedure TMainForm.RealICQNetWorkDiskClientUploadingFile(Sender: TObject; ATransmitter: TResponsionStreamTransmitter; ATransmittedSize: Int64);
  14453. var
  14454. ItemIndex: Integer;
  14455. ListItem: TRealICQContacterListItem;
  14456. Completed: Integer;
  14457. ASpeed: Cardinal;
  14458. SpeedStr: string;
  14459. begin
  14460. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf((ATransmitter as TNetWorkFileTransmitter).MissionID);
  14461. if ItemIndex >= 0 then
  14462. begin
  14463. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14464. with ListItem do
  14465. begin
  14466. Completed := ATransmittedSize * 100 div ATransmitter.StreamLength;
  14467. try
  14468. ASpeed := Round(ATransmittedSize div ((GetTickCount - ATransmitter.StartTicket) div 1000) * 1.2);
  14469. except
  14470. Exit;
  14471. end;
  14472. if ASpeed > 1000 * 1000 then
  14473. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14474. else if ASpeed > 1000 then
  14475. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14476. else
  14477. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14478. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14479. DisplayName := DisplayName + ((ATransmitter as TNetWorkFileTransmitter).FileName);
  14480. ReDrawItem;
  14481. end;
  14482. end;
  14483. end;
  14484. function ServiceGetStatus(sMachine, sService: string): DWord;
  14485. var
  14486. //service control
  14487. //manager handle
  14488. schm,
  14489. //service handle
  14490. schs: SC_Handle;
  14491. //service status
  14492. ss: TServiceStatus;
  14493. //current service status
  14494. dwStat: DWord;
  14495. begin
  14496. dwStat := 0;
  14497. //connect to the service
  14498. //control manager
  14499. schm := OpenSCManager(pchar(sMachine), Nil, SC_MANAGER_CONNECT);
  14500. //if successful...
  14501. if (schm > 0) then
  14502. begin
  14503. //open a handle to
  14504. //the specified service
  14505. schs := OpenService(schm, PChar(sService), SERVICE_QUERY_STATUS);
  14506. //if successful...
  14507. if (schs > 0) then
  14508. begin
  14509. //retrieve the current status
  14510. //of the specified service
  14511. if (QueryServiceStatus(schs, ss)) then
  14512. begin
  14513. dwStat := ss.dwCurrentState;
  14514. end;
  14515. //close service handle
  14516. CloseServiceHandle(schs);
  14517. end;
  14518. // close service control
  14519. // manager handle
  14520. CloseServiceHandle(schm);
  14521. end;
  14522. Result := dwStat;
  14523. end;
  14524. function ServiceUninstalled(sMachine, sService: string): boolean;
  14525. begin
  14526. Result := 0 = ServiceGetStatus(sMachine, sService);
  14527. end;
  14528. //------------------------------------------------------------------------------
  14529. //调用360杀毒软件
  14530. //------------------------------------------------------------------------------
  14531. procedure TMainForm.spb360SDClick(Sender: TObject);
  14532. begin
  14533. //
  14534. end;
  14535. //------------------------------------------------------------------------------
  14536. //调用360安全卫士
  14537. //------------------------------------------------------------------------------
  14538. procedure TMainForm.spb360SafeClick(Sender: TObject);
  14539. var
  14540. URL: string;
  14541. TempReg: TRegistry;
  14542. safePath: string;
  14543. begin
  14544. URL := 'http://' + self.RealICQClient.RemoteAddress + '/client/setup.exe';
  14545. try
  14546. TempReg := TRegistry.Create;
  14547. try
  14548. TempReg.RootKey := HKEY_LOCAL_MACHINE;
  14549. if not TempReg.OpenKey('\Software\360Safe\menuext\LiveUpdate360', False) then
  14550. //DownloadUpdate(URL)
  14551. else
  14552. begin
  14553. safePath := ExtractFilePath(TempReg.ReadString('Application'));
  14554. //WinExec(PChar(safePath+'\360Safe.exe'),SW_SHOW);
  14555. end;
  14556. finally
  14557. TempReg.Free;
  14558. end;
  14559. except
  14560. end;
  14561. end;
  14562. //------------------------------------------------------------------------------
  14563. procedure TMainForm.spbNDDeleteClick(Sender: TObject);
  14564. var
  14565. ListItem: TRealICQContacterListItem;
  14566. iLoop: Integer;
  14567. AList: string;
  14568. begin
  14569. if FLVNetWorkDisk.SelCount <= 0 then
  14570. Exit;
  14571. if (GetKeyState(VK_Shift) and - 128) = 0 then
  14572. begin
  14573. if MessageBox(Handle, '确认要删除选中的文件吗?', '提示', MB_ICONQUESTION or MB_OKCANCEL) <> ID_OK then
  14574. Exit;
  14575. end;
  14576. AList := '';
  14577. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14578. begin
  14579. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14580. if ListItem.Selected then
  14581. begin
  14582. AList := AList + ListItem.LoginName + Chr(10);
  14583. end;
  14584. if Length(AList) >= 1024 then
  14585. begin
  14586. RealICQNetWorkDiskClient.Delete(AList);
  14587. AList := '';
  14588. Sleep(1000);
  14589. end;
  14590. end;
  14591. if Length(AList) > 0 then
  14592. RealICQNetWorkDiskClient.Delete(AList);
  14593. end;
  14594. //------------------------------------------------------------------------------
  14595. procedure TMainForm.spbNDDisconnectClick(Sender: TObject);
  14596. begin
  14597. RealICQNetWorkDiskClient.Logout;
  14598. end;
  14599. //------------------------------------------------------------------------------
  14600. procedure TMainForm.spbNDDownloadClick(Sender: TObject);
  14601. var
  14602. iLoop: Integer;
  14603. ListItem: TRealICQContacterListItem;
  14604. Dir: string;
  14605. AFile: TRealICQNetWorkDiskFile;
  14606. ADirectory: TRealICQNetWorkDiskDirectory;
  14607. begin
  14608. if FLVNetWorkDisk.SelCount = 0 then
  14609. Exit;
  14610. if FLVNetWorkDisk.SelCount = 1 then
  14611. begin
  14612. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14613. begin
  14614. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14615. if ListItem.Selected then
  14616. begin
  14617. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14618. begin
  14619. NDItemDoubleClick(ListItem);
  14620. Exit;
  14621. end;
  14622. end;
  14623. end;
  14624. end;
  14625. MainForm.FormStyle := fsNormal;
  14626. try
  14627. if SelectDirectory('请选择目录', '', Dir) then
  14628. begin
  14629. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14630. begin
  14631. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14632. if ListItem.Selected then
  14633. begin
  14634. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14635. begin
  14636. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14637. AddDownloadMission(mtDir, Dir + '\' + ADirectory.Name, 0, '', False);
  14638. end
  14639. else
  14640. begin
  14641. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14642. AddDownloadMission(mtFile, ExtractFilePath(Dir), AFile.ID, Dir + '\' + AFile.Name, False);
  14643. end;
  14644. end;
  14645. end; //for
  14646. CheckDownloadMissions;
  14647. end;
  14648. finally
  14649. // if MainForm.AlwaysOnTop then
  14650. // MainForm.FormStyle := fsStayOnTop
  14651. // else
  14652. // MainForm.FormStyle := fsNormal;
  14653. end;
  14654. end;
  14655. //------------------------------------------------------------------------------
  14656. procedure TMainForm.NDItemDoubleClick(Item: TRealICQContacterListItem);
  14657. var
  14658. AFile: TRealICQNetWorkDiskFile;
  14659. ADirectory: TRealICQNetWorkDiskDirectory;
  14660. begin
  14661. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  14662. begin
  14663. Exit;
  14664. end;
  14665. if Copy(Item.LoginName, 1, 1) = 'D' then
  14666. begin
  14667. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  14668. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14669. end
  14670. else if Copy(Item.LoginName, 1, 1) = 'F' then
  14671. begin
  14672. AFile := TRealICQNetWorkDiskFile(Item.Data);
  14673. MainForm.FormStyle := fsNormal;
  14674. try
  14675. DownloadFileSaveDialog.FileName := AFile.Name;
  14676. if DownloadFileSaveDialog.Execute then
  14677. begin
  14678. AddDownloadMission(mtFile, ExtractFilePath(DownloadFileSaveDialog.FileName), AFile.ID, DownloadFileSaveDialog.FileName, True);
  14679. end;
  14680. finally
  14681. // if MainForm.AlwaysOnTop then
  14682. // MainForm.FormStyle := fsStayOnTop
  14683. // else
  14684. // MainForm.FormStyle := fsNormal;
  14685. end;
  14686. end;
  14687. end;
  14688. //------------------------------------------------------------------------------
  14689. procedure TMainForm.RealICQNetWorkDiskClientDeleteResult(Sender: TObject; AList: string);
  14690. var
  14691. AStringList: TStringList;
  14692. iLoop, iIndex: Integer;
  14693. begin
  14694. AStringList := SplitString(AList, Chr(10));
  14695. FLVNetWorkDisk.DisableAlign;
  14696. try
  14697. for iLoop := 0 to AStringList.Count - 1 do
  14698. begin
  14699. iIndex := FLVNetWorkDisk.Items.IndexOf(AStringList.Strings[iLoop]);
  14700. if iIndex >= 0 then
  14701. FLVNetWorkDisk.Items.Delete(iIndex);
  14702. end;
  14703. finally
  14704. FLVNetWorkDisk.EnableAlign;
  14705. FreeAndNil(AStringList);
  14706. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14707. ShowNetWorkDiskSpaceInfo;
  14708. NDSelectItemChanged(nil);
  14709. end;
  14710. end;
  14711. //------------------------------------------------------------------------------
  14712. procedure TMainForm.RealICQNetWorkDiskClientDirectoryListReady(Sender: TObject);
  14713. var
  14714. iLoop, ItemIndex: Integer;
  14715. AFile: TRealICQNetWorkDiskFile;
  14716. ADirectory: TRealICQNetWorkDiskDirectory;
  14717. ListItem: TRealICQContacterListItem;
  14718. Bitmap: TBitmap;
  14719. UploadMission: TUploadMission;
  14720. NDDirName: string;
  14721. begin
  14722. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  14723. edNDDir.Text := '';
  14724. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory;
  14725. while ADirectory <> nil do
  14726. begin
  14727. edNDDir.Text := ADirectory.Name + '\' + edNDDir.Text;
  14728. ADirectory := ADirectory.Parent;
  14729. end;
  14730. try
  14731. FLVNetWorkDisk.AdjustPosition := False;
  14732. FLVNetWorkDisk.DisableAlign;
  14733. FLVNetWorkDisk.Items.Clear;
  14734. NDSelectItemChanged(nil);
  14735. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14736. begin
  14737. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14738. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(ADirectory.ID));
  14739. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14740. with ListItem do
  14741. begin
  14742. LoginState := stOnline;
  14743. Data := ADirectory;
  14744. DisplayName := ADirectory.Name;
  14745. end;
  14746. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, 0, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14747. lblNDState.Update;
  14748. end;
  14749. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 do
  14750. begin
  14751. AFile := TRealICQNetWorkDiskFile(RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop]);
  14752. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14753. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14754. with ListItem do
  14755. begin
  14756. LoginState := stLeave;
  14757. Data := AFile;
  14758. DisplayName := AFile.Name;
  14759. if AFile.Size >= 1024 * 1024 then
  14760. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14761. else if AFile.Size >= 1024 then
  14762. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14763. else
  14764. Watchword := IntToStr(AFile.Size) + 'B';
  14765. try
  14766. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14767. except
  14768. end;
  14769. FreeAndNil(Bitmap);
  14770. end;
  14771. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14772. lblNDState.Update;
  14773. end;
  14774. finally
  14775. FLVNetWorkDisk.ReDrawAll;
  14776. FLVNetWorkDisk.EnableAlign;
  14777. FLVNetWorkDisk.AdjustPosition := True;
  14778. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14779. end;
  14780. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14781. begin
  14782. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14783. UploadMission := TUploadMission(ListItem.Data);
  14784. if UploadMission.UploadMissionType = mtDir then
  14785. begin
  14786. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14787. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14788. else
  14789. NDDirName := ExtractFileName(UploadMission.Name);
  14790. if AnsiSameText(NDDirName, RealICQNetWorkDiskClient.CurrentDirectory.Name) and (RealICQNetWorkDiskClient.CurrentDirectory.ParentID = UploadMission.DirectoryID) then
  14791. begin
  14792. try
  14793. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  14794. except
  14795. end;
  14796. try
  14797. GoNextLevelUploadMissions(UploadMission);
  14798. finally
  14799. FreeAndNil(UploadMission);
  14800. end;
  14801. Exit;
  14802. end;
  14803. end;
  14804. end;
  14805. if Length(Trim(FLastDownloadDirectory)) > 0 then
  14806. begin
  14807. if (DirectoryExists(FLastDownloadDirectory)) then
  14808. begin
  14809. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14810. begin
  14811. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14812. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14813. begin
  14814. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14815. AddDownloadMission(mtDir, FLastDownloadDirectory + '\' + ADirectory.Name, 0, '', False);
  14816. end
  14817. else
  14818. begin
  14819. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14820. AddDownloadMission(mtFile, ExtractFilePath(FLastDownloadDirectory), AFile.ID, FLastDownloadDirectory + '\' + AFile.Name, False);
  14821. end;
  14822. end; //for
  14823. CheckDownloadMissions;
  14824. end;
  14825. end;
  14826. end;
  14827. //------------------------------------------------------------------------------
  14828. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileAborted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14829. begin
  14830. end;
  14831. //------------------------------------------------------------------------------
  14832. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileCompleted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14833. var
  14834. ListItem: TRealICQContacterListItem;
  14835. DownloadMission: TDownloadMission;
  14836. MessageBoxResult: Integer;
  14837. begin
  14838. if not RealICQNetWorkDiskClient.Connected then
  14839. Exit;
  14840. try
  14841. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14842. begin
  14843. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14844. DownloadMission := TDownloadMission(ListItem.Data);
  14845. if DownloadMission.FFileID = AFileDownloader.FileID then
  14846. begin
  14847. if not AFileDownloader.Completed then
  14848. begin
  14849. if AFileDownloader.Exp <> nil then
  14850. begin
  14851. MessageBoxResult := MessageBox(Handle, PChar('下载文件时出错:'#$D#$A#$D#$A + AFileDownloader.Exp.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  14852. if MessageBoxResult = ID_ABORT then
  14853. begin
  14854. spbNDCancelAllClick(spbNDCancelAll);
  14855. Exit;
  14856. end
  14857. else if MessageBoxResult = ID_RETRY then
  14858. begin
  14859. CheckDownloadMissions;
  14860. Exit;
  14861. end
  14862. else if MessageBoxResult = ID_IGNORE then
  14863. begin
  14864. end;
  14865. end;
  14866. end;
  14867. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14868. FreeAndNil(DownloadMission);
  14869. end;
  14870. end;
  14871. except
  14872. end;
  14873. CheckDownloadMissions;
  14874. end;
  14875. //------------------------------------------------------------------------------
  14876. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileTransmitting(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14877. var
  14878. ListItem: TRealICQContacterListItem;
  14879. Completed: Integer;
  14880. ASpeed: Cardinal;
  14881. SpeedStr: string;
  14882. begin
  14883. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14884. begin
  14885. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14886. with ListItem do
  14887. begin
  14888. Completed := AFileDownloader.RecvedSize * 100 div AFileDownloader.FileSize;
  14889. try
  14890. ASpeed := Round(AFileDownloader.RecvedSize div ((GetTickCount - AFileDownloader.StartTicket) div 1000) * 1.2);
  14891. except
  14892. Exit;
  14893. end;
  14894. if ASpeed > 1000 * 1000 then
  14895. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14896. else if ASpeed > 1000 then
  14897. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14898. else
  14899. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14900. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14901. DisplayName := DisplayName + (AFileDownloader.LocalFileName);
  14902. ReDrawItem;
  14903. end;
  14904. end;
  14905. end;
  14906. //------------------------------------------------------------------------------
  14907. procedure TMainForm.RealICQNetWorkDiskClientGettedUsedSpaceSize(Sender: TObject);
  14908. begin
  14909. ShowNetWorkDiskSpaceInfo;
  14910. end;
  14911. //------------------------------------------------------------------------------
  14912. procedure TMainForm.RealICQNetWorkDiskClientLoginFailed(Sender: TObject; E: Exception);
  14913. begin
  14914. lblNDState.Caption := '连接失败(' + E.Message + ')';
  14915. end;
  14916. //------------------------------------------------------------------------------
  14917. procedure TMainForm.RealICQNetWorkDiskClientLoginResult(Sender: TObject; LoginResultType: Byte);
  14918. begin
  14919. if LoginResultType = 0 then
  14920. begin
  14921. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory);
  14922. end
  14923. else if LoginResultType = 1 then
  14924. begin
  14925. lblNDState.Caption := '连接失败,服务器版本错误';
  14926. end
  14927. else if LoginResultType = 2 then
  14928. begin
  14929. lblNDState.Caption := '连接失败,用户验证错误';
  14930. end;
  14931. end;
  14932. //------------------------------------------------------------------------------
  14933. procedure TMainForm.RealICQClientBeDropped(Sender: TObject; Excuse: string);
  14934. begin
  14935. MessageBox(Handle, PChar(Excuse), '你已被强制下线', MB_ICONINFORMATION or MB_OK);
  14936. TTeamsAdapter.Stop;
  14937. end;
  14938. //------------------------------------------------------------------------------
  14939. procedure TMainForm.RealICQClientDownloadFile(Sender: TObject; AFileName: string);
  14940. var
  14941. iLoop: Integer;
  14942. WebPanel: TWebPanel;
  14943. TabSheet: TTabSheet;
  14944. Bitmap: TBitmap;
  14945. begin
  14946. for iLoop := 0 to FWebTabs.Count - 1 do
  14947. begin
  14948. TabSheet := FWebTabs[iLoop];
  14949. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  14950. if AnsiSameText(WebPanel.Image, AFileName) then
  14951. begin
  14952. Bitmap := TBitmap.Create;
  14953. try
  14954. try
  14955. Bitmap.LoadFromFile(AFileName);
  14956. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  14957. ImgLstPageControl.Add(Bitmap, Bitmap);
  14958. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  14959. except
  14960. end;
  14961. finally
  14962. FreeAndNil(Bitmap);
  14963. end;
  14964. end;
  14965. end;
  14966. end;
  14967. //------------------------------------------------------------------------------
  14968. procedure TMainForm.RealICQClientDownloadTeamFace(Sender: TObject; AFileName: string);
  14969. begin
  14970. ShowGettedFace(AFileName);
  14971. end;
  14972. //------------------------------------------------------------------------------
  14973. procedure TMainForm.RealICQClientLoginFailed(Sender: TObject; E: Exception);
  14974. begin
  14975. TimerForLogining.Enabled := False;
  14976. SetUIState;
  14977. MessageBox(Handle, PChar('抱歉,您现在无法登录至服务器: ' + E.Message), '登录失败', MB_ICONINFORMATION or MB_OK);
  14978. end;
  14979. //------------------------------------------------------------------------------
  14980. procedure TMainForm.actShowLoginNameExecute(Sender: TObject);
  14981. var
  14982. iLoop: Integer;
  14983. RealICQContacterListView: TRealICQContacterListView;
  14984. RealICQContacterTreeView: TRealICQContacterTreeView;
  14985. begin
  14986. for iLoop := 0 to FContacterListViews.Count - 1 do
  14987. begin
  14988. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  14989. RealICQContacterListView.CaptionStyle := csLoginName;
  14990. end;
  14991. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  14992. begin
  14993. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  14994. RealICQContacterTreeView.CaptionStyle := csLoginName;
  14995. RealICQContacterTreeView.ReDrawAll;
  14996. end;
  14997. FLVCaptionStyle := csLoginName;
  14998. SaveStyleConfigs;
  14999. end;
  15000. //------------------------------------------------------------------------------
  15001. procedure TMainForm.actShowDisplayNameExecute(Sender: TObject);
  15002. var
  15003. iLoop: Integer;
  15004. RealICQContacterListView: TRealICQContacterListView;
  15005. RealICQContacterTreeView: TRealICQContacterTreeView;
  15006. begin
  15007. for iLoop := 0 to FContacterListViews.Count - 1 do
  15008. begin
  15009. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15010. RealICQContacterListView.CaptionStyle := csDisplayName;
  15011. end;
  15012. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15013. begin
  15014. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15015. RealICQContacterTreeView.CaptionStyle := csDisplayName;
  15016. RealICQContacterTreeView.ReDrawAll;
  15017. end;
  15018. FLVCaptionStyle := csDisplayName;
  15019. SaveStyleConfigs;
  15020. end;
  15021. //------------------------------------------------------------------------------
  15022. procedure TMainForm.actShowGIFInMailFormExecute(Sender: TObject);
  15023. begin
  15024. actShowGIFInMailForm.Checked := not actShowGIFInMailForm.Checked;
  15025. FShowGIFInMailForm := actShowGIFInMailForm.Checked;
  15026. SaveStyleConfigs;
  15027. if RealICQClient.Me = nil then
  15028. Exit;
  15029. if RealICQClient.Me.HeadImageFileType = htGIF then
  15030. begin
  15031. ShowMeInformation;
  15032. end;
  15033. end;
  15034. //------------------------------------------------------------------------------
  15035. procedure TMainForm.actShowGIFInTalkingFormExecute(Sender: TObject);
  15036. begin
  15037. actShowGIFInTalkingForm.Checked := not actShowGIFInTalkingForm.Checked;
  15038. FShowGIFInTalkingForm := actShowGIFInTalkingForm.Checked;
  15039. SaveStyleConfigs;
  15040. UpdateAllTakingFormGIFHeadImage;
  15041. end;
  15042. //------------------------------------------------------------------------------
  15043. procedure TMainForm.actShowGroupExecute(Sender: TObject);
  15044. begin
  15045. FShowGroup := not FShowGroup;
  15046. actShowGroup.Checked := FShowGroup;
  15047. SaveIfShowGroupConfig;
  15048. ShowGroupInterface;
  15049. end;
  15050. //------------------------------------------------------------------------------
  15051. function TMainForm.GetSelectedLoginName: string;
  15052. var
  15053. GroupIndex, iLoop: Integer;
  15054. GroupName: string;
  15055. ListView: TRealICQContacterListView;
  15056. ListItem: TRealICQContacterListItem;
  15057. ItemIndex: Integer;
  15058. RealICQFriendTreeView: TRealICQContacterTreeView;
  15059. RealICQContacterTreeView: TRealICQContacterTreeView;
  15060. Employee: TRealICQEmployee;
  15061. Friend: TRealICQEmployee;
  15062. begin
  15063. Result := '';
  15064. if FSearchListViewInVisible then
  15065. begin
  15066. for iLoop := 0 to FSearchListView.Items.Count - 1 do
  15067. begin
  15068. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15069. if ListItem.Selected then
  15070. begin
  15071. Result := ListItem.LoginName;
  15072. Exit;
  15073. end;
  15074. end;
  15075. end;
  15076. GroupName := GetActiveTabSheetName;
  15077. if GroupName = LVMyContacters then
  15078. begin
  15079. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  15080. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15081. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15082. if Employee <> nil then
  15083. begin
  15084. Result := Employee.LoginName;
  15085. end;
  15086. Exit;
  15087. end;
  15088. if GroupName = LVMoreUsers then
  15089. begin
  15090. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  15091. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15092. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15093. if Employee <> nil then
  15094. begin
  15095. Result := Employee.LoginName;
  15096. end;
  15097. Exit;
  15098. end;
  15099. if GroupName = LVFriends then
  15100. begin
  15101. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  15102. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15103. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  15104. if Friend <> nil then
  15105. begin
  15106. Result := Friend.LoginName;
  15107. end;
  15108. Exit;
  15109. end;
  15110. GroupIndex := FContacterListViews.IndexOf(GroupName);
  15111. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  15112. for iLoop := 0 to ListView.Items.Count - 1 do
  15113. begin
  15114. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15115. if ListItem.Selected then
  15116. begin
  15117. Result := ListItem.LoginName;
  15118. Break;
  15119. end;
  15120. end;
  15121. end;
  15122. //------------------------------------------------------------------------------
  15123. procedure TMainForm.actShowHistoryExecute(Sender: TObject);
  15124. var
  15125. LoginName: string;
  15126. begin
  15127. LoginName := GetSelectedLoginName;
  15128. if LoginName <> '' then
  15129. begin
  15130. OpenMessagesManagerForm;
  15131. Application.ProcessMessages;
  15132. MessagesManagerForm.ShowUsersMessages(LoginName);
  15133. end;
  15134. end;
  15135. //------------------------------------------------------------------------------
  15136. procedure TMainForm.actSeeInformationExecute(Sender: TObject);
  15137. var
  15138. LoginName: string;
  15139. begin
  15140. LoginName := GetSelectedLoginName;
  15141. if LoginName <> '' then
  15142. begin
  15143. SeeUserInformation(LoginName);
  15144. end;
  15145. end;
  15146. //------------------------------------------------------------------------------
  15147. procedure TMainForm.actChangeRemarkExecute(Sender: TObject);
  15148. var
  15149. LoginName: string;
  15150. Remark: string;
  15151. RealICQUser: TRealICQUser;
  15152. begin
  15153. LoginName := GetSelectedLoginName;
  15154. if LoginName <> '' then
  15155. begin
  15156. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  15157. if RealICQUser = nil then
  15158. Exit;
  15159. if (RealICQUser.LoginName = RealICQClient.Me.LoginName) then
  15160. begin
  15161. ShowMessage('不允许修改自己的备注名称!');
  15162. Exit;
  15163. end;
  15164. Remark := RealICQUser.Remark;
  15165. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  15166. if not AnsiSameStr(Remark, RealICQUser.Remark) then
  15167. RealICQClient.ChangeRemark(LoginName, Remark);
  15168. end;
  15169. end;
  15170. //------------------------------------------------------------------------------
  15171. procedure TMainForm.actSendMessageExecute(Sender: TObject);
  15172. var
  15173. LoginName: string;
  15174. begin
  15175. LoginName := GetSelectedLoginName;
  15176. if LoginName <> '' then
  15177. begin
  15178. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  15179. begin
  15180. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  15181. Exit;
  15182. end;
  15183. //----------------------------------------
  15184. {if GetActiveTabSheetName=MoreUser then
  15185. begin
  15186. RealICQClient.GetUserInformation(LoginName,True);
  15187. end;}
  15188. OpenTalkingForm(LoginName);
  15189. end;
  15190. end;
  15191. //------------------------------------------------------------------------------
  15192. procedure TMainForm.actSendTeamMessageExecute(Sender: TObject);
  15193. var
  15194. iLoop: Integer;
  15195. ListItem: TRealICQContacterListItem;
  15196. RealICQTeam: TRealICQTeam;
  15197. begin
  15198. if FLVTeams.SelCount = 1 then
  15199. begin
  15200. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15201. begin
  15202. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15203. if ListItem.Selected then
  15204. begin
  15205. RealICQTeam := ListItem.Data;
  15206. OpenTeamTalkingForm(RealICQTeam.TeamID);
  15207. Break;
  15208. end;
  15209. end;
  15210. end;
  15211. end;
  15212. //------------------------------------------------------------------------------
  15213. procedure TMainForm.actSeeTeamInformationExecute(Sender: TObject);
  15214. var
  15215. iLoop: Integer;
  15216. ListItem: TRealICQContacterListItem;
  15217. RealICQTeam: TRealICQTeam;
  15218. begin
  15219. if FLVTeams.SelCount = 1 then
  15220. begin
  15221. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15222. begin
  15223. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15224. if ListItem.Selected then
  15225. begin
  15226. RealICQTeam := ListItem.Data;
  15227. OpenTeamOptionsForm(RealICQTeam);
  15228. Break;
  15229. end;
  15230. end;
  15231. end;
  15232. end;
  15233. //------------------------------------------------------------------------------
  15234. procedure TMainForm.actQuitTeamExecute(Sender: TObject);
  15235. var
  15236. iLoop: Integer;
  15237. ListItem: TRealICQContacterListItem;
  15238. RealICQTeam: TRealICQTeam;
  15239. begin
  15240. if FLVTeams.SelCount = 1 then
  15241. begin
  15242. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15243. begin
  15244. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15245. if ListItem.Selected then
  15246. begin
  15247. RealICQTeam := ListItem.Data;
  15248. if MessageBox(Handle, '真的要退出该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15249. Exit;
  15250. TTeamsAdapter.QuitTeam(RealICQTeam.TeamID);
  15251. Break;
  15252. end;
  15253. end;
  15254. end;
  15255. end;
  15256. //------------------------------------------------------------------------------
  15257. procedure TMainForm.actDisbandTeamExecute(Sender: TObject);
  15258. var
  15259. iLoop: Integer;
  15260. ListItem: TRealICQContacterListItem;
  15261. RealICQTeam: TRealICQTeam;
  15262. begin
  15263. {if FLVTeams.SelCount = 1 then
  15264. begin
  15265. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15266. begin
  15267. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15268. if ListItem.Selected then
  15269. begin
  15270. RealICQTeam := ListItem.Data;
  15271. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then Exit;
  15272. RealICQClient.DisbandTeam(RealICQTeam.TeamID);
  15273. Break;
  15274. end;
  15275. end;
  15276. end; }
  15277. if FLVTeams.SelCount = 1 then
  15278. begin
  15279. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15280. begin
  15281. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15282. if ListItem.Selected then
  15283. begin
  15284. RealICQTeam := ListItem.Data;
  15285. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15286. Exit;
  15287. TTeamsAdapter.DisbandTeam(RealICQTeam.TeamID);
  15288. Break;
  15289. end;
  15290. end;
  15291. end;
  15292. end;
  15293. //------------------------------------------------------------------------------
  15294. procedure TMainForm.actQuitOrDisbandTeamsExecute(Sender: TObject);
  15295. var
  15296. iLoop: Integer;
  15297. ListItem: TRealICQContacterListItem;
  15298. RealICQTeam: TRealICQTeam;
  15299. begin
  15300. if MessageBox(Handle, '真的要退出 / 解散选中的群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15301. Exit;
  15302. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15303. begin
  15304. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15305. if ListItem.Selected then
  15306. begin
  15307. RealICQTeam := ListItem.Data;
  15308. if AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName) then
  15309. RealICQClient.DisbandTeam(RealICQTeam.TeamID)
  15310. else
  15311. RealICQClient.QuitTeam(RealICQTeam.TeamID);
  15312. end;
  15313. end;
  15314. end;
  15315. //------------------------------------------------------------------------------
  15316. procedure TMainForm.actShowAllNameExecute(Sender: TObject);
  15317. var
  15318. iLoop: Integer;
  15319. RealICQContacterListView: TRealICQContacterListView;
  15320. RealICQContacterTreeView: TRealICQContacterTreeView;
  15321. begin
  15322. for iLoop := 0 to FContacterListViews.Count - 1 do
  15323. begin
  15324. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15325. RealICQContacterListView.CaptionStyle := csDisplayNameAndLoginName;
  15326. end;
  15327. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15328. begin
  15329. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15330. RealICQContacterTreeView.CaptionStyle := csDisplayNameAndLoginName;
  15331. RealICQContacterTreeView.ReDrawAll;
  15332. end;
  15333. FLVCaptionStyle := csDisplayNameAndLoginName;
  15334. SaveStyleConfigs;
  15335. end;
  15336. //------------------------------------------------------------------------------
  15337. procedure TMainForm.actShowBigHeadImageExecute(Sender: TObject);
  15338. var
  15339. iLoop: Integer;
  15340. RealICQContacterListView: TRealICQContacterListView;
  15341. RealICQContacterTreeView: TRealICQContacterTreeView;
  15342. begin
  15343. for iLoop := 0 to FContacterListViews.Count - 1 do
  15344. begin
  15345. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15346. RealICQContacterListView.Style := lsBigHeadImage;
  15347. end;
  15348. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15349. begin
  15350. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15351. RealICQContacterTreeView.Style := lsBigHeadImage;
  15352. RealICQContacterTreeView.ReDrawAll;
  15353. end;
  15354. FLVStyle := lsBigHeadImage;
  15355. SaveStyleConfigs;
  15356. end;
  15357. procedure TMainForm.actShowMiddleHeadImageExecute(Sender: TObject);
  15358. var
  15359. iLoop: Integer;
  15360. RealICQContacterListView: TRealICQContacterListView;
  15361. RealICQContacterTreeView: TRealICQContacterTreeView;
  15362. begin
  15363. for iLoop := 0 to FContacterListViews.Count - 1 do
  15364. begin
  15365. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15366. RealICQContacterListView.Style := lsMiddleHeadImage;
  15367. end;
  15368. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15369. begin
  15370. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15371. RealICQContacterTreeView.Style := lsMiddleHeadImage;
  15372. RealICQContacterTreeView.ReDrawAll;
  15373. end;
  15374. FLVStyle := lsMiddleHeadImage;
  15375. SaveStyleConfigs;
  15376. end;
  15377. //------------------------------------------------------------------------------
  15378. procedure TMainForm.actShowSmallHeadImageExecute(Sender: TObject);
  15379. var
  15380. iLoop: Integer;
  15381. RealICQContacterListView: TRealICQContacterListView;
  15382. RealICQContacterTreeView: TRealICQContacterTreeView;
  15383. begin
  15384. for iLoop := 0 to FContacterListViews.Count - 1 do
  15385. begin
  15386. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15387. RealICQContacterListView.Style := lsSmallHeadImage;
  15388. end;
  15389. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15390. begin
  15391. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15392. RealICQContacterTreeView.Style := lsSmallHeadImage;
  15393. RealICQContacterTreeView.ReDrawAll;
  15394. end;
  15395. FLVStyle := lsSmallHeadImage;
  15396. SaveStyleConfigs;
  15397. end;
  15398. //------------------------------------------------------------------------------
  15399. procedure TMainForm.actShowStrangersExecute(Sender: TObject);
  15400. begin
  15401. // SaveStyleConfigs;
  15402. end;
  15403. //------------------------------------------------------------------------------
  15404. procedure TMainForm.actShowBlacklistsExecute(Sender: TObject);
  15405. begin
  15406. // SaveStyleConfigs;
  15407. end;
  15408. //------------------------------------------------------------------------------
  15409. procedure TMainForm.actShowTeamHistoryExecute(Sender: TObject);
  15410. var
  15411. iLoop: Integer;
  15412. ListItem: TRealICQContacterListItem;
  15413. RealICQTeam: TRealICQTeam;
  15414. begin
  15415. if FLVTeams.SelCount = 1 then
  15416. begin
  15417. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15418. begin
  15419. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15420. if ListItem.Selected then
  15421. begin
  15422. RealICQTeam := ListItem.Data;
  15423. OpenMessagesManagerForm;
  15424. Application.ProcessMessages;
  15425. MessagesManagerForm.ShowTeamsMessages(RealICQTeam.TeamID);
  15426. Break;
  15427. end;
  15428. end;
  15429. end;
  15430. end;
  15431. //------------------------------------------------------------------------------
  15432. procedure TMainForm.actShowTeamsExecute(Sender: TObject);
  15433. begin
  15434. // SaveStyleConfigs;
  15435. end;
  15436. //------------------------------------------------------------------------------
  15437. procedure TMainForm.actShowTreeExecute(Sender: TObject);
  15438. begin
  15439. FShowTree := not FShowTree;
  15440. actShowTree.Checked := FShowTree;
  15441. actShowBigHeadImage.Visible := not actShowTree.Checked;
  15442. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  15443. if FShowTree then
  15444. begin
  15445. if FLVStyle <> lsNoHeadImage then
  15446. begin
  15447. FLVStyle := lsSmallHeadImage;
  15448. actShowSmallHeadImage.Execute;
  15449. end;
  15450. end;
  15451. SaveStyleConfigs;
  15452. ShowGroupInterface;
  15453. end;
  15454. //------------------------------------------------------------------------------
  15455. procedure TMainForm.actShowLatestsExecute(Sender: TObject);
  15456. begin
  15457. //
  15458. end;
  15459. //------------------------------------------------------------------------------
  15460. procedure TMainForm.actAboutExecute(Sender: TObject);
  15461. begin
  15462. AboutForm := TAboutForm.Create(Self);
  15463. try
  15464. AboutForm.ShowModal;
  15465. finally
  15466. FreeAndNil(AboutForm);
  15467. end;
  15468. end;
  15469. //------------------------------------------------------------------------------
  15470. procedure TMainForm.actAlwaysOnTopExecute(Sender: TObject);
  15471. begin
  15472. FAlwaysOnTop := not FAlwaysOnTop;
  15473. // if FAlwaysOnTop then
  15474. // FormStyle := fsStayOnTop
  15475. // else
  15476. FormStyle := fsNormal;
  15477. actAlwaysOnTop.Checked := FAlwaysOnTop;
  15478. SaveDefaultConfigs;
  15479. end;
  15480. //------------------------------------------------------------------------------
  15481. procedure TMainForm.actShowNormalHeadImageExecute(Sender: TObject);
  15482. var
  15483. iLoop: Integer;
  15484. RealICQContacterListView: TRealICQContacterListView;
  15485. RealICQContacterTreeView: TRealICQContacterTreeView;
  15486. begin
  15487. for iLoop := 0 to FContacterListViews.Count - 1 do
  15488. begin
  15489. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15490. RealICQContacterListView.Style := lsNoHeadImage;
  15491. end;
  15492. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15493. begin
  15494. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15495. RealICQContacterTreeView.Style := lsNoHeadImage;
  15496. RealICQContacterTreeView.ReDrawAll;
  15497. end;
  15498. FLVStyle := lsNoHeadImage;
  15499. SaveStyleConfigs;
  15500. end;
  15501. //------------------------------------------------------------------------------
  15502. procedure TMainForm.actShowRemarkExecute(Sender: TObject);
  15503. var
  15504. iLoop, jLoop: Integer;
  15505. RealICQContacterListView: TRealICQContacterListView;
  15506. RealICQContacterTreeView: TRealICQContacterTreeView;
  15507. RealICQContacterListItem: TRealICQContacterListItem;
  15508. RealICQUser: TRealICQUser;
  15509. Employee: TRealICQEmployee;
  15510. begin
  15511. actShowRemark.Checked := not actShowRemark.Checked;
  15512. RealICQClient.ShowRemark := actShowRemark.Checked;
  15513. for iLoop := 0 to FContacterListViews.Count - 1 do
  15514. begin
  15515. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15516. for jLoop := 0 to RealICQContacterListView.Items.Count - 1 do
  15517. begin
  15518. RealICQContacterListItem := RealICQContacterListView.Items.Objects[jLoop] as TRealICQContacterListItem;
  15519. RealICQUser := RealICQContacterListItem.Data;
  15520. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  15521. end;
  15522. end;
  15523. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15524. begin
  15525. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15526. for jLoop := 0 to RealICQContacterTreeView.Count - 1 do
  15527. begin
  15528. Employee := RealICQContacterTreeView.EmployeeItems.Objects[jLoop] as TRealICQEmployee;
  15529. RealICQUser := Employee.Data;
  15530. UpdateEmployeeNode(Employee, RealICQUser, False);
  15531. end;
  15532. RealICQContacterTreeView.ReDrawAll;
  15533. end;
  15534. end;
  15535. //------------------------------------------------------------------------------
  15536. procedure TMainForm.actFindUsersExecute(Sender: TObject);
  15537. begin
  15538. if SearchForm <> nil then
  15539. begin
  15540. SearchForm.BringToFront;
  15541. Exit;
  15542. end;
  15543. SearchForm := TSearchForm.Create(Application);
  15544. SearchForm.Show;
  15545. end;
  15546. procedure TMainForm.actGroupManagerExecute(Sender: TObject);
  15547. begin
  15548. if GroupManagerForm <> nil then
  15549. Exit;
  15550. GroupManagerForm := TGroupManagerForm.Create(Self);
  15551. try
  15552. GroupManagerForm.ShowModal;
  15553. finally
  15554. FreeAndNil(GroupManagerForm);
  15555. end;
  15556. end;
  15557. //------------------------------------------------------------------------------
  15558. procedure TMainForm.OpenMessagesManagerForm;
  15559. begin
  15560. actMsgManagerExecute(nil);
  15561. end;
  15562. //------------------------------------------------------------------------------
  15563. procedure TMainForm.pgcMainWorkAreaTabChanging(Sender: TObject; NewIndex: Integer; var AllowChanged: Boolean);
  15564. var
  15565. TabSheet: TTabSheet;
  15566. WebPanel: TWebPanel;
  15567. Point: TPoint;
  15568. begin
  15569. {if NewIndex = 1 then
  15570. begin
  15571. MainForm.RealICQClient.OnGettedAddrBookGroups:=GettedAddrBookGroups;
  15572. MainForm.RealICQClient.OnManageAddrBookResult:=GettedManageAddrBookResult;
  15573. RealICQClient.SendGetAddrBookGroup;
  15574. end;}
  15575. if NewIndex > 2 then
  15576. begin
  15577. AllowChanged := False;
  15578. //if not DisplayWebs then Exit;
  15579. TabSheet := pgcMainWorkArea.Pages[NewIndex];
  15580. WebPanel := FWebPanels.Objects[TabSheet.Tag] as TWebPanel;
  15581. //if WebPanel.FNavigateType = ntFill then AllowChanged := True;
  15582. if WebPanel.Acounts.Count > 1 then
  15583. begin
  15584. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  15585. begin
  15586. Point.X := Mouse.CursorPos.X;
  15587. Point.Y := Mouse.CursorPos.Y;
  15588. FreeAndNil(SelWebTabAcountsForm);
  15589. SelWebTabAcountsForm := TSelWebTabAcountsForm.Create(Self);
  15590. SelWebTabAcountsForm.WebPanel := WebPanel;
  15591. SelWebTabAcountsForm.TabSheet := TabSheet;
  15592. SelWebTabAcountsForm.Left := Point.X;
  15593. SelWebTabAcountsForm.Top := Point.Y - 20;
  15594. if Left <= SelWebTabAcountsForm.Width then
  15595. SelWebTabAcountsForm.Left := Left + Width
  15596. else
  15597. SelWebTabAcountsForm.Left := Left - SelWebTabAcountsForm.Width;
  15598. if WebPanel.Acounts.Count < 10 then
  15599. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := WebPanel.Acounts.Count * cntHeightOfBigHeadImage + 3
  15600. else
  15601. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := 10 * cntHeightOfBigHeadImage + 3;
  15602. SelWebTabAcountsForm.pnlClient.Constraints.MaxHeight := SelWebTabAcountsForm.pnlClient.Constraints.MinHeight;
  15603. SelWebTabAcountsForm.Show;
  15604. Exit;
  15605. end;
  15606. end;
  15607. WebTabShow(TabSheet);
  15608. end;
  15609. end;
  15610. procedure TMainForm.pgcMainWorkAreaWebPanelButtonClick(Sender: TObject);
  15611. begin
  15612. pgcMainWorkArea.OnWebPanelButtonClick := nil;
  15613. if OptionsForm = nil then
  15614. OptionsForm := TOptionsForm.Create(Self);
  15615. try
  15616. OptionsForm.PageIndex := 10;
  15617. OptionsForm.ShowModal;
  15618. finally
  15619. FreeAndNil(OptionsForm);
  15620. pgcMainWorkArea.OnWebPanelButtonClick := pgcMainWorkAreaWebPanelButtonClick;
  15621. end;
  15622. end;
  15623. procedure TMainForm.pnlToolBarResize(Sender: TObject);
  15624. var
  15625. AvgWidth: Integer;
  15626. iLeft: Integer;
  15627. begin
  15628. AvgWidth := (pnlToolBar.Width - 2) div 5;
  15629. iLeft := 1;
  15630. MyContacters.Left := iLeft;
  15631. MyContacters.Width := AvgWidth;
  15632. MyContactersIcon.Left := iLeft + (AvgWidth - MyContactersIcon.Width) div 2;
  15633. iLeft := iLeft + AvgWidth;
  15634. SysMsg.Left := iLeft;
  15635. SysMsg.Width := AvgWidth;
  15636. SysMsgIcon.Left := iLeft + (AvgWidth - SysMsgIcon.Width) div 2;
  15637. iLeft := iLeft + AvgWidth;
  15638. MyFriend.Left := iLeft;
  15639. MyFriend.Width := AvgWidth;
  15640. MyFriendIcon.Left := iLeft + (AvgWidth - MyFriendIcon.Width) div 2;
  15641. iLeft := iLeft + AvgWidth;
  15642. MyTeam.Left := iLeft;
  15643. MyTeam.Width := AvgWidth;
  15644. MyTeamIcon.Left := iLeft + (AvgWidth - MyTeamIcon.Width) div 2;
  15645. iLeft := iLeft + AvgWidth;
  15646. Latests.Left := iLeft;
  15647. Latests.Width := pnlToolBar.Width - (AvgWidth * 4);
  15648. LatestsIcon.Left := iLeft + (AvgWidth - LatestsIcon.Width) div 2;
  15649. iLeft := iLeft + AvgWidth;
  15650. end;
  15651. procedure TMainForm.pnlWorkAreaClick(Sender: TObject);
  15652. begin
  15653. end;
  15654. {设置WebBrowser的样式}
  15655. //------------------------------------------------------------------------------
  15656. procedure TMainForm.SetDOMStyle(Doc: IHTMLDocument2);
  15657. var
  15658. CurrentColor, CssColor: string;
  15659. begin
  15660. try
  15661. CurrentColor := IntToHex(ConvertColorToColor(FormColor, MainForm.UIMainColor), 6);
  15662. CssColor := '#' + Copy(CurrentColor, 5, 2) + Copy(CurrentColor, 3, 2) + Copy(CurrentColor, 1, 2);
  15663. Doc.body.style.cssText := 'word-break: break-all;';
  15664. Doc.body.style.border := '0px solid';
  15665. Doc.body.style.fontFamily := '宋体';
  15666. Doc.body.style.fontSize := '9pt';
  15667. Doc.body.style.margin := '0pt';
  15668. Doc.body.setAttribute('scroll', 'no', 0);
  15669. Doc.body.style.backgroundColor := CssColor;
  15670. except
  15671. end;
  15672. end;
  15673. //------------------------------------------------------------------------------
  15674. procedure TMainForm.WebBrowserRightStatusTextChange(ASender: TObject; const Text: WideString);
  15675. var
  15676. TabSheet: TTabSheet;
  15677. begin
  15678. try
  15679. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15680. if pgcMultiWeb.ActivePage = TabSheet then
  15681. lblIEStatus.Caption := Text
  15682. else
  15683. lblIEStatus.Caption := '';
  15684. except
  15685. lblIEStatus.Caption := Text
  15686. end;
  15687. end;
  15688. //------------------------------------------------------------------------------
  15689. procedure TMainForm.WebBrowserRightTitleChange(ASender: TObject; const Text: WideString);
  15690. var
  15691. IETitle: WideString;
  15692. TabSheet: TTabSheet;
  15693. begin
  15694. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15695. IETitle := Text;
  15696. //字符串长度过长时,截短字符串并在后面显示“...”
  15697. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) > 138 do
  15698. begin
  15699. if Length(IETitle) > 3 then
  15700. begin
  15701. if Copy(IETitle, Length(IETitle) - 2, Length(IETitle)) = '...' then
  15702. IETitle := Copy(IETitle, 1, Length(IETitle) - 3);
  15703. IETitle := Copy(IETitle, 1, Length(IETitle) - 1) + '...';
  15704. end
  15705. else
  15706. begin
  15707. IETitle := '...';
  15708. end;
  15709. end;
  15710. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) < 88 do
  15711. begin
  15712. IETitle := IETitle + ' ';
  15713. end;
  15714. TabSetMuiltWeb.Tabs.Strings[TabSheet.TabIndex] := IETitle + ' ';
  15715. end;
  15716. //------------------------------------------------------------------------------
  15717. procedure TMainForm.WebBrowserRightWindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
  15718. var
  15719. TabSheet: TTabSheet;
  15720. WebBrowser: TWebBrowser;
  15721. begin
  15722. CoInitialize(nil);
  15723. try
  15724. WebBrowser := ASender as TWebBrowser;
  15725. TabSheet := (WebBrowser.Owner as TPanel).Owner as TTabSheet;
  15726. if pgcMultiWeb.PageCount > 1 then
  15727. begin
  15728. try
  15729. if WebBrowser.Busy then
  15730. WebBrowser.Stop;
  15731. except
  15732. end;
  15733. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  15734. TabSheet.PageControl := nil;
  15735. FreeAndNil(TabSheet);
  15736. end
  15737. else
  15738. begin
  15739. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15740. WebBrowser.Navigate('about:blank');
  15741. end;
  15742. finally
  15743. CoUninitialize;
  15744. Cancel := True;
  15745. end;
  15746. end;
  15747. {procedure TMainForm.WebSocketBroadCastMesssage(var msg: TMessage);
  15748. var
  15749. pdata: PBroadCastMessage;
  15750. RealICQTeamMessage: TRealICQTeamMessage;
  15751. begin
  15752. showmessage(pdata.GroupID);
  15753. RealICQTeamMessage:= TRealICQTeamMessage.Create(pdata.GroupID,pdata.Sayer,{pdata.Style}//'"宋体",9,[],[clBlack]',pdata.Msg,False);
  15754. { RealICQTeamMessage.MessageID := gettickcount();
  15755. RealICQTeamMessage.SendDateTime := pdata.timestamp;
  15756. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15757. end; }
  15758. { TODO -olqq -c : WebSocket群通讯功能 2014/12/12 9:02:40 }
  15759. procedure TMainForm.WebSocketJionTeamRequest(TeamID, ALoginName, ATag: string);
  15760. var
  15761. ATeam: TRealICQTeam;
  15762. ATeamCaption: string;
  15763. begin
  15764. ATeam := TTeamsAdapter.GetTeam(TeamID);
  15765. if ATeam <> nil then
  15766. ATeamCaption := ATeam.TeamCaption;
  15767. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ATeamCaption, TeamID]), nil);
  15768. ShowJoinTeamRequestWindow(Self, TeamID, ATeamCaption, ALoginName, ATag);
  15769. end;
  15770. procedure TMainForm.WebSocketQuitTeam(aTeamID: string);
  15771. var
  15772. iIndex: Integer;
  15773. AlertMessage: string;
  15774. ARealICQTeam: TRealICQTeam;
  15775. AForm: TForm;
  15776. begin
  15777. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15778. if iIndex >= 0 then
  15779. begin
  15780. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15781. if ARealICQTeam = nil then
  15782. Exit;
  15783. FLVTeams.Items.Delete(iIndex);
  15784. if ARealICQTeam.IsTempTeam then
  15785. AlertMessage := '您 退出了 多人对话'
  15786. else
  15787. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  15788. ShowNotifyAlertForm(AlertMessage);
  15789. AddMessageHistory(smSimple, AlertMessage, nil);
  15790. ShowNavBarNumeric;
  15791. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  15792. AForm := GetTeamTalkingForm(aTeamID);
  15793. FreeAndNil(AForm);
  15794. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  15795. UpdateTeamTalkingForm(ARealICQTeam);
  15796. end;
  15797. end;
  15798. procedure TMainForm.WebSocketRecivedbroadcastmesssage(aID, aGroupID, aSayer, aStyle, aMsg: string; aTimesTamp: TDateTime);
  15799. var
  15800. RealICQTeamMessage: TRealICQTeamMessage;
  15801. aDateTime: TDateTime;
  15802. begin
  15803. RealICQTeamMessage := TRealICQTeamMessage.Create(aGroupID, aSayer, aStyle{'"宋体",9,[],[clBlack]'}, aMsg, False);
  15804. RealICQTeamMessage.MessageID := gettickcount();
  15805. RealICQTeamMessage.SendDateTime := aTimesTamp;
  15806. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15807. end;
  15808. procedure TMainForm.WebSocketRemoveTeamResponse(aTeamID: string);
  15809. var
  15810. iIndex: Integer;
  15811. AlertMessage: string;
  15812. RealICQUser: TRealICQUser;
  15813. ARealICQTeam: TRealICQTeam;
  15814. AForm: TForm;
  15815. begin
  15816. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15817. if iIndex >= 0 then
  15818. begin
  15819. FLVTeams.Items.Delete(iIndex);
  15820. FLVTeams.ReDrawAll;
  15821. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15822. if ARealICQTeam = nil then
  15823. Exit;
  15824. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  15825. if RealICQUser = RealICQClient.Me then
  15826. AlertMessage := '您'
  15827. else if RealICQUser.DisplayName = '' then
  15828. AlertMessage := RealICQUser.LoginName
  15829. else
  15830. AlertMessage := RealICQUser.DisplayName;
  15831. if ARealICQTeam.IsTempTeam then
  15832. AlertMessage := AlertMessage + ' 解散了 多人对话'
  15833. else
  15834. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  15835. ShowNotifyAlertForm(AlertMessage);
  15836. AddMessageHistory(smSimple, AlertMessage, nil);
  15837. ShowNavBarNumeric;
  15838. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  15839. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  15840. AForm := GetTeamTalkingForm(aTeamID);
  15841. FreeAndNil(AForm);
  15842. end;
  15843. end;
  15844. procedure TMainForm.WebSocketSendReadTeamInfo(aTeamID: string);
  15845. var
  15846. iLoop, iIndex: Integer;
  15847. ListItem: TRealICQContacterListItem;
  15848. MemberList: TStringList;
  15849. ARealICQTeam: TRealICQTeam;
  15850. begin
  15851. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15852. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  15853. if iIndex = -1 then
  15854. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  15855. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  15856. if ARealICQTeam.IsTempTeam then
  15857. ListItem.Watchword := ''
  15858. else
  15859. ListItem.Watchword := ARealICQTeam.TeamIntro;
  15860. ListItem.LoginState := stLeave;
  15861. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  15862. try
  15863. for iLoop := MemberList.Count - 1 downto 0 do
  15864. begin
  15865. if Length(Trim(MemberList[iLoop])) = 0 then
  15866. MemberList.Delete(iLoop);
  15867. end;
  15868. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  15869. finally
  15870. MemberList.Free;
  15871. end;
  15872. {try
  15873. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  15874. except
  15875. ListItem.HeadImagePicture.Graphic := nil;
  15876. end; }
  15877. if ARealICQTeam.IsTempTeam then
  15878. ListItem.DisplayName := '多人对话'
  15879. else
  15880. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  15881. ListItem.Data := ARealICQTeam;
  15882. ListItem.ReDrawItem;
  15883. ShowNavBarNumeric;
  15884. UpdateTeamOptionsForm(ARealICQTeam);
  15885. UpdateTeamTalkingForm(ARealICQTeam);
  15886. end;
  15887. { TODO -olqq -c : EndWebsocket 2014/12/12 9:05:23 }
  15888. //------------------------------------------------------------------------------
  15889. procedure TMainForm.WebBrowserRightNewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
  15890. var
  15891. WebBrowser1, WebBrowser: TWebBrowser;
  15892. begin
  15893. CoInitialize(nil);
  15894. try
  15895. try
  15896. WebBrowser1 := ASender as TWebBrowser;
  15897. if WebBrowser1.Busy then
  15898. begin
  15899. Cancel := True;
  15900. Exit;
  15901. end;
  15902. WebBrowser := AddWebBrowserToPageControl('about:blank', -3);
  15903. if WebBrowser = nil then
  15904. begin
  15905. Cancel := True;
  15906. Exit;
  15907. end;
  15908. try
  15909. if (WebBrowser.Busy) then
  15910. WebBrowser.Stop;
  15911. except
  15912. end;
  15913. ppDisp := WebBrowser.ControlInterface;
  15914. except
  15915. Cancel := True;
  15916. end;
  15917. finally
  15918. CoUninitialize;
  15919. end;
  15920. end;
  15921. //------------------------------------------------------------------------------
  15922. function TMainForm.AddWebBrowserToPageControl(AUrl: string; WebPanelTag: Integer = -1): TWebBrowser;
  15923. var
  15924. TabSheet: TTabSheet;
  15925. PanelForIE: TPanel;
  15926. WebBrowser: TWebBrowser;
  15927. begin
  15928. if (WebPanelTag = -1) or (WebPanelTag = -3) or (pgcMultiWeb.PageCount <= 0) then
  15929. begin
  15930. TabSheet := TTabSheet.Create(pgcMultiWeb);
  15931. try
  15932. TabSheet.Parent := pgcMultiWeb;
  15933. TabSheet.PageControl := pgcMultiWeb;
  15934. TabSheet.DoubleBuffered := True;
  15935. PanelForIE := TPanel.Create(TabSheet);
  15936. PanelForIE.Parent := TabSheet;
  15937. PanelForIE.DoubleBuffered := True;
  15938. PanelForIE.Color := clWhite;
  15939. PanelForIE.Align := alClient;
  15940. PanelForIE.BevelInner := bvNone;
  15941. PanelForIE.BevelOuter := bvNone;
  15942. PanelForIE.Visible := True;
  15943. PanelForIE.Padding.Left := 2;
  15944. PanelForIE.Padding.Top := 2;
  15945. PanelForIE.Padding.Right := 2;
  15946. PanelForIE.Padding.Bottom := 2;
  15947. WebBrowser := TWebBrowser.Create(PanelForIE);
  15948. WebBrowser.DoubleBuffered := True;
  15949. WebBrowser.ParentWindow := PanelForIE.Handle;
  15950. WebBrowser.Align := alClient;
  15951. WebBrowser.OnStatusTextChange := WebBrowserRightStatusTextChange;
  15952. WebBrowser.OnTitleChange := WebBrowserRightTitleChange;
  15953. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15954. WebBrowser.OnNewWindow2 := WebBrowserRightNewWindow2;
  15955. WebBrowser.OnWindowClosing := WebBrowserRightWindowClosing;
  15956. WebBrowser.Tag := WebPanelTag;
  15957. PanelForIE.InsertControl(WebBrowser);
  15958. except
  15959. TabSheet.PageControl := nil;
  15960. FreeAndNil(TabSheet);
  15961. Result := nil;
  15962. Exit;
  15963. end;
  15964. TabSetMuiltWeb.Tabs.Add(AUrl + ' ');
  15965. try
  15966. TabSetMuiltWeb.TabIndex := TabSetMuiltWeb.Tabs.Count - 1;
  15967. except
  15968. end;
  15969. pgcMultiWeb.ActivePageIndex := pgcMultiWeb.PageCount - 1;
  15970. end
  15971. else
  15972. begin
  15973. TabSheet := pgcMultiWeb.Pages[0];
  15974. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  15975. WebBrowser.Tag := WebPanelTag;
  15976. TabSetMuiltWeb.Tabs.Strings[0] := (AUrl + ' ');
  15977. TabSetMuiltWeb.TabIndex := 0;
  15978. pgcMultiWeb.ActivePageIndex := 0;
  15979. end;
  15980. {
  15981. if not pnlMiddleRight.Visible then
  15982. begin
  15983. if RealICQClient.Logined and RealICQClient.Connected then
  15984. begin
  15985. ShowOrHideMuiltiWeb;
  15986. end;
  15987. end;
  15988. try
  15989. if (WebBrowser.Busy) then WebBrowser.Stop;
  15990. except
  15991. end;
  15992. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15993. //if not ((WebPanelTag = -3) and AnsiSameText(AUrl, 'about:blank')) then
  15994. try
  15995. WebBrowser.Navigate(AUrl);
  15996. except
  15997. end;
  15998. Result := WebBrowser;
  15999. }
  16000. end;
  16001. //------------------------------------------------------------------------------
  16002. {
  16003. procedure TMainForm.WebTabShow(Sender: TObject);
  16004. var
  16005. iIndex: Integer;
  16006. TabSheet: TTabSheet;
  16007. WebPanel: TWebPanel;
  16008. WebURL: String;
  16009. begin
  16010. TabSheet := Sender as TTabSheet;
  16011. //TabSheet.OnShow := nil;
  16012. iIndex := FWebTabs.IndexOf(TabSheet);
  16013. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16014. while TabSheet.ControlCount > 0 do
  16015. begin
  16016. TabSheet.Controls[0].Free;
  16017. //TabSheet.RemoveControl(TabSheet.Controls[0]);
  16018. end;
  16019. if WebPanel.NavigateType = ntGET then
  16020. begin
  16021. WebURL := WebPanel.URL;
  16022. if WebPanel.UserIMLoginName then
  16023. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', RealICQClient.LoginName)
  16024. else
  16025. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebPanel.CustomLoginName);
  16026. if WebPanel.UserIMPassword then
  16027. WebURL := AnsiReplaceText(WebURL, '[%Password%]', RealICQClient.Password)
  16028. else
  16029. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebPanel.CustomPassword);
  16030. AddWebBrowserToPageControl(WebUrl, iIndex);
  16031. end
  16032. else
  16033. AddWebBrowserToPageControl('about:blank', iIndex);
  16034. end;
  16035. }
  16036. //------------------------------------------------------------------------------
  16037. //新Post方式
  16038. procedure TMainForm.WebBrowserRightDocumentCompleteForPost(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16039. var
  16040. WebBrowser: TWebBrowser;
  16041. WebPanel: TWebPanel;
  16042. WebTabAcount: TWebTabAcount;
  16043. FieldName, ALoginName, FieldValue: string;
  16044. PostFields, Field: TStringList;
  16045. iLoop, jLoop, kLoop: Integer;
  16046. WebItem: Olevariant;
  16047. WebItemChild: Olevariant;
  16048. WebItemForm: Olevariant;
  16049. AFindedForm: Boolean;
  16050. ASubmitID: string;
  16051. begin
  16052. WebBrowser := ASender as TWebBrowser;
  16053. WebBrowser.OnDocumentComplete := nil;
  16054. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16055. if WebPanel.Acounts.Count > 0 then
  16056. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16057. else
  16058. WebTabAcount := nil;
  16059. ASubmitID := '';
  16060. ;
  16061. AFindedForm := False;
  16062. PostFields := SplitString(WebPanel.PostFields, ',');
  16063. try
  16064. for kLoop := 0 to PostFields.Count - 1 do
  16065. begin
  16066. Field := SplitStringEx(PostFields.Strings[kLoop], '=');
  16067. try
  16068. try
  16069. FieldName := Field.Strings[0];
  16070. FieldValue := Field.Strings[1];
  16071. if FieldName = 'LXTALK_SUBMIT_BTN' then
  16072. ASubmitID := FieldValue;
  16073. if WebTabAcount <> nil then
  16074. begin
  16075. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16076. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16077. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16078. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16079. end;
  16080. WebBrowser.OleObject.Document.getElementByID(FieldName).value := FieldValue;
  16081. //找到Form
  16082. if not AFindedForm then
  16083. begin
  16084. WebItem := WebBrowser.Document;
  16085. for iLoop := 0 to WebItem.Forms.length - 1 do
  16086. begin
  16087. //ShowMessage(WebItem.Forms.Item(iLoop, 0).name);
  16088. WebItemChild := WebItem.Forms.Item(iLoop, 0);
  16089. for jLoop := 0 to WebItemChild.all.length - 1 do
  16090. begin
  16091. if AnsiSameText(WebItemChild.all.item(jLoop).tagName, 'INPUT') then
  16092. begin
  16093. if AnsiSameText(WebItemChild.all.item(jLoop).name, FieldName) then
  16094. begin
  16095. AFindedForm := True;
  16096. WebItemForm := WebItemChild;
  16097. Break;
  16098. end;
  16099. //ShowMessage(WebItemChild.all.item(jLoop).tagName);
  16100. //ShowMessage(WebItemChild.all.item(jLoop).type);
  16101. //ShowMessage(WebItemChild.all.item(jLoop).name);
  16102. end;
  16103. end; //for
  16104. end; //for
  16105. end; //if
  16106. except
  16107. end;
  16108. finally
  16109. Field.Free;
  16110. end;
  16111. end;
  16112. finally
  16113. PostFields.Free;
  16114. end;
  16115. //ShowMessage(WebItemForm.Action);
  16116. //Exit;
  16117. WebItemForm.target := '_blank';
  16118. //Exit;
  16119. if ASubmitID <> '' then
  16120. begin
  16121. for jLoop := 0 to WebItemForm.all.length - 1 do
  16122. begin
  16123. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16124. begin
  16125. if AnsiSameText(WebItemForm.all.item(jLoop).name, ASubmitID) then
  16126. begin
  16127. WebItemForm.all.item(jLoop).click;
  16128. end;
  16129. end;
  16130. end;
  16131. end
  16132. else
  16133. begin
  16134. for jLoop := 0 to WebItemForm.all.length - 1 do
  16135. begin
  16136. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16137. begin
  16138. if AnsiSameText(WebItemForm.all.item(jLoop).type, 'submit') then
  16139. begin
  16140. WebItemForm.all.item(jLoop).click;
  16141. end;
  16142. end;
  16143. end;
  16144. end;
  16145. Application.ProcessMessages;
  16146. Sleep(100);
  16147. Application.ProcessMessages;
  16148. //FreeAndNil(WebBrowser);
  16149. end;
  16150. //------------------------------------------------------------------------------
  16151. //Get方式加旧版本Post方式
  16152. procedure TMainForm.WebBrowserRightDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16153. var
  16154. PanelForIE: TPanel;
  16155. WebBrowser: TWebBrowser;
  16156. WebPanel: TWebPanel;
  16157. v: Variant;
  16158. parameters: string;
  16159. OldTag, iLoop: Integer;
  16160. PostFields, Field: TStringList;
  16161. WebURL, FieldName, ALoginName, FieldValue: string;
  16162. WebTabAcount: TWebTabAcount;
  16163. SetTagAsZero: Boolean;
  16164. begin
  16165. WebBrowser := ASender as TWebBrowser;
  16166. OldTag := WebBrowser.Tag;
  16167. SetTagAsZero := True;
  16168. PanelForIE := WebBrowser.Owner as TPanel;
  16169. try
  16170. if (not PanelForIE.Visible) and (not AnsiSameText(URL, 'about:blank')) then
  16171. begin
  16172. //PanelForIE.Visible := True;
  16173. WebBrowser.OnDocumentComplete := nil;
  16174. WebBrowser.Navigate('about:blank');
  16175. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar(String(URL)),'',SW_SHOWMAXIMIZED);
  16176. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(URL)), '', SW_SHOWMAXIMIZED);
  16177. Exit;
  16178. end;
  16179. {if not AnsiSameText(URL, 'about:blank') then
  16180. begin
  16181. WebBrowser.OnDocumentComplete := nil;
  16182. with cbxURLInputer.ItemsEx.Add do
  16183. begin
  16184. Caption := URL;
  16185. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  16186. ImageIndex := 2
  16187. else if Copy(Caption, 1, 4) = 'ftp:' then
  16188. ImageIndex := 1
  16189. else
  16190. ImageIndex := 0;
  16191. end;
  16192. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  16193. if WebBrowser.Document <> nil then
  16194. begin
  16195. (WebBrowser.Application as IOleobject).DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser, 0, Handle, GetClientRect);
  16196. end;
  16197. end;}
  16198. if AnsiSameText(URL, 'about:blank') and (WebBrowser.Tag >= 0) and (TabAcountIndex >= 0) then
  16199. begin
  16200. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16201. if WebPanel.Acounts.Count > 0 then
  16202. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16203. else
  16204. WebTabAcount := nil;
  16205. WebBrowser.Tag := -1;
  16206. WebURL := WebPanel.URL;
  16207. if WebPanel.FName = '网络存储' then
  16208. begin
  16209. OpenNewWorkDisk(WebPanel.FURL);
  16210. Exit;
  16211. end;
  16212. if WebPanel.FNavigateType = ntGET then
  16213. begin
  16214. if Length(Trim(WebPanel.PostFields)) > 0 then
  16215. begin
  16216. if Pos('?', WebPanel.URL) > 0 then
  16217. WebURL := WebPanel.URL + '&' + ReplaceStr(WebPanel.PostFields, ',', '&')
  16218. else
  16219. WebURL := WebPanel.URL + '?' + ReplaceStr(WebPanel.PostFields, ',', '&');
  16220. end;
  16221. if WebTabAcount <> nil then
  16222. begin
  16223. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebTabAcount.LoginName);
  16224. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebTabAcount.Password);
  16225. WebURL := AnsiReplaceText(WebURL, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16226. WebURL := AnsiReplaceText(WebURL, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16227. WebURL := AnsiReplaceText(WebURL, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16228. WebURL := AnsiReplaceText(WebURL, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16229. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16230. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16231. end;
  16232. parameters := ALoginName + ' ' + RealICQClient.Password;
  16233. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(Trim(WebURL))), PChar(parameters), SW_SHOWMAXIMIZED);
  16234. end
  16235. else
  16236. begin
  16237. v := VarArrayCreate([0, 0], varVariant);
  16238. v[0] := '<body>' + '<form method="post" action="' + WebURL + '" target="_blank">';
  16239. PostFields := SplitString(WebPanel.PostFields, ',');
  16240. for iLoop := 0 to PostFields.Count - 1 do
  16241. begin
  16242. Field := SplitStringEx(PostFields.Strings[iLoop], '=');
  16243. try
  16244. FieldName := Field.Strings[0];
  16245. FieldValue := Field.Strings[1];
  16246. if WebTabAcount <> nil then
  16247. begin
  16248. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16249. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16250. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16251. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16252. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16253. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16254. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16255. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16256. end;
  16257. v[0] := v[0] + '<input type="hidden" ' + 'name="' + FieldName + '" ' + 'value="' + FieldValue + '">';
  16258. except
  16259. end;
  16260. Field.Free;
  16261. end;
  16262. PostFields.Free;
  16263. v[0] := v[0] + '</form>' + '</body>';
  16264. (WebBrowser.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16265. WebBrowser.oleobject.document.Forms.Item(0, 0).Submit;
  16266. end;
  16267. end;
  16268. finally
  16269. ClearMemory;
  16270. if SetTagAsZero then
  16271. WebBrowser.Tag := -1;
  16272. //pgcMainWorkArea.ActivePageIndex := 0;
  16273. end;
  16274. end;
  16275. procedure TMainForm.WebBrowserForPostWorkOrderDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16276. begin
  16277. //
  16278. { if URL='about:blank' then
  16279. begin
  16280. v := VarArrayCreate([0, 0], varVariant);
  16281. v[0] := '<body>' +
  16282. '<form method="post" action="' + WebURL + '" target="_blank">';
  16283. v[0] := v[0] +
  16284. '<input type="hidden" ' +
  16285. 'name="' + FieldName +'" ' +
  16286. 'value="'+ FieldValue + '">';
  16287. v[0] := v[0] +
  16288. '</form>' +
  16289. '</body>';
  16290. (WebBrowserForPostWorkOrder.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16291. WebBrowserForPostWorkOrder.oleobject.document.Forms.Item(0, 0).Submit;
  16292. end; }
  16293. end;
  16294. procedure TMainForm.UploadWebTabAccounts;
  16295. var
  16296. iLoop, jLoop: Integer;
  16297. WebPanel: TWebPanel;
  16298. StrTemp: string;
  16299. WebTabAcount: TWebTabAcount;
  16300. begin
  16301. StrTemp := '';
  16302. for iLoop := 0 to WebPanels.Count - 1 do
  16303. begin
  16304. WebPanel := WebPanels.Objects[iLoop] as TWebPanel;
  16305. for jLoop := 0 to WebPanel.Acounts.Count - 1 do
  16306. begin
  16307. WebTabAcount := WebPanel.Acounts[jLoop];
  16308. 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);
  16309. end;
  16310. end;
  16311. MainForm.RealICQClient.CallServerDBProcedure('SetWebTabAcounts', StrTemp);
  16312. end;
  16313. //------------------------------------------------------------------------------
  16314. procedure TMainForm.WebTabShow(Sender: TObject);
  16315. var
  16316. iIndex: Integer;
  16317. TabSheet: TTabSheet;
  16318. WebPanel: TWebPanel;
  16319. WebTabAcount: TWebTabAcount;
  16320. iLoop: Integer;
  16321. begin
  16322. if not DisplayWebs then
  16323. Exit;
  16324. TabSheet := Sender as TTabSheet;
  16325. //TabSheet.OnShow := nil;
  16326. iIndex := FWebTabs.IndexOf(TabSheet);
  16327. iIndex := TabSheet.Tag;
  16328. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16329. TabAcountIndex := 0;
  16330. if WebPanel.Acounts.Count = 0 then
  16331. begin
  16332. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  16333. begin
  16334. AddWebTabForm := TAddWebTabForm.Create(Self);
  16335. try
  16336. AddWebTabForm.NewWebPanel := True;
  16337. AddWebTabForm.Left := Mouse.CursorPos.X;
  16338. AddWebTabForm.Top := Mouse.CursorPos.Y - 20;
  16339. if Left <= AddWebTabForm.Width then
  16340. AddWebTabForm.Left := Left + Width - 10
  16341. else
  16342. AddWebTabForm.Left := Left - AddWebTabForm.Width + 10;
  16343. if (AddWebTabForm.Top + AddWebTabForm.Height) > Screen.Height then
  16344. AddWebTabForm.Top := Screen.Height - AddWebTabForm.Height;
  16345. if AddWebTabForm.ShowModal = mrOK then
  16346. begin
  16347. WebTabAcount := TWebTabAcount.Create;
  16348. WebTabAcount.WebTabID := StrToInt(WebPanel.ID);
  16349. WebTabAcount.Title := Trim(AddWebTabForm.edTitle.Text);
  16350. WebTabAcount.LoginName := AddWebTabForm.ALoginName;
  16351. WebTabAcount.Password := AddWebTabForm.APassword;
  16352. WebTabAcount.Explain := Trim(AddWebTabForm.edExplain.Text);
  16353. WebPanel.Acounts.Add(WebTabAcount);
  16354. UploadWebTabAccounts;
  16355. end
  16356. else
  16357. begin
  16358. TabAcountIndex := -1;
  16359. end;
  16360. finally
  16361. FreeAndNil(AddWebTabForm);
  16362. end;
  16363. end;
  16364. end;
  16365. OpenWebTab(TabSheet, WebPanel, TabAcountIndex);
  16366. end;
  16367. //------------------------------------------------------------------------------
  16368. procedure TMainForm.ShowOrHideMuiltiWeb;
  16369. var
  16370. OldWidth: Integer;
  16371. begin
  16372. LockWindowUpdate(GetDesktopWindow);
  16373. OldWidth := pnlMiddleClient.Width;
  16374. try
  16375. //if not pnlMiddleRight.Visible then pnlMiddleRight.Width := 680;
  16376. pnlMiddleRight.Visible := not pnlMiddleRight.Visible;
  16377. Spl.Visible := pnlMiddleRight.Visible;
  16378. if not pnlMiddleRight.Visible then
  16379. begin
  16380. Width := Width - pnlMiddleRight.Width - Spl.Width;
  16381. Spl.Align := alRight;
  16382. pnlMiddleClient.Align := alClient;
  16383. pnlMiddleRight.Align := alRight;
  16384. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  16385. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  16386. end
  16387. else
  16388. begin
  16389. // Width := Width + pnlMiddleRight.Width + Spl.Width;
  16390. Top := Screen.Height div 2 - 290;
  16391. Left := Screen.Width div 2 - 440;
  16392. Width := 880;
  16393. Height := 580;
  16394. Spl.Align := alLeft;
  16395. pnlMiddleClient.Align := alLeft;
  16396. pnlMiddleRight.Align := alClient;
  16397. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth + pnlMiddleRight.Constraints.MinWidth + Spl.Width;
  16398. pnlAll.Constraints.MaxWidth := 0;
  16399. pnlMiddleClient.Left := 0;
  16400. spl.Left := pnlMiddleClient.Left + pnlMiddleClient.Width + 1;
  16401. end;
  16402. finally
  16403. pnlMiddleClient.Width := OldWidth;
  16404. LockWindowUpdate(0);
  16405. end;
  16406. end;
  16407. //------------------------------------------------------------------------------
  16408. procedure TMainForm.actMsgManagerExecute(Sender: TObject);
  16409. begin
  16410. if MessagesManagerForm <> nil then
  16411. begin
  16412. MessagesManagerForm.BringToFront;
  16413. Exit;
  16414. end;
  16415. MessagesManagerForm := TMessagesManagerForm.Create(Application);
  16416. MessagesManagerForm.Width := Round(Screen.WorkAreaWidth * 0.95);
  16417. MessagesManagerForm.Height := Round(Screen.WorkAreaHeight * 0.95);
  16418. MessagesManagerForm.Show;
  16419. end;
  16420. //------------------------------------------------------------------------------
  16421. procedure TMainForm.RealICQClientAddedBlacklists(Sender: TObject; ALoginName: string);
  16422. var
  16423. ItemIndex: Integer;
  16424. RealICQUser: TRealICQUser;
  16425. RealICQContacterListView: TRealICQContacterListView;
  16426. RealICQContacterListItem: TRealICQContacterListItem;
  16427. begin
  16428. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  16429. if RealICQContacterListView.Items.IndexOf(ALoginName) = -1 then
  16430. begin
  16431. ItemIndex := RealICQClient.Blacklists.IndexOf(ALoginName);
  16432. RealICQUser := RealICQClient.Blacklists.Objects[ItemIndex] as TRealICQUser;
  16433. RealICQContacterListView := GetListViewByLoginName(RealICQUser.LoginName);
  16434. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  16435. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  16436. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  16437. end;
  16438. end;
  16439. procedure TMainForm.RealICQClientAddFriendRequest(Sender: TObject; ALoginName, ATag: string);
  16440. begin
  16441. AddMessageHistory(smSimple, ALoginName + ' 请求加您为好友', nil);
  16442. ShowAddFriendRequestWindow(Self, ALoginName, ATag);
  16443. end;
  16444. procedure TMainForm.RealICQClientAddFriendResponse(Sender: TObject; ALoginName, ATag: string; AAcceptted: Boolean);
  16445. var
  16446. RealICQUser: TRealICQUser;
  16447. itemIndex: Integer;
  16448. begin
  16449. if AAcceptted then
  16450. begin
  16451. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  16452. AddMessageHistory(smSimple, '您已将 ' + ALoginName + ' 添加至好友列表', nil);
  16453. FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  16454. //显示好友
  16455. // ShowGroupInterface;
  16456. ShowNotifyAlertForm('已将 ' + ALoginName + ' 添加至好友列表');
  16457. end
  16458. else
  16459. begin
  16460. if Length(ATag) = 0 then
  16461. ATag := '无';
  16462. AddMessageHistory(smSimple, ALoginName + ' 拒绝了您添加好友的请求', nil);
  16463. ShowNotifyAlertForm(ALoginName + ' 拒绝添加好友的请求' + #$D#$A + '附言:' + ATag);
  16464. end;
  16465. end;
  16466. //------------------------------------------------------------------------------
  16467. procedure TMainForm.actOpenMainFormExecute(Sender: TObject);
  16468. begin
  16469. //if FHidden then ZoomEffect(Self, zaMaximize);
  16470. Show;
  16471. ShowWindow(Handle, SW_SHOW);
  16472. ForceForeGroundWindow(Handle);
  16473. FHidden := False;
  16474. if FMainFormHidden then
  16475. begin
  16476. FDblClickedTrayIcon := True;
  16477. TimerForShowMainForm.Enabled := False;
  16478. //TimerForShowMainForm.Enabled := True;
  16479. SetForegroundWindow(TrueHiddenMainForm.Handle);
  16480. ShowMainForm;
  16481. end
  16482. else
  16483. HideMainForm;
  16484. end;
  16485. //------------------------------------------------------------------------------
  16486. procedure TMainForm.actOpenRecvFileDirExecute(Sender: TObject);
  16487. begin
  16488. ShellExecute(handle, 'open', PChar('"' + RecvFileDir + '"'), '', '', SW_SHOWNORMAL);
  16489. end;
  16490. //------------------------------------------------------------------------------
  16491. procedure TMainForm.actOptionsExecute(Sender: TObject);
  16492. begin
  16493. if OptionsForm <> nil then
  16494. Exit;
  16495. OptionsForm := TOptionsForm.Create(Self);
  16496. try
  16497. OptionsForm.ShowModal;
  16498. finally
  16499. FreeAndNil(OptionsForm);
  16500. end;
  16501. end;
  16502. //------------------------------------------------------------------------------
  16503. procedure TMainForm.actPersonalSetExecute(Sender: TObject);
  16504. var
  16505. AForm: IUIForm;
  16506. begin
  16507. // AForm := TViewManager.Current.GetView('TSettingViewForm');
  16508. // AForm.SetFormInfo('{"center":true, "unsizeable":true}');
  16509. // AForm.Show;
  16510. if OptionsForm <> nil then
  16511. Exit;
  16512. OptionsForm := TOptionsForm.Create(Self);
  16513. try
  16514. OptionsForm.PageIndex := 0;
  16515. OptionsForm.ShowModal;
  16516. finally
  16517. FreeAndNil(OptionsForm);
  16518. end;
  16519. end;
  16520. procedure TMainForm.actQuitExecute(Sender: TObject);
  16521. var
  16522. iWaitTimes: Integer;
  16523. begin
  16524. if RealICQClient.Connected then
  16525. begin
  16526. if GetTalkingFormCount > 0 then
  16527. begin
  16528. if MessageBox(Handle, '确实要退出吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  16529. Exit;
  16530. if Showing then
  16531. Close;
  16532. CloseAllTalkingForm;
  16533. iWaitTimes := 0;
  16534. while GetTalkingFormCount > 0 do
  16535. begin
  16536. Sleep(100);
  16537. Inc(iWaitTimes);
  16538. if iWaitTimes > 100 then
  16539. Break;
  16540. Application.ProcessMessages;
  16541. end;
  16542. end;
  16543. RealICQClient.Logout;
  16544. TTeamsAdapter.Stop;
  16545. end;
  16546. if Showing then
  16547. Close;
  16548. MainForm.OnClose := nil;
  16549. MainForm.Close;
  16550. TrueHiddenMainForm.Close;
  16551. end;
  16552. //------------------------------------------------------------------------------
  16553. procedure TMainForm.actConnectSetExecute(Sender: TObject);
  16554. begin
  16555. if OptionsForm <> nil then
  16556. Exit;
  16557. OptionsForm := TOptionsForm.Create(Self);
  16558. try
  16559. OptionsForm.PageIndex := 6;
  16560. OptionsForm.ShowModal;
  16561. finally
  16562. FreeAndNil(OptionsForm);
  16563. end;
  16564. end;
  16565. //------------------------------------------------------------------------------
  16566. procedure TMainForm.actCreateTeamExecute(Sender: TObject);
  16567. //var
  16568. // iLoop: Integer;
  16569. // Team: TRealICQTeam;
  16570. begin
  16571. // for iLoop := 0 to RealICQClient.Teams.Count - 1 do
  16572. // begin
  16573. // Team := RealICQClient.Teams.Objects[iLoop] as TRealICQTeam;
  16574. // if (not Team.IsTempTeam) and AnsiSameText(Team.TeamCreater, RealICQClient.LoginName) then
  16575. // begin
  16576. // MessageBox(Handle, '抱歉,您已经创建了一个群组了!', '提示', MB_ICONINFORMATION);
  16577. // Exit;
  16578. // end;
  16579. // end;
  16580. //if CreateTeamForm = nil then CreateTeamForm := TCreateTeamForm.Create(Self);
  16581. //CreateTeamForm.Show;
  16582. try
  16583. CreateTeamForm := TCreateTeamForm.Create(Self);
  16584. try
  16585. CreateTeamForm.ShowModal;
  16586. finally
  16587. FreeAndNil(CreateTeamForm);
  16588. end;
  16589. except
  16590. end;
  16591. end;
  16592. //------------------------------------------------------------------------------
  16593. procedure TMainForm.actCustomFacesManagerExecute(Sender: TObject);
  16594. begin
  16595. if CustomFacesManagerForm = nil then
  16596. CustomFacesManagerForm := TCustomFacesManagerForm.Create(Application);
  16597. CustomFacesManagerForm.Show;
  16598. end;
  16599. //------------------------------------------------------------------------------
  16600. procedure TMainForm.actAVSetExecute(Sender: TObject);
  16601. begin
  16602. WinExec(PChar('"' + ExtractFilePath(Application.ExeName) + AVSetExeFile + '" "' + ExtractFilePath(Application.ExeName) + 'Languages\' + MainForm.Language + '.ini' + '"'), SW_SHOWNORMAL);
  16603. end;
  16604. //------------------------------------------------------------------------------
  16605. procedure TMainForm.actChangePassExecute(Sender: TObject);
  16606. begin
  16607. if ChangePassForm <> nil then
  16608. Exit;
  16609. ChangePassForm := TChangePassForm.Create(Self);
  16610. try
  16611. ChangePassForm.ShowModal;
  16612. finally
  16613. FreeAndNil(ChangePassForm);
  16614. end;
  16615. end;
  16616. //------------------------------------------------------------------------------
  16617. procedure TMainForm.actCloseExecute(Sender: TObject);
  16618. begin
  16619. Close;
  16620. end;
  16621. //--------------------------------------------------------------
  16622. procedure ClearFileMissions;
  16623. var
  16624. iLoop, jLoop: Integer;
  16625. UploadMission: TUploadMission;
  16626. DownloadMission: TDownloadMission;
  16627. Missions: TStringList;
  16628. begin
  16629. for iLoop := FUploadMissions.Count - 1 downto 0 do
  16630. begin
  16631. UploadMission := FUploadMissions.Objects[iLoop] as TUploadMission;
  16632. try
  16633. FreeAndNil(UploadMission);
  16634. except
  16635. end;
  16636. end;
  16637. FUploadMissions.Clear;
  16638. for iLoop := FSavedUploadMissions.Count - 1 downto 0 do
  16639. begin
  16640. Missions := TStringList(FSavedUploadMissions[iLoop]);
  16641. for jLoop := Missions.Count - 1 downto 0 do
  16642. begin
  16643. UploadMission := Missions.Objects[jLoop] as TUploadMission;
  16644. try
  16645. FreeAndNil(UploadMission);
  16646. except
  16647. end;
  16648. end;
  16649. Missions.Clear;
  16650. FreeAndNil(Missions);
  16651. end;
  16652. FSavedUploadMissions.Clear;
  16653. for iLoop := FSavedDownloadMissions.Count - 1 downto 0 do
  16654. begin
  16655. Missions := TStringList(FSavedDownloadMissions[iLoop]);
  16656. for jLoop := Missions.Count - 1 downto 0 do
  16657. begin
  16658. DownloadMission := Missions.Objects[jLoop] as TDownloadMission;
  16659. try
  16660. FreeAndNil(DownloadMission);
  16661. except
  16662. end;
  16663. end;
  16664. Missions.Clear;
  16665. FreeAndNil(Missions);
  16666. end;
  16667. FSavedDownloadMissions.Clear;
  16668. for iLoop := FDownloadMissions.Count - 1 downto 0 do
  16669. begin
  16670. DownloadMission := FDownloadMissions.Objects[iLoop] as TDownloadMission;
  16671. try
  16672. FreeAndNil(DownloadMission);
  16673. except
  16674. end;
  16675. end;
  16676. FDownloadMissions.Clear;
  16677. end;
  16678. //---退出主程序-----------------------------------------------------
  16679. procedure TMainForm.QuitWindows;
  16680. var
  16681. iWaitTimes: Integer;
  16682. begin
  16683. RealICQClient.OnLoginFailed := nil;
  16684. if RealICQClient.Connected then
  16685. begin
  16686. if GetTalkingFormCount > 0 then
  16687. begin
  16688. if Showing then
  16689. Close;
  16690. CloseAllTalkingForm;
  16691. iWaitTimes := 0;
  16692. while GetTalkingFormCount > 0 do
  16693. begin
  16694. Sleep(100);
  16695. Inc(iWaitTimes);
  16696. if iWaitTimes > 100 then
  16697. Break;
  16698. Application.ProcessMessages;
  16699. end;
  16700. end;
  16701. RealICQClient.Logout;
  16702. end;
  16703. if Showing then
  16704. Close;
  16705. MainForm.OnClose := nil;
  16706. MainForm.Close;
  16707. TrueHiddenMainForm.Close;
  16708. end;
  16709. //-----获的天气信息--------------------------------------------------------
  16710. procedure TMainForm.GetWeather(City, Weatheren, Weather: string);
  16711. var
  16712. Data: CopyDataStruct;
  16713. Args: PChar;
  16714. weatherImgPath: string;
  16715. WeatherList: TStringList;
  16716. WeatherPanelWidth: Integer;
  16717. begin
  16718. lblWeatherCity.Caption := City;
  16719. lblWeatheren.Caption := Weatheren;
  16720. lblWeather.Caption := Weather;
  16721. weatherImgPath := ExtractFilePath(paramstr(0)) + 'Images\Weather\' + GetWeatherImgName(lblWeather.Caption);
  16722. if fileexists(weatherImgPath) then
  16723. imgWeather.Picture.LoadFromFile(weatherImgPath);
  16724. WeatherPanelWidth := lblWeatherCity.Left + lblWeatherCity.Width + 5 + imgWeather.Width + 5 + lblWeather.Width + 5 + lblWeatheren.Width;
  16725. if pnlWebSearch.Width - spbAddFriend.Left >= WeatherPanelWidth then
  16726. lblWeatherCity.Left := spbAddFriend.Left
  16727. else
  16728. lblWeatherCity.Left := btMainMenu.Left + btMainMenu.Width + 5;
  16729. imgWeather.Left := lblWeatherCity.Left + lblWeatherCity.Width + 5;
  16730. lblWeather.Left := imgWeather.Left + imgWeather.Width + 5;
  16731. lblWeatheren.Left := lblWeather.Left + lblWeather.Width + 5;
  16732. end;
  16733. procedure TMainForm.SetGetMoreUserEvent;
  16734. begin
  16735. RealICQClient.OnGettedMoreBranchList := RealICQClientGettedMoreBranchList;
  16736. RealICQClient.OnGettedMoreUserList := RealICQClientGettedMoreUserList;
  16737. if (MessageBoxForm <> nil) then
  16738. begin
  16739. FreeAndNil(MessageBoxForm);
  16740. MessageBoxForm := nil;
  16741. end;
  16742. end;
  16743. //------------------------------------------------------------------------------
  16744. procedure TMainForm.OpenWebTab(TabSheet: TTabSheet; WebPanel: TWebPanel; AcountIndex: Integer);
  16745. var
  16746. Panel, PanelForIE: TPanel;
  16747. WebBrowser: TWebBrowser;
  16748. begin
  16749. TabAcountIndex := AcountIndex;
  16750. Panel := TPanel.Create(TabSheet);
  16751. Panel.Parent := TabSheet;
  16752. Panel.DoubleBuffered := True;
  16753. Panel.Font.Color := spbDisplayName.Font.Color;
  16754. Panel.Caption := '页面加载中...';
  16755. Panel.Color := clWhite;
  16756. Panel.Align := alClient;
  16757. Panel.BevelInner := bvNone;
  16758. Panel.BevelOuter := bvNone;
  16759. Panel.Visible := True;
  16760. Application.ProcessMessages;
  16761. PanelForIE := TPanel.Create(Panel);
  16762. PanelForIE.Parent := Panel;
  16763. PanelForIE.Tag := TabSheet.Tag;
  16764. PanelForIE.DoubleBuffered := True;
  16765. PanelForIE.Color := clWhite;
  16766. PanelForIE.Align := alClient;
  16767. PanelForIE.BevelInner := bvNone;
  16768. PanelForIE.BevelOuter := bvNone;
  16769. PanelForIE.Visible := True;
  16770. Application.ProcessMessages;
  16771. WebBrowser := TWebBrowser.Create(PanelForIE);
  16772. WebBrowser.DoubleBuffered := True;
  16773. WebBrowser.ParentWindow := PanelForIE.Handle;
  16774. WebBrowser.Align := alClient;
  16775. WebBrowser.Visible := True;
  16776. WebBrowser.Tag := TabSheet.Tag;
  16777. WebBrowser.RegisterAsBrowser := True;
  16778. WebBrowser.RegisterAsDropTarget := True;
  16779. //WebBrowser.OnBeforeNavigate2 := WebBrowserRightBeforeNavigate2;
  16780. if WebPanel.FNavigateType = ntFill then
  16781. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentCompleteForPost
  16782. else
  16783. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16784. PanelForIE.InsertControl(WebBrowser);
  16785. Application.ProcessMessages;
  16786. if DisplayWebs then
  16787. begin
  16788. if WebPanel.FNavigateType = ntFill then
  16789. WebBrowser.Navigate(WebPanel.FURL)
  16790. else
  16791. WebBrowser.Navigate('about:blank');
  16792. end;
  16793. end;
  16794. //-------------------------------------------------------
  16795. procedure TMainForm.LoadMainTabImage;
  16796. begin
  16797. MyContactersIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '1.bmp');
  16798. SysMsgIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '2.bmp');
  16799. MyFriendIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '3.bmp');
  16800. MyTeamIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '4.bmp');
  16801. LatestsIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '5.bmp');
  16802. end;
  16803. //------------------------------------------------------------------------------
  16804. //下载升级配置文件
  16805. //------------------------------------------------------------------------------
  16806. procedure TMainForm.DownLoadUpdateConfig;
  16807. var
  16808. TempDir: string;
  16809. begin
  16810. TempDir := GetMyDocument + '\Update';
  16811. if not DirectoryExists(TempDir) then
  16812. ForceDirectories(TempDir);
  16813. if FileExists(GetMyDocument + '\Update\Update.dat') then
  16814. begin
  16815. SetFileAttributes(pchar(GetMyDocument + '\Update\Update.dat'), file_attribute_normal);
  16816. DeleteFile(GetMyDocument + '\Update\Update.dat');
  16817. end;
  16818. FDownFile.ThreadDownFile('http://' + MainForm.RealICQClient.RemoteAddress + '/Update/Update.dat', TempDir + '\Update.dat');
  16819. end;
  16820. //------------------------------------------------------------------------------
  16821. //文件下载完成事件处理函数
  16822. //-----------------------------------------------------------------------------=
  16823. procedure TMainForm.DownFaceFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  16824. begin
  16825. ShowGettedFace(Dest_file);
  16826. end;
  16827. procedure TMainForm.DownFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  16828. var
  16829. OldVersion, Version: string;
  16830. F: Textfile;
  16831. City, Weatheren, Weather: string;
  16832. function GetVersionFromIniFile(FileName: string): string;
  16833. var
  16834. IniFile: TIniFile;
  16835. begin
  16836. IniFile := TIniFile.Create(ExtractFilePath(paramstr(0)) + 'Update.dat');
  16837. try
  16838. OldVersion := IniFile.ReadString('Version', 'Version', '1.0.0.0');
  16839. finally
  16840. IniFile.Free;
  16841. end;
  16842. end;
  16843. begin
  16844. if FileExists(Dest_file) then
  16845. begin
  16846. if UpperCase(ExtractFileExt(Dest_file)) = '.DAT' then
  16847. begin
  16848. OldVersion := '1.0.0.0';
  16849. if FileExists(ExtractFilePath(paramstr(0)) + 'Update.dat') then
  16850. OldVersion := GetVersionFromIniFile(ExtractFilePath(paramstr(0)) + 'Update.dat');
  16851. if FileExists(GetMyDocument + '\Update\Update.dat') then
  16852. Version := GetVersionFromIniFile(GetMyDocument + '\Update\Update.dat');
  16853. if trim(OldVersion) <> trim(Version) then
  16854. WinExec('Update.exe', SW_SHOW);
  16855. end
  16856. else
  16857. begin
  16858. AssignFile(F, Dest_file);
  16859. try
  16860. Reset(F);
  16861. Readln(F, City);
  16862. Readln(F, Weatheren);
  16863. Readln(F, Weather);
  16864. GetWeather(City, Weatheren, Weather);
  16865. finally
  16866. Closefile(F); {关闭文件 F}
  16867. end;
  16868. end;
  16869. end;
  16870. end;
  16871. //------------------------------------------------------------------------------
  16872. //
  16873. //------------------------------------------------------------------------------
  16874. procedure TMainForm.RealICQClientGettedSysMsgInterfaces(Sender: TObject);
  16875. begin
  16876. //
  16877. end;
  16878. //------------------------------------------------------------------------------
  16879. function TMainForm.GetBranchName(LoginName: string): string;
  16880. var
  16881. ItemIndex: Integer;
  16882. Branch: TRealICQBranch;
  16883. Employee: TRealICQEmployee;
  16884. Node: TTreeNode;
  16885. RealICQContacterTreeView: TRealICQContacterTreeView;
  16886. begin
  16887. Result := '';
  16888. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  16889. begin
  16890. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  16891. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  16892. end
  16893. else
  16894. begin
  16895. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMyContacters);
  16896. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  16897. end;
  16898. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  16899. if (Employee = nil) then
  16900. Exit;
  16901. Node := Employee.Node.Parent;
  16902. Result := Node.Text;
  16903. while Node.Parent <> nil do
  16904. begin
  16905. Node := Node.Parent;
  16906. if Node = nil then
  16907. Break;
  16908. if Node.Parent <> nil then
  16909. Result := Node.Text + '/' + Result;
  16910. end;
  16911. end;
  16912. //------------------------------------------------------------------------------
  16913. function TMainForm.GetCompany: string;
  16914. var
  16915. iIndex: Integer;
  16916. ServerInfo: TServerInfo;
  16917. begin
  16918. Result := '';
  16919. if (FServerInfoList.IndexOf(MainForm.CurrentServerID) < 0) or (FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID) < 0) then
  16920. Exit;
  16921. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  16922. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.CurrentServerID)] as (TServerInfo)
  16923. else
  16924. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID)] as (TServerInfo);
  16925. if Assigned(ServerInfo) then
  16926. Result := ServerInfo.ServerName;
  16927. end;
  16928. //------------------------------------------------------------------------------
  16929. //用post方式提交XML文件到服务器
  16930. //------------------------------------------------------------------------------
  16931. procedure TMainForm.PostUpdateLog;
  16932. function ReadUpdateLog: string;
  16933. var
  16934. XMLFile: string;
  16935. ConfigNode: IXMLNode;
  16936. XMLDocument: TXMLDocument;
  16937. begin
  16938. Result := '';
  16939. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  16940. XMLDocument := TXMLDocument.Create(Self);
  16941. try
  16942. try
  16943. if FileExists(XMLFile) then
  16944. begin
  16945. XMLDocument.Active := True;
  16946. XMLDocument.LoadFromFile(XMLFile);
  16947. ConfigNode := XMLDocument.DocumentElement;
  16948. if ConfigNode.ChildNodes.FindNode('product').Attributes['status'] then
  16949. begin
  16950. Result := XMLDocument.XML.Text;
  16951. end;
  16952. end;
  16953. except
  16954. on E: EXception do
  16955. end;
  16956. finally
  16957. XMLDocument.Free;
  16958. end;
  16959. end;
  16960. var
  16961. XMLStr, Url: string;
  16962. begin
  16963. Url := GetUpdateLogPostUrl(ExtractFilePath(paramstr(0)) + 'Online.ini');
  16964. if Url = '' then
  16965. Url := DefaultUpdateLogPostUrl;
  16966. Url := Url + '?LoginName=' + RealICQClient.LoginName + '&DisplayName=' + HttpEncode(AnsiToUtf8(RealICQClient.Me.DisplayName)) + '&ServerName=' + HttpEncode(AnsiToUtf8(edServerList.Text));
  16967. XMLStr := ReadUpdateLog;
  16968. if XMLStr <> '' then
  16969. begin
  16970. TThreadPost.Create(Url, XMLStr);
  16971. end;
  16972. end;
  16973. //------------------------------------------------------------------------------
  16974. procedure TMainForm.UpdatePostLogState(Status: Boolean);
  16975. var
  16976. XMLFile: string;
  16977. ConfigNode: IXMLNode;
  16978. XMLDocument: TXMLDocument;
  16979. begin
  16980. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  16981. XMLDocument := TXMLDocument.Create(Self);
  16982. try
  16983. try
  16984. if FileExists(XMLFile) then
  16985. begin
  16986. XMLDocument.Active := True;
  16987. XMLDocument.LoadFromFile(XMLFile);
  16988. ConfigNode := XMLDocument.DocumentElement;
  16989. ConfigNode.ChildNodes.FindNode('product').Attributes['status'] := Status;
  16990. XMLDocument.SaveToFile(XMLFile);
  16991. end;
  16992. except
  16993. end;
  16994. finally
  16995. XMLDocument.Free;
  16996. end;
  16997. end;
  16998. constructor TThreadPost.Create(URL, Content: string);
  16999. begin
  17000. inherited Create(True);
  17001. FURL := URL;
  17002. FContent := Content;
  17003. FreeOnTerminate := True;
  17004. Resume;
  17005. end;
  17006. procedure TThreadPost.Execute;
  17007. var
  17008. IdHttp: TIdHTTP;
  17009. Sends: TStrings;
  17010. begin
  17011. IdHttp := TIdHTTP.Create(nil);
  17012. Sends := TStringList.Create;
  17013. try
  17014. IdHttp.Request.ContentType := 'application/x-www-form-urlencoded';
  17015. Sends.Add('XmlStr=' + StrToBase64(FContent));
  17016. IdHttp.Post(FUrl, Sends);
  17017. MainForm.UpdatePostLogState(False);
  17018. finally
  17019. FreeAndNil(IdHttp);
  17020. Sends.Free;
  17021. end;
  17022. end;
  17023. //---------------检测指定的进程是否运行-----------------------------------------
  17024. constructor TCheckRunProcessThread.Create(AProgramName, AProcessPath: string);
  17025. begin
  17026. inherited Create(True);
  17027. ProgramName := AProgramName;
  17028. ProcessPath := AProcessPath;
  17029. FreeOnTerminate := True;
  17030. Resume;
  17031. end;
  17032. //------------得到进程的执行路径------------------------------------------------
  17033. function TCheckRunProcessThread.GetProcessPath(ProcessID: DWORD): string;
  17034. var
  17035. Hand: THandle;
  17036. ModName: array[0..Max_Path - 1] of Char;
  17037. hMod: HModule;
  17038. n: DWORD;
  17039. begin
  17040. Result := '';
  17041. Hand := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, ProcessID);
  17042. if Hand > 0 then
  17043. try
  17044. ENumProcessModules(Hand, @hMod, Sizeof(hMod), n);
  17045. if GetModuleFileNameEx(Hand, hMod, ModName, Sizeof(ModName)) > 0 then
  17046. Result := ModName; //得到路径和文见名
  17047. except
  17048. end;
  17049. end;
  17050. //根据可执行文件名称查找进程列表,以判断程序是否正在运行。
  17051. function TCheckRunProcessThread.FindProcess(AFileName: string): boolean;
  17052. var
  17053. hSnapshot: THandle; //用于获得进程列表
  17054. lppe: TProcessEntry32; //用于查找进程
  17055. Found: Boolean; //用于判断进程遍历是否完成
  17056. ProcessPath: string;
  17057. begin
  17058. Result := False;
  17059. hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); //获得系统进程列表
  17060. lppe.dwSize := SizeOf(TProcessEntry32); //在调用Process32First API之前,需要初始化lppe记录的大小
  17061. Found := Process32First(hSnapshot, lppe); //将进程列表的第一个进程信息读入ppe记录中
  17062. while Found do
  17063. begin
  17064. ProcessPath := GetProcessPath(lppe.th32ProcessID);
  17065. if UpperCase(ProcessPath) = UpperCase(AFileName) then
  17066. begin
  17067. Result := True;
  17068. end;
  17069. Found := Process32Next(hSnapshot, lppe); //将进程列表的下一个进程信息读入lppe记录中
  17070. end;
  17071. end;
  17072. //------------------------------------------------------------------------------
  17073. procedure TCheckRunProcessThread.Execute;
  17074. begin
  17075. while FindProcess(ProcessPath) do
  17076. begin
  17077. Sleep(1000);
  17078. end;
  17079. MainForm.PostUpdateLog;
  17080. end;
  17081. procedure TMainForm.btOAClick(Sender: TObject);
  17082. begin
  17083. MessageBox(Handle, '协同办公系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17084. end;
  17085. procedure TMainForm.btSwapClick(Sender: TObject);
  17086. begin
  17087. MessageBox(Handle, '公文交换系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17088. end;
  17089. initialization
  17090. HookID := 0;
  17091. FUploadMissions := TStringList.Create;
  17092. FSavedUploadMissions := TList.Create;
  17093. FDownloadMissions := TStringList.Create;
  17094. FSavedDownloadMissions := TList.Create;
  17095. CoInitialize(nil);
  17096. OleInitialize(nil);
  17097. finalization
  17098. try
  17099. ClearFileMissions;
  17100. FreeAndNil(FSavedDownloadMissions);
  17101. FreeAndNil(FSavedUploadMissions);
  17102. FreeAndNil(FUploadMissions);
  17103. FreeAndNil(FDownloadMissions);
  17104. OleUninitialize;
  17105. CoUninitialize;
  17106. except
  17107. end;
  17108. end.