MainFrm.pas 657 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217
  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 = '/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. {通讯录}
  1269. function GetGroupUserCount: Integer;
  1270. procedure SaveContacter(Name, Mobile, Tel, Email, Remark, BranchId: string);
  1271. procedure GetParentGroupNameList(BranchInfo: TRealICQBranchInfo; var Groups: string);
  1272. procedure CreateManageGroupMessage(GroupId, GroupName, ParentId, MessageId: string);
  1273. procedure CreateManageGroupMemberMessage(ID, DisplayName, NickName, Mobile, Tel, Email, Remark, GroupId, MessageId: string);
  1274. {通讯录}
  1275. procedure ItemOnline(Item: TRealICQContacterListItem);
  1276. procedure ItemOffline(Item: TRealICQContacterListItem);
  1277. procedure ItemDoubleClick(Item: TRealICQContacterListItem);
  1278. procedure ItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1279. procedure ItemIconButtonDblClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1280. procedure ItemOnMouseEnter(Item: TRealICQContacterListItem);
  1281. procedure ItemOnMouseLeave(Item: TRealICQContacterListItem);
  1282. procedure ItemOnHeadImageEnter(Item: TRealICQContacterListItem);
  1283. procedure ItemOnHeadImageLeave(Item: TRealICQContacterListItem);
  1284. procedure SetToolBarState(Sender: TObject);
  1285. function GetActiveTabSheetName: string;
  1286. function AddFriendTreeView(AOwner: TWinControl; GroupName: string): Integer;
  1287. function AddContacterListView(AOwner: TWinControl; GroupName: string): Integer;
  1288. function AddContacterTreeView(AOwner: TWinControl; GroupName: string): Integer;
  1289. procedure UpdateContacterListView(RealICQContacterListView: TRealICQContacterListView);
  1290. procedure CheckWindowPositon;
  1291. procedure BindUserDataToItem(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean = True);
  1292. procedure BindUserDataToItemForGroup(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AGroupAlias: string; AShowNavBarNumeric: Boolean = True);
  1293. procedure UpdateEmployeeNode(Employee: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  1294. procedure UpdateFriendNode(Friend: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  1295. procedure StopFlash(ALoginName: string);
  1296. procedure StopFlashTeam(ATeamID: string);
  1297. procedure SetGetMoreUserEvent;
  1298. procedure SaveDefaultConfigs;
  1299. // procedure LoadSysMsgInterfaceConfig;
  1300. // procedure SaveSysMsgInterfaceConfig;
  1301. procedure SaveGroupConfigs;
  1302. procedure SaveHintAndSoundConfigs;
  1303. procedure SaveCustomFaceConfig;
  1304. procedure SaveReceiveFileConfigs;
  1305. procedure SaveSafeConfigs;
  1306. procedure SaveAutoUpdateConfigs;
  1307. procedure SaveOfflineAutoResponseSets;
  1308. procedure SetDOMStyle(Doc: IHTMLDocument2);
  1309. procedure OpenMessagesManagerForm;
  1310. property ContacterListViews: TStringList read FContacterListViews;
  1311. property ContacterTreeViews: TStringList read FContacterTreeViews;
  1312. property ListViewLatests: TRealICQContacterListView read FLVLatests;
  1313. property CurrentServerID: string read FCurrentServerID;
  1314. property UIMainColor: TColor read FUIMainColor;
  1315. property CanAlert: Boolean read FCanAlert;
  1316. property OfflineAutoResponseTexts: TStringList read FOfflineAutoResponseTexts write FOfflineAutoResponseTexts;
  1317. property ShowGroup: Boolean read FShowGroup write SetShowGroup;
  1318. property Groups: TStringList read FGroups write FGroups;
  1319. property TalkingFormAlwaysOnTop: Boolean read FTalkingFormAlwaysOnTop write SetTalkingFormAlwaysOnTop;
  1320. property CtrlEnterSendMessage: Boolean read FCtrlEnterSendMessage write SetCtrlEnterSendMessage;
  1321. property CopyScreenHideTalkForm: Boolean read FCopyScreenHideTalkForm write SetCopyScreenHideTalkForm;
  1322. property InputFont: TFont read FInputFont write SetInputFont;
  1323. property FaceList: TStringList read FFaceList;
  1324. property TempFaceList: TStringList read FTempFaceList;
  1325. property FaceCategory: TStringList read FFaceCategory;
  1326. property SystemFaceCount: Integer read FSystemFaceCount;
  1327. property ShowGIFInMailForm: Boolean read FShowGIFInMailForm;
  1328. property ShowGIFInTalkingForm: Boolean read FShowGIFInTalkingForm;
  1329. property NotReadMessages: TStringList read FNotReadMessages;
  1330. property TalkingFormLeft: Integer read FTalkingFormLeft write FTalkingFormLeft;
  1331. property TalkingFormTop: Integer read FTalkingFormTop write FTalkingFormTop;
  1332. property TalkingFormWidth: Integer read FTalkingFormWidth write FTalkingFormWidth;
  1333. property TalkingFormHeight: Integer read FTalkingFormHeight write FTalkingFormHeight;
  1334. property SMSFormLeft: Integer read FSMSFormLeft write FSMSFormLeft;
  1335. property SMSFormTop: Integer read FSMSFormTop write FSMSFormTop;
  1336. property SMSFormWidth: Integer read FSMSFormWidth write FSMSFormWidth;
  1337. property SMSFormHeight: Integer read FSMSFormHeight write FSMSFormHeight;
  1338. property ShowMainFormOnStart: Boolean read FShowMainFormOnStart write SetShowMainFormOnStart;
  1339. property ConfirmSendOfflineFile: Boolean read FConfirmSendOfflineFile write FConfirmSendOfflineFile;
  1340. property AlwaysOnTop: Boolean read FAlwaysOnTop write FAlwaysOnTop;
  1341. property AutoHide: Boolean read FAutoHide write FAutoHide;
  1342. property AutoShowRequestMessage: Boolean read FAutoShowRequestMessage write FAutoShowRequestMessage;
  1343. property ShowHintOnOnline: Boolean read FShowHintOnOnline write FShowHintOnOnline;
  1344. property ShowHintOnOffline: Boolean read FShowHintOnOffline write FShowHintOnOffline;
  1345. property DontShowHintOnBusy: Boolean read FDontShowHintOnBusy write FDontShowHintOnBusy;
  1346. property PlaySoundOnOnline: Boolean read FPlaySoundOnOnline write FPlaySoundOnOnline;
  1347. property PlaySoundOnOffline: Boolean read FPlaySoundOnOffline write FPlaySoundOnOffline;
  1348. property PlaySoundOnGetMessage: Boolean read FPlaySoundOnGetMessage write FPlaySoundOnGetMessage;
  1349. property PlaySoundOnGetSystemMessage: Boolean read FPlaySoundOnGetSystemMessage write FPlaySoundOnGetSystemMessage;
  1350. property FlashCaptionOnOnline: Boolean read FFlashCaptionOnOnline write FFlashCaptionOnOnline;
  1351. property FlashImageOnGetMessage: Boolean read FFlashImageOnGetMessage write FFlashImageOnGetMessage;
  1352. property ShowShakeWindow: Boolean read FShowShakeWindow write FShowShakeWindow;
  1353. property ShowCustomMessage: Boolean read FShowCustomMessage write FShowCustomMessage;
  1354. property ShowFileTransCompleted: Boolean read FShowFileTransCompleted write FShowFileTransCompleted;
  1355. property OnlineEventSound: string read FOnlineEventSound write FOnlineEventSound;
  1356. property OfflineEventSound: string read FOfflineEventSound write FOfflineEventSound;
  1357. property MessageEventSound: string read FMessageEventSound write FMessageEventSound;
  1358. property SystemMessageEventSound: string read FSystemMessageEventSound write FSystemMessageEventSound;
  1359. property RecvFileDir: string read FRecvFileDir write FRecvFileDir;
  1360. property UseCacheDir: Boolean read FUseCacheDir write FUseCacheDir;
  1361. property CacheDir: string read FCacheDir write FCacheDir;
  1362. property LimitCacheDirSize: Boolean read FLimitCacheDirSize write FLimitCacheDirSize;
  1363. property MaxCacheDirSize: Integer read FMaxCacheDirSize write FMaxCacheDirSize;
  1364. property AudoDeleteCacheFile: Boolean read FAudoDeleteCacheFile write FAudoDeleteCacheFile;
  1365. property AudoDeleteCacheFileDate: Integer read FAudoDeleteCacheFileDate write FAudoDeleteCacheFileDate;
  1366. property ScanVirus: Boolean read FScanVirus write FScanVirus;
  1367. property ScanVirusProgram: string read FScanVirusProgram write FScanVirusProgram;
  1368. property DontUseCacheFileOnBigFile: Boolean read FDontUseCacheFileOnBigFile write FDontUseCacheFileOnBigFile;
  1369. property DontUseCacheFileOnBigFileSize: Integer read FDontUseCacheFileOnBigFileSize write FDontUseCacheFileOnBigFileSize;
  1370. property RecvFileSafeLevel: TRecvFileSafeLevel read FRecvFileSafeLevel write FRecvFileSafeLevel;
  1371. property AllowURL: Boolean read FAllowURL write FAllowURL;
  1372. property AutoSaveMessage: Boolean read FAutoSaveMessage write FAutoSaveMessage;
  1373. property ShowHistoryInNewWindow: Boolean read FShowHistoryInNewWindow write FShowHistoryInNewWindow;
  1374. property ReadMessageHotKey: string read FReadMessageHotKey write SetReadMessageHotKey;
  1375. property CopyScreenHotKey: string read FCopyScreenHotKey write SetCopyScreenHotKey;
  1376. property AutoUpdate: Boolean read FAutoUpdate write FAutoUpdate;
  1377. property AddrBookURL: string read FAddrBookURL write FAddrBookURL;
  1378. property DBHistory: TRealICQDBHistory read FDBHistory;
  1379. property GroupAddress: string read FGroupAddress write FGroupAddress;
  1380. property GroupPort: Integer read FGroupPort write FGroupPort;
  1381. property GroupImagePort: Integer read FGroupImagePort write FGroupImagePort;
  1382. property GroupShareAddress: string read FGroupShareAddress write FGroupShareAddress;
  1383. property GroupSharePort: Integer read FGroupSharePort write FGroupSharePort;
  1384. end;
  1385. TUploadMission = class
  1386. private
  1387. FID: string;
  1388. FUploadMissionType: TNDMissionType;
  1389. FDirectoryID: Integer;
  1390. FName: string;
  1391. public
  1392. constructor Create(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string);
  1393. destructor Destroy; override;
  1394. property ID: string read FID;
  1395. property UploadMissionType: TNDMissionType read FUploadMissionType;
  1396. property DirectoryID: Integer read FDirectoryID;
  1397. property Name: string read FName;
  1398. end;
  1399. TDownloadMission = class
  1400. FID: string;
  1401. FDownloadMissionType: TNDMissionType;
  1402. FFileID: Integer;
  1403. FFileName: string;
  1404. FDirectoryName: string;
  1405. public
  1406. constructor Create(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = '');
  1407. destructor Destroy; override;
  1408. property ID: string read FID;
  1409. property DownloadMissionType: TNDMissionType read FDownloadMissionType;
  1410. property FileID: Integer read FFileID;
  1411. property FileName: string read FFileName;
  1412. property DirectoryName: string read FDirectoryName;
  1413. end;
  1414. TNavigateType = (ntGET, ntPOST, ntFill);
  1415. //WEB标签面版数据
  1416. TWebPanel = class
  1417. private
  1418. FMustShow: Boolean;
  1419. FShow: Boolean;
  1420. FID, FName, FURL, FImage: string;
  1421. FNavigateType: TNavigateType;
  1422. FPostFields: string;
  1423. FUserIMLoginName: Boolean;
  1424. FUserIMPassword: Boolean;
  1425. FCustomLoginName, FCustomPassword: string;
  1426. FContent: string;
  1427. FAcounts: TList;
  1428. public
  1429. constructor Create();
  1430. destructor Destroy; override;
  1431. property MustShow: Boolean read FMustShow write FMustShow;
  1432. property Show: Boolean read FShow write FShow;
  1433. property ID: string read FID write FID;
  1434. property Name: string read FName write FName;
  1435. property URL: string read FURL write FURL;
  1436. property Image: string read FImage write FImage;
  1437. property NavigateType: TNavigateType read FNavigateType write FNavigateType;
  1438. property PostFields: string read FPostFields write FPostFields;
  1439. property UserIMLoginName: Boolean read FUserIMLoginName write FUserIMLoginName;
  1440. property UserIMPassword: Boolean read FUserIMPassword write FUserIMPassword;
  1441. property CustomLoginName: string read FCustomLoginName write FCustomLoginName;
  1442. property CustomPassword: string read FCustomPassword write FCustomPassword;
  1443. property Content: string read FContent write FContent;
  1444. property Acounts: TList read FAcounts write FAcounts;
  1445. end;
  1446. //未读消息(文字消息)
  1447. TNotReadMessage = class
  1448. private
  1449. FRealICQMessage: TRealICQMessage;
  1450. FShowSendFailed: Boolean;
  1451. FRealICQClient: TRealICQClient;
  1452. public
  1453. destructor Destroy; override;
  1454. property RealICQMessage: TRealICQMessage read FRealICQMessage write FRealICQMessage;
  1455. property ShowSendFailed: Boolean read FShowSendFailed;
  1456. end;
  1457. //未读消息(文字消息)
  1458. TNotReadTeamMessage = class
  1459. private
  1460. FRealICQTeamMessage: TRealICQTeamMessage;
  1461. FShowSendFailed: Boolean;
  1462. public
  1463. destructor Destroy; override;
  1464. property RealICQTeamMessage: TRealICQTeamMessage read FRealICQTeamMessage write FRealICQTeamMessage;
  1465. property ShowSendFailed: Boolean read FShowSendFailed;
  1466. end;
  1467. //未读消息(手机短消息)
  1468. TNotReadSMSMessage = class
  1469. private
  1470. FSMSSender, FSMSContent: string;
  1471. FSMSDateTime: TDateTime;
  1472. public
  1473. property SMSSender: string read FSMSSender;
  1474. property SMSContent: string read FSMSContent;
  1475. property SMSDateTime: TDateTime read FSMSDateTime;
  1476. end;
  1477. TWebTabAcount = class
  1478. private
  1479. FWebTabID: Integer;
  1480. FTitle: string;
  1481. FLoginName: string;
  1482. FPassword: string;
  1483. FExplain: string;
  1484. public
  1485. published
  1486. property WebTabID: Integer read FWebTabID write FWebTabID;
  1487. property Title: string read FTitle write FTitle;
  1488. property LoginName: string read FLoginName write FLoginName;
  1489. property Password: string read FPassword write FPassword;
  1490. property Explain: string read FExplain write FExplain;
  1491. end;
  1492. //添加表示用户状态的图标至指定的 ImageList 中
  1493. procedure AddUserStatePictureToImageList(ImageList: TImageList);
  1494. procedure ClearFileMissions;
  1495. var
  1496. MainForm: TMainForm;
  1497. DisplayWebs: Boolean;
  1498. LVSystemMessage, LVMyContacters, LVFriends, LVStrangers, LVBlacklists, LVLatests, LVTeams, LVMoreUsers, LVAddrbook, LVSearch: string;
  1499. CsvLines, CommaStr: TStringList;
  1500. implementation
  1501. uses
  1502. RegFrm, SearchFrm, AddFriendRequestFrm, AddFriendFrm, OptionsFrm,
  1503. ChangePassFrm, GroupManagerFrm, OnlineOfflineAlertFrm, UserCardDetailView,
  1504. TalkingFrm, TrueHiddenMainFrm, SelFaceFrm, CustomFacesManagerFrm, AddFaceFrm,
  1505. CreateTeamFrm, PtoPFileTransmitter, FileTransmitterObjective, NotifyAlertFrm,
  1506. TeamOptionsFrm, SearchTeamFrm, SystemMessageFrm, MessagesManagerFrm,
  1507. UserCardFrm, VideoFrm, ShareUtils, CopyScreenFrm, SMSFrm,
  1508. ConfirmReplaceNDFileFrm, RemoteControlFrm, ReceiveFolderRequestFrm,
  1509. NotReadMessageBoxFrm, AddWebTabFrm, SelWebTabAcountsFrm, QRCodeFrm,
  1510. LoggerImport, TeamsAdapter, MainFormContrller, Authority, FileTransmitAdapter,
  1511. DataProviderImport, BranchService, UsersService, FriendsService,
  1512. WorkmatesService, MessagesHander, CAImport, InterfaceCA, UserRemarkService,
  1513. GroupConfig, ConditionConfig, PerlRegEx, LimitCondition, UserCardView,
  1514. AboutFrm, SettingView, TextMessageService, ViewManager, InterfaceUI, GuideView;
  1515. var
  1516. HookID: THandle;
  1517. FUploadMissions, FDownloadMissions: TStringList;
  1518. FSavedUploadMissions, FSavedDownloadMissions: TList;
  1519. //------------------------------------------------------------------------------
  1520. procedure AddUserStatePictureToImageList(ImageList: TImageList);
  1521. var
  1522. Bitmap: TBitmap;
  1523. //BitmapLeave: TBitmap;
  1524. //png: TPNGObject;
  1525. //Icon: TIcon;
  1526. begin
  1527. Bitmap := TBitmap.Create;
  1528. //Icon := TIcon.Create;
  1529. //BitmapLeave := TBitmap.Create;
  1530. //png := TPNGObject.Create;
  1531. try
  1532. // try
  1533. // Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1534. // except
  1535. // end;
  1536. // ImageList.Add(Bitmap, nil);
  1537. //
  1538. // Grayscale(Bitmap);
  1539. // ImageList.Insert(0, Bitmap, nil);
  1540. //
  1541. // try
  1542. // Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1543. // BitmapLeave.LoadFromFile(LeavePicture);
  1544. // Bitmap.Canvas.Draw(0, 8, BitmapLeave);
  1545. // except
  1546. // end;
  1547. // ImageList.Add(Bitmap, nil);
  1548. //-----------------------------------------------
  1549. //png.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1550. //Image1.Picture.Bitmap.Assign(png);
  1551. //
  1552. //
  1553. //
  1554. // try
  1555. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1556. // except
  1557. // end;
  1558. // ImageList.AddIcon(Icon);
  1559. //
  1560. // try
  1561. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1562. // except
  1563. // end;
  1564. // ImageList.AddIcon(Icon);
  1565. //
  1566. // try
  1567. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1568. // except
  1569. // end;
  1570. // ImageList.AddIcon(Icon);
  1571. try
  1572. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImageOffline_16.bmp');
  1573. except
  1574. end;
  1575. ImageList.Add(Bitmap, nil);
  1576. try
  1577. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImage_16.bmp');
  1578. except
  1579. end;
  1580. ImageList.Add(Bitmap, nil);
  1581. try
  1582. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImage_leave_16.bmp');
  1583. except
  1584. end;
  1585. ImageList.Add(Bitmap, nil);
  1586. try
  1587. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\OpenFolder.bmp');
  1588. except
  1589. end;
  1590. ImageList.Add(Bitmap, nil);
  1591. try
  1592. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CloseFolder.bmp');
  1593. except
  1594. end;
  1595. ImageList.Add(Bitmap, nil);
  1596. try
  1597. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  1598. except
  1599. end;
  1600. ImageList.Add(Bitmap, nil);
  1601. try
  1602. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  1603. except
  1604. end;
  1605. ImageList.Add(Bitmap, nil);
  1606. try
  1607. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SearchPicture);
  1608. except
  1609. end;
  1610. ImageList.Add(Bitmap, nil);
  1611. try
  1612. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSBMP);
  1613. except
  1614. end;
  1615. ImageList.Add(Bitmap, nil);
  1616. finally
  1617. //BitmapLeave.Free;
  1618. Bitmap.Free;
  1619. //Icon.Free;
  1620. //png.Free;
  1621. end;
  1622. end;
  1623. //------------------------------------------------------------------------------
  1624. function MouseProc(nCode: Integer; wParam, lParam: Longint): Longint; stdcall;
  1625. var
  1626. szClassName: array[0..255] of Char;
  1627. const
  1628. ie_name = 'Internet Explorer_Server';
  1629. begin
  1630. case nCode < 0 of
  1631. True:
  1632. Result := CallNextHookEx(HookID, nCode, wParam, lParam) else
  1633. case wParam of
  1634. WM_RBUTTONDOWN, WM_RBUTTONUP:
  1635. begin
  1636. GetClassName(PMOUSEHOOKSTRUCT(lParam)^.HWND, szClassName, SizeOf(szClassName));
  1637. 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
  1638. begin
  1639. Result := HC_SKIP {屏蔽WebBrowser上的右键}
  1640. end
  1641. else
  1642. begin
  1643. Result := CallNextHookEx(HookID, nCode, wParam, lParam);
  1644. end;
  1645. end
  1646. else
  1647. Result := CallNextHookEx(HookID, nCode, wParam, lParam);
  1648. end;
  1649. end;
  1650. end;
  1651. {$R *.dfm}
  1652. {TWebPanel}
  1653. constructor TWebPanel.Create();
  1654. begin
  1655. FAcounts := TList.Create;
  1656. end;
  1657. destructor TWebPanel.Destroy;
  1658. var
  1659. WebTabAcount: TWebTabAcount;
  1660. begin
  1661. try
  1662. while FAcounts.Count > 0 do
  1663. begin
  1664. WebTabAcount := FAcounts[0];
  1665. FAcounts.Delete(0);
  1666. try
  1667. FreeAndNil(WebTabAcount);
  1668. except
  1669. end;
  1670. end;
  1671. try
  1672. FreeAndNil(FAcounts);
  1673. except
  1674. end;
  1675. finally
  1676. inherited Destroy;
  1677. end;
  1678. end;
  1679. {TDownloadMission}
  1680. //------------------------------------------------------------------------------
  1681. constructor TDownloadMission.Create(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = '');
  1682. begin
  1683. FDownloadMissionType := ADownloadMissionType;
  1684. FDirectoryName := ADirectoryName;
  1685. FFileID := AFileID;
  1686. FFileName := AFileName;
  1687. FID := IntToStr(GetTickCount);
  1688. while FDownloadMissions.IndexOf(FID) >= 0 do
  1689. begin
  1690. FID := IntToStr(GetTickCount);
  1691. Sleep(10);
  1692. Application.ProcessMessages;
  1693. end;
  1694. FDownloadMissions.AddObject(FID, Self);
  1695. end;
  1696. //------------------------------------------------------------------------------
  1697. destructor TDownloadMission.Destroy;
  1698. begin
  1699. try
  1700. try
  1701. FDownloadMissions.Delete(FDownloadMissions.IndexOf(FID));
  1702. except
  1703. end;
  1704. finally
  1705. inherited Destroy;
  1706. end;
  1707. end;
  1708. {TUploadMission}
  1709. //------------------------------------------------------------------------------
  1710. constructor TUploadMission.Create(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string);
  1711. begin
  1712. FUploadMissionType := AUploadMissionType;
  1713. FDirectoryID := ADirectoryID;
  1714. FName := AName;
  1715. FID := IntToStr(Integer(FUploadMissionType)) + IntToStr(FDirectoryID) + FName;
  1716. end;
  1717. //------------------------------------------------------------------------------
  1718. destructor TUploadMission.Destroy;
  1719. begin
  1720. try
  1721. try
  1722. FUploadMissions.Delete(FUploadMissions.IndexOf(FID));
  1723. except
  1724. end;
  1725. finally
  1726. inherited Destroy;
  1727. end;
  1728. end;
  1729. {TNotReadMessage}
  1730. //------------------------------------------------------------------------------
  1731. destructor TNotReadMessage.Destroy;
  1732. begin
  1733. try
  1734. FreeAndNil(FRealICQMessage);
  1735. finally
  1736. inherited Destroy;
  1737. end;
  1738. end;
  1739. {TNotReadTeamMessage}
  1740. //------------------------------------------------------------------------------
  1741. destructor TNotReadTeamMessage.Destroy;
  1742. begin
  1743. try
  1744. FreeAndNil(FRealICQTeamMessage);
  1745. finally
  1746. inherited Destroy;
  1747. end;
  1748. end;
  1749. {TMainForm}
  1750. function TMainForm.GetBitmapFromFileExt(AFileName: string): string;
  1751. var
  1752. FileExt, IconTempFileName, FFileExtImage: string;
  1753. TempFile: array[0..MAX_PATH] of char;
  1754. SHFI: TSHFileInfo;
  1755. Bitmap: TBitmap;
  1756. begin
  1757. try
  1758. FileExt := ExtractFileExt(AFileName);
  1759. FFileExtImage := TRealICQClient.GetFileExtImagesDir + Copy(FileExt, 2, Length(FileExt) - 1) + '.BMP';
  1760. if not FileExists(FFileExtImage) then
  1761. begin
  1762. GetTempPath(MAX_PATH, TempFile);
  1763. GetTempFileName(TempFile, PChar(FileExt), GetTickCount, TempFile);
  1764. IconTempFileName := ReplaceStr(TempFile, ExtractFileExt(TempFile), FileExt);
  1765. TFileStream.Create(IconTempFileName, fmCreate).Free;
  1766. SHGetFileInfo(PChar(IconTempFileName), 0, SHFI, SizeOf(SHFI), SHGFI_ICON or SHGFI_SMALLICON);
  1767. DeleteFile(PChar(IconTempFileName));
  1768. Bitmap := TBitmap.Create;
  1769. try
  1770. Bitmap.Width := 16;
  1771. Bitmap.Height := 16;
  1772. DrawIconEx(Bitmap.Canvas.Handle, 0, 0, SHFI.hIcon, 16, 16, 0, 0, DI_NORMAL);
  1773. Bitmap.SaveToFile(FFileExtImage);
  1774. finally
  1775. FreeAndNil(Bitmap);
  1776. end;
  1777. end;
  1778. Result := FFileExtImage;
  1779. except
  1780. end;
  1781. end;
  1782. //------------------------------------------------------------------------------
  1783. procedure TMainForm.SetShowMainFormOnStart(Value: Boolean);
  1784. begin
  1785. if FShowMainFormOnStart = Value then
  1786. Exit;
  1787. FShowMainFormOnStart := Value;
  1788. SaveDefaultConfigs;
  1789. end;
  1790. //------------------------------------------------------------------------------
  1791. procedure TMainForm.SetTalkingFormAlwaysOnTop(Value: Boolean);
  1792. begin
  1793. FTalkingFormAlwaysOnTop := Value;
  1794. SaveStyleConfigs;
  1795. end;
  1796. //------------------------------------------------------------------------------
  1797. procedure TMainForm.SetCtrlEnterSendMessage(Value: Boolean);
  1798. begin
  1799. FCtrlEnterSendMessage := Value;
  1800. SaveStyleConfigs;
  1801. end;
  1802. procedure TMainForm.SetCopyScreenHideTalkForm(Value: Boolean);
  1803. begin
  1804. FCopyScreenHideTalkForm := Value;
  1805. SaveStyleConfigs;
  1806. end;
  1807. procedure TMainForm.SetShowGroup(Value: Boolean);
  1808. begin
  1809. FShowGroup := Value;
  1810. ShowGroupInterface;
  1811. end;
  1812. procedure TMainForm.SaveIfShowGroupConfig;
  1813. var
  1814. XMLFile: string;
  1815. XMLDocument: TXMLDocument;
  1816. GroupConfigNode: IXMLNode;
  1817. begin
  1818. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  1819. XMLDocument := TXMLDocument.Create(Self);
  1820. try
  1821. XMLDocument.Active := True;
  1822. if not FileExists(XMLFile) then
  1823. begin
  1824. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  1825. XMLDocument.Active := True;
  1826. end;
  1827. XMLDocument.LoadFromFile(XMLFile);
  1828. GroupConfigNode := XMLDocument.DocumentElement;
  1829. GroupConfigNode.ChildNodes.FindNode('ShowGroup').Attributes['Value'] := FShowGroup;
  1830. XMLDocument.SaveToFile();
  1831. finally
  1832. XMLDocument.Free;
  1833. end;
  1834. end;
  1835. //------------------------------------------------------------------------------
  1836. procedure TMainForm.SaveGroupConfigs;
  1837. var
  1838. XMLFile: string;
  1839. XMLDocument: TXMLDocument;
  1840. GroupConfigNode, GroupListNode, GroupNode: IXMLNode;
  1841. GroupMembers: TStringList;
  1842. iLoop, jLoop: Integer;
  1843. begin
  1844. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  1845. XMLDocument := TXMLDocument.Create(Self);
  1846. try
  1847. XMLDocument.Active := True;
  1848. if not FileExists(XMLFile) then
  1849. begin
  1850. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  1851. XMLDocument.Active := True;
  1852. end;
  1853. XMLDocument.LoadFromFile(XMLFile);
  1854. GroupConfigNode := XMLDocument.DocumentElement;
  1855. GroupListNode := GroupConfigNode.ChildNodes.FindNode('Groups');
  1856. for iLoop := 0 to GroupListNode.ChildNodes.Count - 1 do
  1857. begin
  1858. GroupNode := GroupListNode.ChildNodes[iLoop];
  1859. GroupNode.ChildNodes.Clear;
  1860. end;
  1861. GroupListNode.ChildNodes.Clear;
  1862. for iLoop := 0 to FGroups.Count - 1 do
  1863. begin
  1864. GroupNode := GroupListNode.AddChild('Group');
  1865. GroupNode.Attributes['Name'] := FGroups[iLoop];
  1866. GroupNode.Attributes['Position'] := iLoop;
  1867. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  1868. for jLoop := 0 to GroupMembers.Count - 1 do
  1869. begin
  1870. if (not TFriendsService.GetService.IsFriend(GroupMembers[jLoop])) and (not TWorkmatesService.GetService.IsWorkmate(GroupMembers[jLoop])) then
  1871. continue;
  1872. if (AnsiSameText(RealICQClient.LoginName, GroupMembers[jLoop]) and (RealICQClient.WorkingMode = wmPublic)) then
  1873. continue;
  1874. GroupNode.AddChild('GroupMember').Text := GroupMembers[jLoop];
  1875. end;
  1876. end;
  1877. XMLDocument.SaveToFile();
  1878. finally
  1879. XMLDocument.Free;
  1880. end;
  1881. end;
  1882. //------------------------------------------------------------------------------
  1883. procedure TMainForm.SetInputFont(Value: TFont);
  1884. begin
  1885. FInputFont.Assign(Value);
  1886. SaveInputFontConfig;
  1887. end;
  1888. //------------------------------------------------------------------------------
  1889. function TMainForm.GetSystemMessageCounter(AMessageID: Integer): Integer;
  1890. var
  1891. XMLFile: string;
  1892. XMLDocument: TXMLDocument;
  1893. CountersNode, CounterNode: IXMLNode;
  1894. iLoop: Integer;
  1895. CountersDate: TDateTime;
  1896. begin
  1897. Result := 0;
  1898. XMLFile := TRealICQClient.GetUserDir + SystemMessagesCounterXMLFile;
  1899. XMLDocument := TXMLDocument.Create(Self);
  1900. try
  1901. try
  1902. XMLDocument.Active := True;
  1903. if not FileExists(XMLFile) then
  1904. begin
  1905. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SystemMessagesCounterXMLFile), PChar(XMLFile), False);
  1906. XMLDocument.Active := True;
  1907. end;
  1908. XMLDocument.LoadFromFile(XMLFile);
  1909. CountersNode := XMLDocument.DocumentElement;
  1910. try
  1911. CountersDate := StrToDate(CountersNode.Attributes['Date']);
  1912. except
  1913. CountersDate := StrToDate(AnsiReplaceStr(CountersNode.Attributes['Date'], '-', '/'));
  1914. end;
  1915. if CompareDate(CountersDate, Now) <> 0 then
  1916. begin
  1917. CountersNode.Attributes['Date'] := DateToStr(Now);
  1918. CountersNode.ChildNodes.Clear;
  1919. XMLDocument.SaveToFile();
  1920. Exit;
  1921. end;
  1922. for iLoop := 0 to CountersNode.ChildNodes.Count - 1 do
  1923. begin
  1924. CounterNode := CountersNode.ChildNodes[iLoop];
  1925. if StrToInt(CounterNode.Attributes['ID']) = AMessageID then
  1926. begin
  1927. Result := StrToInt(CounterNode.Attributes['Counter']);
  1928. Exit;
  1929. end;
  1930. end;
  1931. finally
  1932. XMLDocument.Free;
  1933. end;
  1934. except
  1935. try
  1936. DeleteFile(XMLFile);
  1937. except
  1938. end;
  1939. Result := 0;
  1940. end;
  1941. end;
  1942. //------------------------------------------------------------------------------
  1943. procedure TMainForm.ImgQrCodeClick(Sender: TObject);
  1944. begin
  1945. QRCodeForm := TQRCodeForm.Create(Self);
  1946. try
  1947. QRCodeForm.ShowModal;
  1948. finally
  1949. FreeAndNil(QRCodeForm);
  1950. end;
  1951. end;
  1952. procedure TMainForm.IncSystemMessageCounter(AMessageID: Integer);
  1953. var
  1954. XMLFile: string;
  1955. XMLDocument: TXMLDocument;
  1956. CountersNode, CounterNode: IXMLNode;
  1957. iLoop: Integer;
  1958. Finded: Boolean;
  1959. CountersDate: TDateTime;
  1960. begin
  1961. XMLFile := TRealICQClient.GetUserDir + SystemMessagesCounterXMLFile;
  1962. XMLDocument := TXMLDocument.Create(Self);
  1963. try
  1964. XMLDocument.Active := True;
  1965. if not FileExists(XMLFile) then
  1966. begin
  1967. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SystemMessagesCounterXMLFile), PChar(XMLFile), False);
  1968. XMLDocument.Active := True;
  1969. end;
  1970. XMLDocument.LoadFromFile(XMLFile);
  1971. CountersNode := XMLDocument.DocumentElement;
  1972. try
  1973. CountersDate := StrToDate(CountersNode.Attributes['Date']);
  1974. except
  1975. CountersDate := StrToDate(AnsiReplaceStr(CountersNode.Attributes['Date'], '-', '/'));
  1976. end;
  1977. if CompareDate(CountersDate, Now) <> 0 then
  1978. begin
  1979. CountersNode.Attributes['Date'] := DateToStr(Now);
  1980. CountersNode.ChildNodes.Clear;
  1981. end;
  1982. Finded := False;
  1983. for iLoop := 0 to CountersNode.ChildNodes.Count - 1 do
  1984. begin
  1985. CounterNode := CountersNode.ChildNodes[iLoop];
  1986. if StrToInt(CounterNode.Attributes['ID']) = AMessageID then
  1987. begin
  1988. CounterNode.Attributes['Counter'] := IntToStr(StrToInt(CounterNode.Attributes['Counter']) + 1);
  1989. Finded := True;
  1990. Break;
  1991. end;
  1992. end;
  1993. if not Finded then
  1994. begin
  1995. CounterNode := CountersNode.AddChild('SystemMessage');
  1996. CounterNode.Attributes['ID'] := IntToStr(AMessageID);
  1997. CounterNode.Attributes['Counter'] := '1';
  1998. end;
  1999. XMLDocument.SaveToFile();
  2000. finally
  2001. XMLDocument.Free;
  2002. end;
  2003. end;
  2004. //------------------------------------------------------------------------------
  2005. procedure TMainForm.SaveCustomFaceConfig;
  2006. var
  2007. XMLFile, FaceCategorys: string;
  2008. XMLDocument: TXMLDocument;
  2009. InputConfigNode, FacesNode, FaceNode: IXMLNode;
  2010. iLoop, jLoop: Integer;
  2011. Face: TFace;
  2012. begin
  2013. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2014. XMLDocument := TXMLDocument.Create(Self);
  2015. try
  2016. XMLDocument.Active := True;
  2017. if not FileExists(XMLFile) then
  2018. begin
  2019. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2020. XMLDocument.Active := True;
  2021. //删除系统表情
  2022. XMLDocument.LoadFromFile(XMLFile);
  2023. InputConfigNode := XMLDocument.DocumentElement;
  2024. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2025. FacesNode.ChildNodes.Clear;
  2026. XMLDocument.SaveToFile();
  2027. XMLDocument.Active := False;
  2028. end;
  2029. XMLDocument.Active := True;
  2030. XMLDocument.LoadFromFile(XMLFile);
  2031. InputConfigNode := XMLDocument.DocumentElement;
  2032. if InputConfigNode.ChildNodes.FindNode('FaceCategory') = nil then
  2033. begin
  2034. InputConfigNode.AddChild('FaceCategory').Text := '';
  2035. XMLDocument.SaveToFile();
  2036. end;
  2037. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2038. FacesNode.ChildNodes.Clear;
  2039. FaceCategorys := '';
  2040. for iLoop := 0 to FFaceCategory.Count - 1 do
  2041. begin
  2042. for jLoop := FSystemFaceCount to FaceList.Count - 1 do
  2043. begin
  2044. Face := FaceList.Objects[jLoop] as TFace;
  2045. if AnsiSameText(Face.Category, FFaceCategory[iLoop]) then
  2046. begin
  2047. FaceNode := FacesNode.AddChild('Face');
  2048. FaceNode.Text := ExtractFileName(Face.FileName);
  2049. FaceNode.Attributes['ShortCut'] := Face.ShortCut;
  2050. FaceNode.Attributes['Name'] := Face.Name;
  2051. FaceNode.Attributes['MD5Code'] := Face.MD5Code;
  2052. FaceNode.Attributes['Category'] := Face.Category;
  2053. end;
  2054. end;
  2055. if iLoop < FFaceCategory.Count - 1 then
  2056. FaceCategorys := FaceCategorys + FFaceCategory[iLoop] + ','
  2057. else
  2058. FaceCategorys := FaceCategorys + FFaceCategory[iLoop];
  2059. end;
  2060. InputConfigNode.ChildNodes.FindNode('FaceCategory').Text := FaceCategorys;
  2061. if SelFaceForm <> nil then
  2062. SelFaceForm.ReDrawFaces;
  2063. XMLDocument.SaveToFile();
  2064. finally
  2065. XMLDocument.Free;
  2066. end;
  2067. end;
  2068. //------------------------------------------------------------------------------
  2069. procedure TMainForm.SaveInputFontConfig;
  2070. var
  2071. XMLFile: string;
  2072. XMLDocument: TXMLDocument;
  2073. InputConfigNode, FacesNode: IXMLNode;
  2074. begin
  2075. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2076. XMLDocument := TXMLDocument.Create(Self);
  2077. try
  2078. XMLDocument.Active := True;
  2079. if not FileExists(XMLFile) then
  2080. begin
  2081. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2082. XMLDocument.Active := True;
  2083. //删除系统表情
  2084. XMLDocument.LoadFromFile(XMLFile);
  2085. InputConfigNode := XMLDocument.DocumentElement;
  2086. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2087. FacesNode.ChildNodes.Clear;
  2088. XMLDocument.SaveToFile();
  2089. XMLDocument.Active := False;
  2090. end;
  2091. XMLDocument.Active := True;
  2092. XMLDocument.LoadFromFile(XMLFile);
  2093. InputConfigNode := XMLDocument.DocumentElement;
  2094. try
  2095. InputConfigNode.ChildNodes.FindNode('Font').Text := FontToString(FInputFont);
  2096. except
  2097. InputConfigNode.ChildNodes.FindNode('Font').Text := FontToString(Font);
  2098. end;
  2099. XMLDocument.SaveToFile();
  2100. finally
  2101. XMLDocument.Free;
  2102. end;
  2103. end;
  2104. //------------------------------------------------------------------------------
  2105. procedure TMainForm.LoadInputConfigs;
  2106. var
  2107. XMLFile: string;
  2108. XMLDocument: TXMLDocument;
  2109. InputConfigNode, FacesNode, FaceNode: IXMLNode;
  2110. Face: TFace;
  2111. iLoop: Integer;
  2112. Category: string;
  2113. begin
  2114. FInputFont.Assign(Font);
  2115. {$region '删除前一个用户的表情'}
  2116. while FFaceList.Count > 0 do
  2117. begin
  2118. FFaceList.Objects[0].Free;
  2119. FFaceList.Delete(0);
  2120. end;
  2121. FFaceList.Clear;
  2122. while FTempFaceList.Count > 0 do
  2123. begin
  2124. FTempFaceList.Objects[0].Free;
  2125. FTempFaceList.Delete(0);
  2126. end;
  2127. FTempFaceList.Clear;
  2128. FFaceCategory.Clear;
  2129. FSystemFaceCount := 0;
  2130. {$endregion}
  2131. {$region '读取系统表情'}
  2132. FFaceCategory.Add(SystemFaceGroup);
  2133. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile;
  2134. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2135. XMLDocument := TXMLDocument.Create(Self);
  2136. try
  2137. XMLDocument.Active := True;
  2138. XMLDocument.LoadFromFile(XMLFile);
  2139. InputConfigNode := XMLDocument.DocumentElement;
  2140. try
  2141. StringToFont(InputConfigNode.ChildNodes.FindNode('Font').Text, FInputFont);
  2142. except
  2143. FInputFont.Assign(Font);
  2144. end;
  2145. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2146. for iLoop := 0 to FacesNode.ChildNodes.Count - 1 do
  2147. begin
  2148. FaceNode := FacesNode.ChildNodes[iLoop];
  2149. Face := TFace.Create(ExtractFilePath(paramstr(0)) + FaceNode.Text, FaceNode.Attributes['ShortCut'], FaceNode.Attributes['Name'], '', SystemFaceGroup);
  2150. FFaceList.AddObject(Face.ShortCut, Face);
  2151. Inc(FSystemFaceCount);
  2152. end;
  2153. finally
  2154. XMLDocument.Free;
  2155. end;
  2156. {$endregion}
  2157. {$region '读取自定义表情'}
  2158. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2159. XMLDocument := TXMLDocument.Create(Self);
  2160. try
  2161. XMLDocument.Active := True;
  2162. if not FileExists(XMLFile) then
  2163. begin
  2164. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2165. XMLDocument.Active := True;
  2166. //删除系统表情
  2167. XMLDocument.LoadFromFile(XMLFile);
  2168. InputConfigNode := XMLDocument.DocumentElement;
  2169. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2170. FacesNode.ChildNodes.Clear;
  2171. XMLDocument.SaveToFile();
  2172. XMLDocument.Active := False;
  2173. end;
  2174. XMLDocument.Active := True;
  2175. XMLDocument.LoadFromFile(XMLFile);
  2176. InputConfigNode := XMLDocument.DocumentElement;
  2177. try
  2178. StringToFont(InputConfigNode.ChildNodes.FindNode('Font').Text, FInputFont);
  2179. except
  2180. FInputFont.Assign(Font);
  2181. end;
  2182. if InputConfigNode.ChildNodes.FindNode('FaceCategory') = nil then
  2183. begin
  2184. InputConfigNode.AddChild('FaceCategory').Text := '';
  2185. XMLDocument.SaveToFile();
  2186. end;
  2187. FreeAndNil(FFaceCategory);
  2188. FFaceCategory := SplitString(InputConfigNode.ChildNodes.FindNode('FaceCategory').Text, ',');
  2189. if FFaceCategory.IndexOf('') >= 0 then
  2190. FFaceCategory.Delete(FFaceCategory.IndexOf(''));
  2191. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2192. for iLoop := 0 to FacesNode.ChildNodes.Count - 1 do
  2193. begin
  2194. FaceNode := FacesNode.ChildNodes[iLoop];
  2195. try
  2196. Category := FaceNode.Attributes['Category'];
  2197. except
  2198. Category := NOFaceCategory;
  2199. end;
  2200. if FFaceCategory.IndexOf(Category) = -1 then
  2201. begin
  2202. if AnsiSameText(Category, NOFaceCategory) then
  2203. FFaceCategory.Insert(0, Category)
  2204. else
  2205. FFaceCategory.Add(Category);
  2206. end;
  2207. Face := TFace.Create(TRealICQClient.GetCustomFaceDir + FaceNode.Text, FaceNode.Attributes['ShortCut'], FaceNode.Attributes['Name'], FaceNode.Attributes['MD5Code'], Category);
  2208. FFaceList.AddObject(Face.MD5Code, Face);
  2209. end;
  2210. finally
  2211. XMLDocument.Free;
  2212. end;
  2213. {$endregion}
  2214. end;
  2215. //------------------------------------------------------------------------------
  2216. procedure TMainForm.LoadSafeConfigs;
  2217. var
  2218. XMLFile: string;
  2219. XMLDocument: TXMLDocument;
  2220. SafeConfigNode: IXMLNode;
  2221. begin
  2222. XMLFile := TRealICQClient.GetUserDir + SafeConfigXMLFile;
  2223. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2224. XMLDocument := TXMLDocument.Create(Self);
  2225. try
  2226. XMLDocument.Active := True;
  2227. if not FileExists(XMLFile) then
  2228. begin
  2229. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SafeConfigXMLFile), PChar(XMLFile), False);
  2230. XMLDocument.Active := True;
  2231. end;
  2232. XMLDocument.LoadFromFile(XMLFile);
  2233. SafeConfigNode := XMLDocument.DocumentElement;
  2234. FRecvFileSafeLevel := TRecvFileSafeLevel(Integer(SafeConfigNode.ChildNodes.FindNode('RecvFileSafeLevel').Attributes['Value']));
  2235. FAllowURL := SafeConfigNode.ChildNodes.FindNode('AllowURL').Attributes['Value'];
  2236. FShowHistoryInNewWindow := SafeConfigNode.ChildNodes.FindNode('ShowHistoryInNewWindow').Attributes['Value'];
  2237. FAutoSaveMessage := SafeConfigNode.ChildNodes.FindNode('AutoSaveMessage').Attributes['Value'];
  2238. finally
  2239. XMLDocument.Free;
  2240. end;
  2241. end;
  2242. //------------------------------------------------------------------------------
  2243. procedure TMainForm.SaveSafeConfigs;
  2244. var
  2245. XMLFile: string;
  2246. XMLDocument: TXMLDocument;
  2247. SafeConfigNode: IXMLNode;
  2248. begin
  2249. XMLFile := TRealICQClient.GetUserDir + SafeConfigXMLFile;
  2250. XMLDocument := TXMLDocument.Create(Self);
  2251. try
  2252. XMLDocument.Active := True;
  2253. if not FileExists(XMLFile) then
  2254. begin
  2255. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SafeConfigXMLFile), PChar(XMLFile), False);
  2256. XMLDocument.Active := True;
  2257. end;
  2258. XMLDocument.LoadFromFile(XMLFile);
  2259. SafeConfigNode := XMLDocument.DocumentElement;
  2260. SafeConfigNode.ChildNodes.FindNode('RecvFileSafeLevel').Attributes['Value'] := Integer(FRecvFileSafeLevel);
  2261. SafeConfigNode.ChildNodes.FindNode('AllowURL').Attributes['Value'] := FAllowURL;
  2262. SafeConfigNode.ChildNodes.FindNode('ShowHistoryInNewWindow').Attributes['Value'] := FShowHistoryInNewWindow;
  2263. SafeConfigNode.ChildNodes.FindNode('AutoSaveMessage').Attributes['Value'] := FAutoSaveMessage;
  2264. XMLDocument.SaveToFile();
  2265. finally
  2266. XMLDocument.Free;
  2267. end;
  2268. end;
  2269. //------------------------------------------------------------------------------
  2270. procedure TMainForm.LoadWebPanelsFromXML;
  2271. var
  2272. ADesKey: string;
  2273. iLoop: Integer;
  2274. XMLFile: string;
  2275. XMLDocument: TXMLDocument;
  2276. WebPanelsNode, WebPanelNode: IXMLNode;
  2277. WebPanel: TWebPanel;
  2278. begin
  2279. XMLFile := TRealICQClient.GetUserDir + WebPanelsXMLFile;
  2280. XMLDocument := TXMLDocument.Create(Self);
  2281. try
  2282. try
  2283. XMLDocument.Active := True;
  2284. if not FileExists(XMLFile) then
  2285. begin
  2286. XMLDocument.XML.Text := '<?xml version="1.0"?>' + '<WebPanels>' + '</WebPanels>';
  2287. XMLDocument.Active := True;
  2288. XMLDocument.SaveToFile(XMLFile);
  2289. end
  2290. else
  2291. begin
  2292. XMLDocument.LoadFromFile(XMLFile);
  2293. end;
  2294. WebPanelsNode := XMLDocument.DocumentElement;
  2295. while FWebPanels.Count > 0 do
  2296. begin
  2297. FWebPanels.Objects[0].Free;
  2298. FWebPanels.Delete(0);
  2299. end;
  2300. FWebPanels.Clear;
  2301. ADesKey := MD5En(RealICQClient.LoginName);
  2302. for iLoop := WebPanelsNode.ChildNodes.Count - 1 downto 0 do
  2303. begin
  2304. WebPanelNode := WebPanelsNode.ChildNodes[iLoop];
  2305. WebPanel := TWebPanel.Create;
  2306. try
  2307. WebPanel.FMustShow := WebPanelNode.Attributes['MustShow'];
  2308. except
  2309. WebPanel.FMustShow := False;
  2310. end;
  2311. try
  2312. WebPanel.FShow := WebPanelNode.Attributes['Show'];
  2313. except
  2314. WebPanel.FShow := False;
  2315. end;
  2316. try
  2317. WebPanel.FID := WebPanelNode.Attributes['ID'];
  2318. except
  2319. WebPanel.FID := '';
  2320. end;
  2321. WebPanel.FName := DESryStrHex(WebPanelNode.Attributes['Name'], ADesKey);
  2322. WebPanel.FURL := DESryStrHex(WebPanelNode.Attributes['URL'], ADesKey);
  2323. WebPanel.FImage := DESryStrHex(WebPanelNode.Attributes['Image'], ADesKey);
  2324. WebPanel.FNavigateType := WebPanelNode.Attributes['NavigateType'];
  2325. WebPanel.FPostFields := DESryStrHex(WebPanelNode.Attributes['PostFields'], ADesKey);
  2326. WebPanel.FUserIMLoginName := WebPanelNode.Attributes['UserIMLoginName'];
  2327. WebPanel.FUserIMPassword := WebPanelNode.Attributes['UserIMPassword'];
  2328. WebPanel.FCustomLoginName := DESryStrHex(WebPanelNode.Attributes['CustomLoginName'], ADesKey);
  2329. WebPanel.FCustomPassword := DESryStrHex(WebPanelNode.Attributes['CustomPassword'], ADesKey);
  2330. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  2331. end;
  2332. except
  2333. end;
  2334. finally
  2335. XMLDocument.Free;
  2336. end;
  2337. end;
  2338. //------------------------------------------------------------------------------
  2339. procedure TMainForm.SaveWebPanelsToXML;
  2340. var
  2341. ADesKey: string;
  2342. iLoop: Integer;
  2343. XMLFile: string;
  2344. XMLDocument: TXMLDocument;
  2345. WebPanelsNode, WebPanelNode: IXMLNode;
  2346. WebPanel: TWebPanel;
  2347. begin
  2348. XMLFile := TRealICQClient.GetUserDir + WebPanelsXMLFile;
  2349. XMLDocument := TXMLDocument.Create(Self);
  2350. try
  2351. try
  2352. XMLDocument.Active := True;
  2353. if not FileExists(XMLFile) then
  2354. begin
  2355. XMLDocument.XML.Text := '<?xml version="1.0"?>' + '<WebPanels>' + '</WebPanels>';
  2356. XMLDocument.Active := True;
  2357. end
  2358. else
  2359. begin
  2360. XMLDocument.LoadFromFile(XMLFile);
  2361. end;
  2362. WebPanelsNode := XMLDocument.DocumentElement;
  2363. ADesKey := MD5En(RealICQClient.LoginName);
  2364. WebPanelsNode.ChildNodes.Clear;
  2365. for iLoop := 0 to FWebPanels.Count - 1 do
  2366. begin
  2367. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  2368. WebPanelNode := WebPanelsNode.AddChild('WebPanel');
  2369. WebPanelNode.Attributes['MustShow'] := WebPanel.FMustShow;
  2370. WebPanelNode.Attributes['Show'] := WebPanel.FShow;
  2371. WebPanelNode.Attributes['ID'] := WebPanel.FID;
  2372. WebPanelNode.Attributes['Name'] := EncryStrHex(WebPanel.FName, ADesKey);
  2373. WebPanelNode.Attributes['URL'] := EncryStrHex(WebPanel.FURL, ADesKey);
  2374. WebPanelNode.Attributes['Image'] := EncryStrHex(WebPanel.FImage, ADesKey);
  2375. WebPanelNode.Attributes['NavigateType'] := WebPanel.FNavigateType;
  2376. WebPanelNode.Attributes['PostFields'] := EncryStrHex(WebPanel.FPostFields, ADesKey);
  2377. WebPanelNode.Attributes['UserIMLoginName'] := WebPanel.FUserIMLoginName;
  2378. WebPanelNode.Attributes['UserIMPassword'] := WebPanel.FUserIMPassword;
  2379. WebPanelNode.Attributes['CustomLoginName'] := EncryStrHex(WebPanel.FCustomLoginName, ADesKey);
  2380. WebPanelNode.Attributes['CustomPassword'] := EncryStrHex(WebPanel.FCustomPassword, ADesKey);
  2381. end;
  2382. XMLDocument.SaveToFile(XMLFile);
  2383. except
  2384. end;
  2385. finally
  2386. XMLDocument.Free;
  2387. end;
  2388. end;
  2389. {
  2390. //----------------------------------------------------------
  2391. procedure TMainForm.LoadSysMsgInterfaceConfig;
  2392. var
  2393. XMLFile: String;
  2394. XMLDocument: TXMLDocument;
  2395. ConfigNodes,ConfigNode: IXMLNode;
  2396. iLoop:Integer;
  2397. SysMsgInterface:TSysMsgInterface;
  2398. MsgIID:String;
  2399. begin
  2400. XMLFile := TRealICQClient.GetUserDir+SysMsgInterfaceConfig;
  2401. XMLDocument := TXMLDocument.Create(Self);
  2402. try
  2403. try
  2404. XMLDocument.Active := True;
  2405. if not FileExists(XMLFile) then
  2406. begin
  2407. XMLDocument.XML.Text := '<?xml version="1.0"?>' +
  2408. '<SysMsgInterfaces>' +
  2409. '</SysMsgInterfaces>';
  2410. XMLDocument.Active := True;
  2411. XMLDocument.SaveToFile(XMLFile);
  2412. end
  2413. else
  2414. begin
  2415. XMLDocument.LoadFromFile(XMLFile);
  2416. end;
  2417. ConfigNodes := XMLDocument.DocumentElement;
  2418. for iLoop := 0 to ConfigNodes.ChildNodes.Count - 1 do
  2419. begin
  2420. ConfigNode:=ConfigNodes.ChildNodes[iLoop];
  2421. MsgIID:=ConfigNode.Attributes['MsgIID'];
  2422. if MainForm.RealICQClient.SysMsgInterfaces.IndexOf(MsgIID)>=0 then
  2423. begin
  2424. SysMsgInterface:=MainForm.RealICQClient.SysMsgInterfaces.Objects[MainForm.RealICQClient.SysMsgInterfaces.IndexOf(MsgIID)] as TSysMsgInterface;
  2425. SysMsgInterface.ShowMsg:=ConfigNode.Attributes['ShowMsg'];
  2426. end;
  2427. end;
  2428. except
  2429. //
  2430. end;
  2431. finally
  2432. XMLDocument.Free;
  2433. end;
  2434. end; }
  2435. {
  2436. //-----------------------------------------------------------
  2437. procedure TMainForm.SaveSysMsgInterfaceConfig;
  2438. var
  2439. XMLFile: String;
  2440. XMLDocument: TXMLDocument;
  2441. ConfigNodes,ConfigNode: IXMLNode;
  2442. iLoop:Integer;
  2443. SysMsgInterface:TSysMsgInterface;
  2444. begin
  2445. XMLFile := TRealICQClient.GetUserDir+SysMsgInterfaceConfig;
  2446. XMLDocument := TXMLDocument.Create(Self);
  2447. try
  2448. try
  2449. XMLDocument.Active := True;
  2450. if not FileExists(XMLFile) then
  2451. begin
  2452. XMLDocument.XML.Text := '<?xml version="1.0"?>' +
  2453. '<SysMsgInterfaces>' +
  2454. '</SysMsgInterfaces>';
  2455. XMLDocument.Active := True;
  2456. end
  2457. else
  2458. begin
  2459. XMLDocument.LoadFromFile(XMLFile);
  2460. end;
  2461. ConfigNodes := XMLDocument.DocumentElement;
  2462. ConfigNodes.ChildNodes.Clear;
  2463. for iLoop := 0 to MainForm.RealICQClient.SysMsgInterfaces.Count - 1 do
  2464. begin
  2465. SysMsgInterface:=MainForm.RealICQClient.SysMsgInterfaces.Objects[iLoop] as TSysMsgInterface;
  2466. ConfigNode:=ConfigNodes.AddChild('SysMsgInterface');
  2467. ConfigNode.Attributes['MsgIID']:=SysMsgInterface.MsgIID;
  2468. ConfigNode.Attributes['ShowMsg']:=SysMsgInterface.ShowMsg;
  2469. end;
  2470. XMLDocument.SaveToFile(XMLFile);
  2471. except
  2472. end;
  2473. finally
  2474. XMLDocument.Free;
  2475. end;
  2476. end; }
  2477. //------------------------------------------------------------------------------
  2478. procedure TMainForm.LoadReceiveFileConfigs;
  2479. var
  2480. XMLFile: string;
  2481. XMLDocument: TXMLDocument;
  2482. ReceiveFileConfigNode: IXMLNode;
  2483. begin
  2484. XMLFile := TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile;
  2485. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2486. XMLDocument := TXMLDocument.Create(Self);
  2487. try
  2488. XMLDocument.Active := True;
  2489. if not FileExists(XMLFile) then
  2490. begin
  2491. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + ReceiveFileConfigXMLFile), PChar(XMLFile), False);
  2492. XMLDocument.Active := True;
  2493. end;
  2494. XMLDocument.LoadFromFile(XMLFile);
  2495. ReceiveFileConfigNode := XMLDocument.DocumentElement;
  2496. FRecvFileDir := ReceiveFileConfigNode.ChildNodes.FindNode('RecvFileDir').Attributes['Value'];
  2497. FUseCacheDir := ReceiveFileConfigNode.ChildNodes.FindNode('UseCacheDir').Attributes['Value'];
  2498. FCacheDir := ReceiveFileConfigNode.ChildNodes.FindNode('CacheDir').Attributes['Value'];
  2499. FLimitCacheDirSize := ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['Value'];
  2500. FMaxCacheDirSize := ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['MaxSize'];
  2501. FAudoDeleteCacheFile := ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Value'];
  2502. FAudoDeleteCacheFileDate := ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Date'];
  2503. FScanVirus := ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Value'];
  2504. FScanVirusProgram := ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Program'];
  2505. FDontUseCacheFileOnBigFile := ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Value'];
  2506. FDontUseCacheFileOnBigFileSize := ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Size'];
  2507. if not DirectoryExists(FRecvFileDir) then
  2508. begin
  2509. FRecvFileDir := RealICQClient.GetUserDir + '我接收到的文件\';
  2510. if not DirectoryExists(FRecvFileDir) then
  2511. CreateDir(FRecvFileDir);
  2512. end;
  2513. if (not DirectoryExists(FCacheDir)) and FUseCacheDir then
  2514. begin
  2515. FCacheDir := RealICQClient.GetUserDir + 'CacheFiles\';
  2516. if not DirectoryExists(FCacheDir) then
  2517. CreateDir(FCacheDir);
  2518. end;
  2519. finally
  2520. XMLDocument.Free;
  2521. end;
  2522. end;
  2523. //------------------------------------------------------------------------------
  2524. procedure TMainForm.SaveReceiveFileConfigs;
  2525. var
  2526. XMLFile: string;
  2527. XMLDocument: TXMLDocument;
  2528. ReceiveFileConfigNode: IXMLNode;
  2529. begin
  2530. XMLFile := TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile;
  2531. XMLDocument := TXMLDocument.Create(Self);
  2532. try
  2533. XMLDocument.Active := True;
  2534. if not FileExists(XMLFile) then
  2535. begin
  2536. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + ReceiveFileConfigXMLFile), PChar(XMLFile), False);
  2537. XMLDocument.Active := True;
  2538. end;
  2539. XMLDocument.LoadFromFile(XMLFile);
  2540. ReceiveFileConfigNode := XMLDocument.DocumentElement;
  2541. ReceiveFileConfigNode.ChildNodes.FindNode('RecvFileDir').Attributes['Value'] := FRecvFileDir;
  2542. ReceiveFileConfigNode.ChildNodes.FindNode('UseCacheDir').Attributes['Value'] := FUseCacheDir;
  2543. ReceiveFileConfigNode.ChildNodes.FindNode('CacheDir').Attributes['Value'] := FCacheDir;
  2544. ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['Value'] := FLimitCacheDirSize;
  2545. ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['MaxSize'] := FMaxCacheDirSize;
  2546. ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Value'] := FAudoDeleteCacheFile;
  2547. ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Date'] := FAudoDeleteCacheFileDate;
  2548. ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Value'] := FScanVirus;
  2549. ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Program'] := FScanVirusProgram;
  2550. ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Value'] := FDontUseCacheFileOnBigFile;
  2551. ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Size'] := FDontUseCacheFileOnBigFileSize;
  2552. XMLDocument.SaveToFile();
  2553. finally
  2554. XMLDocument.Free;
  2555. end;
  2556. end;
  2557. //------------------------------------------------------------------------------
  2558. procedure TMainForm.LoadOfflineAutoResponseSets;
  2559. var
  2560. XMLFile: string;
  2561. XMLDocument: TXMLDocument;
  2562. OfflineAutoResponseConfigNode, TextNode: IXMLNode;
  2563. iLoop: Integer;
  2564. begin
  2565. XMLFile := TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile;
  2566. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2567. XMLDocument := TXMLDocument.Create(Self);
  2568. try
  2569. XMLDocument.Active := True;
  2570. if not FileExists(XMLFile) then
  2571. begin
  2572. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + OfflineAutoResponseConfigXMLFile), PChar(XMLFile), False);
  2573. XMLDocument.Active := True;
  2574. end;
  2575. XMLDocument.LoadFromFile(XMLFile);
  2576. OfflineAutoResponseConfigNode := XMLDocument.DocumentElement;
  2577. FOfflineAutoResponseTexts.Clear;
  2578. for iLoop := 0 to OfflineAutoResponseConfigNode.ChildNodes.Count - 1 do
  2579. begin
  2580. TextNode := OfflineAutoResponseConfigNode.ChildNodes[iLoop];
  2581. FOfflineAutoResponseTexts.Add(TextNode.Text);
  2582. end;
  2583. finally
  2584. XMLDocument.Free;
  2585. end;
  2586. end;
  2587. //------------------------------------------------------------------------------
  2588. procedure TMainForm.SaveOfflineAutoResponseSets;
  2589. var
  2590. XMLFile: string;
  2591. XMLDocument: TXMLDocument;
  2592. OfflineAutoResponseConfigNode: IXMLNode;
  2593. iLoop: Integer;
  2594. begin
  2595. XMLFile := TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile;
  2596. XMLDocument := TXMLDocument.Create(Self);
  2597. try
  2598. XMLDocument.Active := True;
  2599. if not FileExists(XMLFile) then
  2600. begin
  2601. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + OfflineAutoResponseConfigXMLFile), PChar(XMLFile), False);
  2602. XMLDocument.Active := True;
  2603. end;
  2604. XMLDocument.LoadFromFile(XMLFile);
  2605. OfflineAutoResponseConfigNode := XMLDocument.DocumentElement;
  2606. OfflineAutoResponseConfigNode.ChildNodes.Clear;
  2607. for iLoop := 0 to FOfflineAutoResponseTexts.Count - 1 do
  2608. begin
  2609. OfflineAutoResponseConfigNode.AddChild('Text').Text := FOfflineAutoResponseTexts.Strings[iLoop];
  2610. end;
  2611. finally
  2612. XMLDocument.SaveToFile();
  2613. XMLDocument.Free;
  2614. end;
  2615. end;
  2616. //------------------------------------------------------------------------------
  2617. procedure TMainForm.LoadHintAndSoundConfigs;
  2618. var
  2619. XMLFile: string;
  2620. XMLDocument: TXMLDocument;
  2621. HintAndSoundConfigNode: IXMLNode;
  2622. begin
  2623. XMLFile := TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile;
  2624. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2625. XMLDocument := TXMLDocument.Create(Self);
  2626. try
  2627. XMLDocument.Active := True;
  2628. if not FileExists(XMLFile) then
  2629. begin
  2630. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HintAndSoundConfigXMLFile), PChar(XMLFile), False);
  2631. XMLDocument.Active := True;
  2632. end;
  2633. XMLDocument.LoadFromFile(XMLFile);
  2634. HintAndSoundConfigNode := XMLDocument.DocumentElement;
  2635. FFlashCaptionOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('FlashCaptionOnOnline').Attributes['Value'];
  2636. FFlashCaptionOnOnline := False;
  2637. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  2638. FShowHintOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOnline').Attributes['Value'];
  2639. FShowHintOnOffline := HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOffline').Attributes['Value'];
  2640. FDontShowHintOnBusy := HintAndSoundConfigNode.ChildNodes.FindNode('DontShowHintOnBusy').Attributes['Value'];
  2641. FPlaySoundOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['Value'];
  2642. FPlaySoundOnOffline := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['Value'];
  2643. FPlaySoundOnGetMessage := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['Value'];
  2644. FPlaySoundOnGetSystemMessage := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['Value'];
  2645. FFlashImageOnGetMessage := HintAndSoundConfigNode.ChildNodes.FindNode('FlashImageOnGetMessage').Attributes['Value'];
  2646. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow')) then
  2647. begin
  2648. HintAndSoundConfigNode.AddChild('ShowShakeWindow').Attributes['Value'] := True;
  2649. XMLDocument.SaveToFile();
  2650. end;
  2651. FShowShakeWindow := HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow').Attributes['Value'];
  2652. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage')) then
  2653. begin
  2654. HintAndSoundConfigNode.AddChild('ShowCustomMessage').Attributes['Value'] := True;
  2655. XMLDocument.SaveToFile();
  2656. end;
  2657. FShowCustomMessage := HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage').Attributes['Value'];
  2658. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted')) then
  2659. begin
  2660. HintAndSoundConfigNode.AddChild('ShowFileTransCompleted').Attributes['Value'] := True;
  2661. XMLDocument.SaveToFile();
  2662. end;
  2663. FShowFileTransCompleted := HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted').Attributes['Value'];
  2664. FOnlineEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['File'];
  2665. FOfflineEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['File'];
  2666. FMessageEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['File'];
  2667. FSystemMessageEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['File'];
  2668. if AnsiSameText(Copy(FOnlineEventSound, 1, 5), 'Sound') then
  2669. FOnlineEventSound := ExtractFilePath(paramstr(0)) + FOnlineEventSound;
  2670. if AnsiSameText(Copy(FOfflineEventSound, 1, 5), 'Sound') then
  2671. FOfflineEventSound := ExtractFilePath(paramstr(0)) + FOfflineEventSound;
  2672. if AnsiSameText(Copy(FMessageEventSound, 1, 5), 'Sound') then
  2673. FMessageEventSound := ExtractFilePath(paramstr(0)) + FMessageEventSound;
  2674. if AnsiSameText(Copy(FSystemMessageEventSound, 1, 5), 'Sound') then
  2675. FSystemMessageEventSound := ExtractFilePath(paramstr(0)) + FSystemMessageEventSound;
  2676. finally
  2677. XMLDocument.Free;
  2678. end;
  2679. end;
  2680. //------------------------------------------------------------------------------
  2681. procedure TMainForm.SaveHintAndSoundConfigs;
  2682. var
  2683. XMLFile: string;
  2684. XMLDocument: TXMLDocument;
  2685. HintAndSoundConfigNode: IXMLNode;
  2686. begin
  2687. XMLFile := TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile;
  2688. XMLDocument := TXMLDocument.Create(Self);
  2689. try
  2690. XMLDocument.Active := True;
  2691. if not FileExists(XMLFile) then
  2692. begin
  2693. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HintAndSoundConfigXMLFile), PChar(XMLFile), False);
  2694. XMLDocument.Active := True;
  2695. end;
  2696. XMLDocument.LoadFromFile(XMLFile);
  2697. HintAndSoundConfigNode := XMLDocument.DocumentElement;
  2698. HintAndSoundConfigNode.ChildNodes.FindNode('FlashCaptionOnOnline').Attributes['Value'] := FFlashCaptionOnOnline;
  2699. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  2700. HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOnline').Attributes['Value'] := FShowHintOnOnline;
  2701. HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOffline').Attributes['Value'] := FShowHintOnOffline;
  2702. HintAndSoundConfigNode.ChildNodes.FindNode('DontShowHintOnBusy').Attributes['Value'] := FDontShowHintOnBusy;
  2703. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['Value'] := FPlaySoundOnOnline;
  2704. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['Value'] := FPlaySoundOnOffline;
  2705. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['Value'] := FPlaySoundOnGetMessage;
  2706. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['Value'] := FPlaySoundOnGetSystemMessage;
  2707. HintAndSoundConfigNode.ChildNodes.FindNode('FlashImageOnGetMessage').Attributes['Value'] := FFlashImageOnGetMessage;
  2708. HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow').Attributes['Value'] := FShowShakeWindow;
  2709. HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage').Attributes['Value'] := FShowCustomMessage;
  2710. HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted').Attributes['Value'] := FShowFileTransCompleted;
  2711. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['File'] := FOnlineEventSound;
  2712. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['File'] := FOfflineEventSound;
  2713. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['File'] := FMessageEventSound;
  2714. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['File'] := FSystemMessageEventSound;
  2715. XMLDocument.SaveToFile();
  2716. finally
  2717. XMLDocument.Free;
  2718. end;
  2719. end;
  2720. //------------------------------------------------------------------------------
  2721. procedure TMainForm.LoadHotKeyConfigs;
  2722. var
  2723. XMLFile: string;
  2724. XMLDocument: TXMLDocument;
  2725. HotKeyConfigNode: IXMLNode;
  2726. begin
  2727. XMLFile := TRealICQClient.GetUserDir + HotKeyConfigXMLFile;
  2728. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2729. XMLDocument := TXMLDocument.Create(Self);
  2730. try
  2731. XMLDocument.Active := True;
  2732. if not FileExists(XMLFile) then
  2733. begin
  2734. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HotKeyConfigXMLFile), PChar(XMLFile), False);
  2735. XMLDocument.Active := True;
  2736. end;
  2737. XMLDocument.LoadFromFile(XMLFile);
  2738. HotKeyConfigNode := XMLDocument.DocumentElement;
  2739. ReadMessageHotKey := HotKeyConfigNode.ChildNodes.FindNode('ReadMessage').Attributes['Key'];
  2740. CopyScreenHotKey := HotKeyConfigNode.ChildNodes.FindNode('CopyScreen').Attributes['Key'];
  2741. finally
  2742. XMLDocument.Free;
  2743. end;
  2744. end;
  2745. //------------------------------------------------------------------------------
  2746. procedure TMainForm.SaveHotKeyConfigs;
  2747. var
  2748. XMLFile: string;
  2749. XMLDocument: TXMLDocument;
  2750. HotKeyConfigNode: IXMLNode;
  2751. begin
  2752. XMLFile := TRealICQClient.GetUserDir + HotKeyConfigXMLFile;
  2753. XMLDocument := TXMLDocument.Create(Self);
  2754. try
  2755. XMLDocument.Active := True;
  2756. if not FileExists(XMLFile) then
  2757. begin
  2758. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HotKeyConfigXMLFile), PChar(XMLFile), False);
  2759. XMLDocument.Active := True;
  2760. end;
  2761. XMLDocument.LoadFromFile(XMLFile);
  2762. HotKeyConfigNode := XMLDocument.DocumentElement;
  2763. HotKeyConfigNode.ChildNodes.FindNode('ReadMessage').Attributes['Key'] := FReadMessageHotKey;
  2764. HotKeyConfigNode.ChildNodes.FindNode('CopyScreen').Attributes['Key'] := FCopyScreenHotKey;
  2765. XMLDocument.SaveToFile();
  2766. finally
  2767. XMLDocument.Free;
  2768. end;
  2769. end;
  2770. procedure TMainForm.SetCopyScreenHotKey(Value: string);
  2771. var
  2772. HotKeyStr: string;
  2773. HotKey, ModKey: Cardinal;
  2774. begin
  2775. if FCopyScreenHotKey = Value then
  2776. Exit;
  2777. FCopyScreenHotKey := Value;
  2778. if AnsiPos('+', FCopyScreenHotKey) <= 0 then
  2779. FCopyScreenHotKey := 'CTRL+ALT+S';
  2780. HotKeyStr := CutOffString(trim(FCopyScreenHotKey), '+');
  2781. if AnsiPos('+', HotKeyStr) > 0 then
  2782. HotKeyStr := CutOffString(HotKeyStr, '+');
  2783. HotKey := Ord(PChar(UpperCase(HotKeyStr))[0]);
  2784. if HotKeyID_CopyScreen <> 0 then
  2785. begin
  2786. UnregisterHotKey(Handle, HotKeyID_CopyScreen);
  2787. DeleteAtom(HotKeyID_CopyScreen);
  2788. end;
  2789. if (FindAtom('FCopyScreenHotKey') = 0) and (HotKey > 0) then
  2790. begin
  2791. HotKeyID_CopyScreen := GlobalAddAtom(pchar('FCopyScreenHotKey')) - $C000;
  2792. ModKey := GetModKey(FCopyScreenHotKey);
  2793. if (not RegisterHotkey(Handle, HotKeyID_CopyScreen, ModKey, HotKey)) then
  2794. begin
  2795. FCanAlert := True;
  2796. ShowNotifyAlertForm('热键 ' + FCopyScreenHotKey + ' 冲突!');
  2797. FCanAlert := False;
  2798. end;
  2799. //MessageBox(Handle, PChar('热键 '+ FCopyScreenHotKey + ' 已被其它程序注册,请选择其它热键!'), '提示', MB_ICONERROR);
  2800. end;
  2801. SaveHotKeyConfigs;
  2802. end;
  2803. //------------------------------------------------------------------------------
  2804. procedure TMainForm.SetReadMessageHotKey(Value: string);
  2805. var
  2806. HotKeyStr: string;
  2807. HotKey, ModKey: Cardinal;
  2808. begin
  2809. if FReadMessageHotKey = Value then
  2810. Exit;
  2811. FReadMessageHotKey := Value;
  2812. if AnsiPos('+', FReadMessageHotKey) <= 0 then
  2813. FReadMessageHotKey := 'CTRL+ALT+X';
  2814. HotKeyStr := CutOffString(trim(FReadMessageHotKey), '+');
  2815. if AnsiPos('+', HotKeyStr) > 0 then
  2816. HotKeyStr := CutOffString(HotKeyStr, '+');
  2817. HotKey := Ord(PChar(UpperCase(HotKeyStr))[0]);
  2818. if HotKeyID_ReadMessage <> 0 then
  2819. begin
  2820. UnregisterHotKey(Handle, HotKeyID_ReadMessage);
  2821. DeleteAtom(HotKeyID_ReadMessage);
  2822. end;
  2823. if (FindAtom('FReadMessageHotKey') = 0) and (HotKey > 0) then
  2824. begin
  2825. HotKeyID_ReadMessage := GlobalAddAtom(pchar('FReadMessageHotKey')) - $C000;
  2826. ModKey := GetModKey(FReadMessageHotKey);
  2827. if (not RegisterHotkey(Handle, HotKeyID_ReadMessage, ModKey, HotKey)) then
  2828. begin
  2829. FCanAlert := True;
  2830. ShowNotifyAlertForm('热键 ' + FReadMessageHotKey + ' 冲突!');
  2831. FCanAlert := False;
  2832. end;
  2833. //MessageBox(Handle, PChar('热键 ' + FReadMessageHotKey + ' 已被其它程序注册,请选择其它热键!'), '提示', MB_ICONERROR);
  2834. end;
  2835. SaveHotKeyConfigs;
  2836. end;
  2837. //------------------------------------------------------------------------------
  2838. procedure TMainForm.LoadStyleConfigs;
  2839. var
  2840. XMLFile: string;
  2841. XMLDocument: TXMLDocument;
  2842. StyleConfigNode: IXMLNode;
  2843. iLoop: Integer;
  2844. RealICQContacterListView: TRealICQContacterListView;
  2845. RealICQContacterTreeView: TRealICQContacterTreeView;
  2846. AUIMainColor: TColor;
  2847. ALVStyle: TRealICQContacterListItemStyle;
  2848. ALVCaptionStyle: TRealICQContacterListItemCaptionStyle;
  2849. AShowTree: Boolean;
  2850. ASkinName, OldSkinName: string;
  2851. begin
  2852. XMLFile := TRealICQClient.GetUserDir + StyleConfigXMLFile;
  2853. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2854. XMLDocument := TXMLDocument.Create(Self);
  2855. try
  2856. XMLDocument.Active := True;
  2857. if not FileExists(XMLFile) then
  2858. begin
  2859. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + StyleConfigXMLFile), PChar(XMLFile), False);
  2860. XMLDocument.Active := True;
  2861. end;
  2862. XMLDocument.LoadFromFile(XMLFile);
  2863. StyleConfigNode := XMLDocument.DocumentElement;
  2864. OldSkinName := SkinName;
  2865. try
  2866. ASkinName := StyleConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'];
  2867. if ASkinName <> SkinName then
  2868. begin
  2869. SkinName := ASkinName;
  2870. SaveDefaultConfigs;
  2871. ChangeUIColor(UIMainColor);
  2872. end;
  2873. except
  2874. SkinName := OldSkinName;
  2875. end;
  2876. AUIMainColor := StyleConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'];
  2877. ChangeUIColor(FUIMainColor);
  2878. FUIMainColor := AUIMainColor;
  2879. SaveDefaultConfigs;
  2880. if not Assigned(StyleConfigNode.ChildNodes.FindNode('ShowTree')) then
  2881. begin
  2882. StyleConfigNode.AddChild('ShowTree').Attributes['Value'] := True;
  2883. XMLDocument.SaveToFile();
  2884. end;
  2885. AShowTree := StyleConfigNode.ChildNodes.FindNode('ShowTree').Attributes['Value'];
  2886. FShowTree := AShowTree;
  2887. actShowTree.Checked := FShowTree;
  2888. ALVStyle := StyleConfigNode.ChildNodes.FindNode('LVStyle').Attributes['Value'];
  2889. if (RealICQClient.WorkingMode = wmCorporation) or FShowTree then
  2890. begin
  2891. if ALVStyle <> lsNoHeadImage then
  2892. ALVStyle := lsSmallHeadImage;
  2893. end;
  2894. if ALVStyle <> FLVStyle then
  2895. begin
  2896. FLVStyle := ALVStyle;
  2897. for iLoop := 0 to FContacterListViews.Count - 1 do
  2898. begin
  2899. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  2900. RealICQContacterListView.Style := FLVStyle;
  2901. end;
  2902. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  2903. begin
  2904. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  2905. RealICQContacterTreeView.Style := FLVStyle;
  2906. end;
  2907. end;
  2908. ALVCaptionStyle := StyleConfigNode.ChildNodes.FindNode('LVCaptionStyle').Attributes['Value'];
  2909. if ALVCaptionStyle <> FLVCaptionStyle then
  2910. begin
  2911. FLVCaptionStyle := ALVCaptionStyle;
  2912. for iLoop := 0 to FContacterListViews.Count - 1 do
  2913. begin
  2914. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  2915. RealICQContacterListView.CaptionStyle := FLVCaptionStyle;
  2916. end;
  2917. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  2918. begin
  2919. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  2920. RealICQContacterTreeView.CaptionStyle := FLVCaptionStyle;
  2921. end;
  2922. end;
  2923. FShowGIFInMailForm := StyleConfigNode.ChildNodes.FindNode('ShowGIFInMailForm').Attributes['Value'];
  2924. actShowGIFInMailForm.Checked := FShowGIFInMailForm;
  2925. FShowGIFInTalkingForm := StyleConfigNode.ChildNodes.FindNode('ShowGIFInTalkingForm').Attributes['Value'];
  2926. actShowGIFInTalkingForm.Checked := FShowGIFInTalkingForm;
  2927. FShowStrangers := not StyleConfigNode.ChildNodes.FindNode('ShowStrangers').Attributes['Value'];
  2928. if (RealICQClient.WorkingMode = wmCorporation) then
  2929. FShowStrangers := True;
  2930. actShowStrangers.Enabled := True;
  2931. actShowStrangers.Execute;
  2932. FShowBlacklists := not StyleConfigNode.ChildNodes.FindNode('ShowBlacklists').Attributes['Value'];
  2933. if (RealICQClient.WorkingMode = wmCorporation) then
  2934. FShowBlacklists := True;
  2935. actShowBlacklists.Enabled := True;
  2936. actShowBlacklists.Execute;
  2937. FShowTeams := not StyleConfigNode.ChildNodes.FindNode('ShowTeams').Attributes['Value'];
  2938. actShowTeams.Enabled := True;
  2939. actShowTeams.Execute;
  2940. FShowLatests := not StyleConfigNode.ChildNodes.FindNode('ShowLatests').Attributes['Value'];
  2941. actShowLatests.Enabled := True;
  2942. actShowLatests.Execute;
  2943. FTalkingFormAlwaysOnTop := StyleConfigNode.ChildNodes.FindNode('TalkingFormAlwaysOnTop').Attributes['Value'];
  2944. FCtrlEnterSendMessage := StyleConfigNode.ChildNodes.FindNode('CtrlEnterSendMessage').Attributes['Value'];
  2945. if not Assigned(StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm')) then
  2946. begin
  2947. StyleConfigNode.AddChild('CopyScreenHideTalkForm').Attributes['Value'] := False;
  2948. XMLDocument.SaveToFile();
  2949. end;
  2950. FCopyScreenHideTalkForm := StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm').Attributes['Value'];
  2951. finally
  2952. XMLDocument.Free;
  2953. end;
  2954. end;
  2955. //------------------------------------------------------------------------------
  2956. procedure TMainForm.SaveStyleConfigs;
  2957. var
  2958. XMLFile: string;
  2959. XMLDocument: TXMLDocument;
  2960. StyleConfigNode: IXMLNode;
  2961. begin
  2962. XMLFile := TRealICQClient.GetUserDir + StyleConfigXMLFile;
  2963. XMLDocument := TXMLDocument.Create(Self);
  2964. try
  2965. XMLDocument.Active := True;
  2966. if not FileExists(XMLFile) then
  2967. begin
  2968. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + StyleConfigXMLFile), PChar(XMLFile), False);
  2969. XMLDocument.Active := True;
  2970. end;
  2971. XMLDocument.LoadFromFile(XMLFile);
  2972. StyleConfigNode := XMLDocument.DocumentElement;
  2973. StyleConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'] := SkinName;
  2974. StyleConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'] := FUIMainColor;
  2975. StyleConfigNode.ChildNodes.FindNode('ShowTree').Attributes['Value'] := FShowTree;
  2976. StyleConfigNode.ChildNodes.FindNode('LVStyle').Attributes['Value'] := FLVStyle;
  2977. StyleConfigNode.ChildNodes.FindNode('LVCaptionStyle').Attributes['Value'] := FLVCaptionStyle;
  2978. StyleConfigNode.ChildNodes.FindNode('ShowStrangers').Attributes['Value'] := FShowStrangers;
  2979. StyleConfigNode.ChildNodes.FindNode('ShowBlacklists').Attributes['Value'] := FShowBlacklists;
  2980. StyleConfigNode.ChildNodes.FindNode('ShowTeams').Attributes['Value'] := FShowTeams;
  2981. StyleConfigNode.ChildNodes.FindNode('ShowLatests').Attributes['Value'] := FShowLatests;
  2982. StyleConfigNode.ChildNodes.FindNode('ShowGIFInMailForm').Attributes['Value'] := FShowGIFInMailForm;
  2983. StyleConfigNode.ChildNodes.FindNode('ShowGIFInTalkingForm').Attributes['Value'] := FShowGIFInTalkingForm;
  2984. StyleConfigNode.ChildNodes.FindNode('TalkingFormAlwaysOnTop').Attributes['Value'] := False;
  2985. StyleConfigNode.ChildNodes.FindNode('CtrlEnterSendMessage').Attributes['Value'] := FCtrlEnterSendMessage;
  2986. StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm').Attributes['Value'] := FCopyScreenHideTalkForm;
  2987. XMLDocument.SaveToFile();
  2988. finally
  2989. XMLDocument.Free;
  2990. end;
  2991. end;
  2992. //------------------------------------------------------------------------------
  2993. procedure TMainForm.LoadAutoUpdateConfigs;
  2994. var
  2995. XMLFile: string;
  2996. XMLDocument: TXMLDocument;
  2997. AutoUpdateConfigNode: IXMLNode;
  2998. begin
  2999. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + AutoUpdateConfigXMLFile;
  3000. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3001. XMLDocument := TXMLDocument.Create(Self);
  3002. try
  3003. XMLDocument.Active := True;
  3004. XMLDocument.LoadFromFile(XMLFile);
  3005. AutoUpdateConfigNode := XMLDocument.DocumentElement;
  3006. FAutoUpdate := AutoUpdateConfigNode.ChildNodes.FindNode('AutoUpdate').Attributes['Value'];
  3007. finally
  3008. XMLDocument.Free;
  3009. end;
  3010. end;
  3011. //------------------------------------------------------------------------------
  3012. procedure TMainForm.SaveAutoUpdateConfigs;
  3013. var
  3014. XMLFile: string;
  3015. XMLDocument: TXMLDocument;
  3016. AutoUpdateConfigNode: IXMLNode;
  3017. begin
  3018. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + AutoUpdateConfigXMLFile;
  3019. XMLDocument := TXMLDocument.Create(Self);
  3020. try
  3021. XMLDocument.Active := True;
  3022. XMLDocument.LoadFromFile(XMLFile);
  3023. AutoUpdateConfigNode := XMLDocument.DocumentElement;
  3024. AutoUpdateConfigNode.ChildNodes.FindNode('AutoUpdate').Attributes['Value'] := FAutoUpdate;
  3025. XMLDocument.SaveToFile();
  3026. finally
  3027. XMLDocument.Free;
  3028. end;
  3029. end;
  3030. //------------------------------------------------------------------------------
  3031. procedure TMainForm.LoadDefaultConfigs;
  3032. var
  3033. XMLFile: string;
  3034. XMLDocument: TXMLDocument;
  3035. DefaultConfigNode: IXMLNode;
  3036. OldSkinName: string;
  3037. BaseTop, BaseLeft: Integer;
  3038. begin
  3039. BaseTop := (Height - ClientHeight) div 2;
  3040. BaseLeft := (Width - ClientWidth) div 2;
  3041. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + DefaultConfigXMLFile;
  3042. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3043. XMLDocument := TXMLDocument.Create(Self);
  3044. try
  3045. XMLDocument.Active := True;
  3046. XMLDocument.LoadFromFile(XMLFile);
  3047. DefaultConfigNode := XMLDocument.DocumentElement;
  3048. FUIMainColor := DefaultConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'];
  3049. OldSkinName := SkinName;
  3050. try
  3051. SkinName := DefaultConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'];
  3052. except
  3053. SkinName := OldSkinName;
  3054. end;
  3055. FShowMainFormOnStart := True; //DefaultConfigNode.ChildNodes.FindNode('ShowMainFormOnStart').Attributes['Value'];
  3056. FMainFormLeft := DefaultConfigNode.ChildNodes.FindNode('MainFormLeft').Attributes['Value'];
  3057. FMainFormTop := DefaultConfigNode.ChildNodes.FindNode('MainFormTop').Attributes['Value'];
  3058. FMainFormWidth := DefaultConfigNode.ChildNodes.FindNode('MainFormWidth').Attributes['Value'];
  3059. FMainFormHeight := DefaultConfigNode.ChildNodes.FindNode('MainFormHeight').Attributes['Value'];
  3060. FTalkingFormLeft := DefaultConfigNode.ChildNodes.FindNode('TalkingFormLeft').Attributes['Value'];
  3061. FTalkingFormTop := DefaultConfigNode.ChildNodes.FindNode('TalkingFormTop').Attributes['Value'];
  3062. FTalkingFormWidth := DefaultConfigNode.ChildNodes.FindNode('TalkingFormWidth').Attributes['Value'];
  3063. FTalkingFormHeight := DefaultConfigNode.ChildNodes.FindNode('TalkingFormHeight').Attributes['Value'];
  3064. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft')) then
  3065. begin
  3066. DefaultConfigNode.AddChild('SMSFormLeft').Attributes['Value'] := -1;
  3067. XMLDocument.SaveToFile();
  3068. end;
  3069. FSMSFormLeft := DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft').Attributes['Value'];
  3070. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormTop')) then
  3071. begin
  3072. DefaultConfigNode.AddChild('SMSFormTop').Attributes['Value'] := -1;
  3073. XMLDocument.SaveToFile();
  3074. end;
  3075. FSMSFormTop := DefaultConfigNode.ChildNodes.FindNode('SMSFormTop').Attributes['Value'];
  3076. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth')) then
  3077. begin
  3078. DefaultConfigNode.AddChild('SMSFormWidth').Attributes['Value'] := -1;
  3079. XMLDocument.SaveToFile();
  3080. end;
  3081. FSMSFormWidth := DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth').Attributes['Value'];
  3082. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight')) then
  3083. begin
  3084. DefaultConfigNode.AddChild('SMSFormHeight').Attributes['Value'] := -1;
  3085. XMLDocument.SaveToFile();
  3086. end;
  3087. FSMSFormHeight := DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight').Attributes['Value'];
  3088. if FMainFormHeight <= 0 then
  3089. FMainFormHeight := Round(Screen.WorkAreaHeight * 0.8);
  3090. if FMainFormWidth <= 0 then
  3091. FMainFormWidth := 258;
  3092. if (FMainFormLeft + FMainFormWidth - BaseLeft < 2) then
  3093. FMainFormLeft := 0;
  3094. if (FMainFormLeft - BaseLeft > Screen.WorkAreaWidth - 2) then
  3095. FMainFormLeft := Screen.WorkAreaWidth - FMainFormWidth;
  3096. if (FMainFormTop + FMainFormHeight - BaseTop < 2) then
  3097. FMainFormTop := 0;
  3098. if (FMainFormTop > Screen.WorkAreaHeight) then
  3099. FMainFormTop := 0;
  3100. if FTalkingFormHeight <= 0 then
  3101. FTalkingFormHeight := Round(Screen.WorkAreaHeight * 0.6);
  3102. if FTalkingFormWidth <= 0 then
  3103. FTalkingFormWidth := Round(Screen.WorkAreaWidth * 0.6);
  3104. if (FTalkingFormLeft < 0) or (FTalkingFormLeft > Screen.WorkAreaWidth) then
  3105. FTalkingFormLeft := (Screen.WorkAreaWidth - FTalkingFormWidth) div 2;
  3106. if (FTalkingFormTop < 0) or (FTalkingFormTop > Screen.WorkAreaHeight) then
  3107. FTalkingFormTop := (Screen.WorkAreaHeight - FTalkingFormHeight) div 2;
  3108. if FSMSFormHeight <= 0 then
  3109. FSMSFormHeight := 410;
  3110. if FSMSFormWidth <= 0 then
  3111. FSMSFormWidth := 460;
  3112. if (FSMSFormLeft < 0) or (FSMSFormLeft > Screen.WorkAreaWidth) then
  3113. FSMSFormLeft := (Screen.WorkAreaWidth - FSMSFormWidth) div 2;
  3114. if (FSMSFormTop < 0) or (FSMSFormTop > Screen.WorkAreaHeight) then
  3115. FSMSFormTop := (Screen.WorkAreaHeight - FSMSFormHeight) div 2;
  3116. Left := FMainFormLeft;
  3117. Top := FMainFormTop;
  3118. Width := FMainFormWidth;
  3119. Height := FMainFormHeight;
  3120. FAlwaysOnTop := not DefaultConfigNode.ChildNodes.FindNode('AlwaysOnTop').Attributes['Value'];
  3121. actAlwaysOnTop.Enabled := True;
  3122. actAlwaysOnTop.Execute;
  3123. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm')) then
  3124. begin
  3125. DefaultConfigNode.AddChild('AutoHideMainForm').Attributes['Value'] := True;
  3126. XMLDocument.SaveToFile();
  3127. end;
  3128. FAutoHide := DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm').Attributes['Value'];
  3129. CheckWindowPositon;
  3130. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage')) then
  3131. begin
  3132. DefaultConfigNode.AddChild('AutoShowRequestMessage').Attributes['Value'] := False;
  3133. XMLDocument.SaveToFile();
  3134. end;
  3135. FAutoShowRequestMessage := DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage').Attributes['Value'];
  3136. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile')) then
  3137. begin
  3138. DefaultConfigNode.AddChild('ConfirmSendOfflineFile').Attributes['Value'] := True;
  3139. XMLDocument.SaveToFile();
  3140. end;
  3141. FConfirmSendOfflineFile := DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile').Attributes['Value'];
  3142. finally
  3143. XMLDocument.Free;
  3144. end;
  3145. end;
  3146. procedure TMainForm.CheckWindowPositon;
  3147. var
  3148. BaseTop, BaseLeft: Integer;
  3149. begin
  3150. BaseTop := (Height - ClientHeight) div 2;
  3151. BaseLeft := (Width - ClientWidth) div 2;
  3152. if (Left <= -BaseLeft) then
  3153. begin
  3154. FHidePosition := hpLeft;
  3155. Top := -BaseTop;
  3156. Left := -BaseLeft;
  3157. Height := Screen.WorkAreaHeight + BaseTop * 2;
  3158. end
  3159. else if ((Left + Width) >= (Screen.WorkAreaWidth + BaseLeft)) then
  3160. begin
  3161. FHidePosition := hpRight;
  3162. Top := -BaseTop;
  3163. Left := Screen.WorkAreaWidth - Width + BaseLeft;
  3164. Height := Screen.WorkAreaHeight + BaseTop * 2;
  3165. end
  3166. else if (Top <= -BaseTop) then
  3167. begin
  3168. FHidePosition := hpTop;
  3169. Top := -BaseTop;
  3170. end
  3171. else if (Top > -BaseTop) and (Left > -BaseLeft) and ((Left + Width) < (Screen.WorkAreaWidth + BaseLeft)) then
  3172. begin
  3173. FHidePosition := hpNone;
  3174. end;
  3175. if TimerForHideMainForm <> nil then
  3176. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  3177. end;
  3178. //------------------------------------------------------------------------------
  3179. procedure TMainForm.SaveDefaultConfigs;
  3180. var
  3181. XMLFile: string;
  3182. XMLDocument: TXMLDocument;
  3183. DefaultConfigNode: IXMLNode;
  3184. begin
  3185. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + DefaultConfigXMLFile;
  3186. XMLDocument := TXMLDocument.Create(Self);
  3187. try
  3188. XMLDocument.Active := True;
  3189. XMLDocument.LoadFromFile(XMLFile);
  3190. DefaultConfigNode := XMLDocument.DocumentElement;
  3191. DefaultConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'] := SkinName;
  3192. DefaultConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'] := FUIMainColor;
  3193. DefaultConfigNode.ChildNodes.FindNode('AlwaysOnTop').Attributes['Value'] := False;
  3194. DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm').Attributes['Value'] := FAutoHide;
  3195. DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage').Attributes['Value'] := FAutoShowRequestMessage;
  3196. DefaultConfigNode.ChildNodes.FindNode('ShowMainFormOnStart').Attributes['Value'] := True;
  3197. try
  3198. DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile').Attributes['Value'] := FConfirmSendOfflineFile;
  3199. except
  3200. end;
  3201. DefaultConfigNode.ChildNodes.FindNode('MainFormLeft').Attributes['Value'] := FMainFormLeft;
  3202. DefaultConfigNode.ChildNodes.FindNode('MainFormTop').Attributes['Value'] := FMainFormTop;
  3203. DefaultConfigNode.ChildNodes.FindNode('MainFormWidth').Attributes['Value'] := FMainFormWidth;
  3204. DefaultConfigNode.ChildNodes.FindNode('MainFormHeight').Attributes['Value'] := FMainFormHeight;
  3205. DefaultConfigNode.ChildNodes.FindNode('TalkingFormLeft').Attributes['Value'] := FTalkingFormLeft;
  3206. DefaultConfigNode.ChildNodes.FindNode('TalkingFormTop').Attributes['Value'] := FTalkingFormTop;
  3207. DefaultConfigNode.ChildNodes.FindNode('TalkingFormWidth').Attributes['Value'] := FTalkingFormWidth;
  3208. DefaultConfigNode.ChildNodes.FindNode('TalkingFormHeight').Attributes['Value'] := FTalkingFormHeight;
  3209. DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft').Attributes['Value'] := FSMSFormLeft;
  3210. DefaultConfigNode.ChildNodes.FindNode('SMSFormTop').Attributes['Value'] := FSMSFormTop;
  3211. DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth').Attributes['Value'] := FSMSFormWidth;
  3212. DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight').Attributes['Value'] := FSMSFormHeight;
  3213. XMLDocument.SaveToFile();
  3214. finally
  3215. XMLDocument.Free;
  3216. end;
  3217. end;
  3218. //------------------------------------------------------------------------------
  3219. procedure TMainForm.LoadGroupConfig;
  3220. var
  3221. XMLDocument: TXMLDocument;
  3222. ServerConfigNode: IXMLNode;
  3223. begin
  3224. XMLDocument := TXMLDocument.Create(Self);
  3225. try
  3226. XMLDocument.Active := True;
  3227. if csDesigning in ComponentState then
  3228. exit;
  3229. XMLDocument.LoadFromFile(ExtractFilePath(Application.ExeName) + ConfigXMLFilePath + 'GroupServerConfig.xml');
  3230. ServerConfigNode := XMLDocument.DocumentElement;
  3231. FGroupAddress := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['Address'];
  3232. FGroupPort := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['Port'];
  3233. FGroupImagePort := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['ImagePort'];
  3234. FGroupShareAddress := ServerConfigNode.ChildNodes.FindNode('GroupShareServer').Attributes['Address'];
  3235. FGroupSharePort := ServerConfigNode.ChildNodes.FindNode('GroupShareServer').Attributes['Port'];
  3236. except
  3237. on E: Exception do
  3238. begin
  3239. Error(E.Message, 'TMainForm.LoadGroupConfig');
  3240. XMLDocument.Free;
  3241. end;
  3242. end;
  3243. XMLDocument.Free;
  3244. end;
  3245. procedure TMainForm.LoadGroupConfigs;
  3246. var
  3247. XMLFile: string;
  3248. XMLDocument: TXMLDocument;
  3249. GroupConfigNode, GroupListNode, GroupNode: IXMLNode;
  3250. GroupMembers: TStringList;
  3251. iLoop, jLoop: Integer;
  3252. begin
  3253. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  3254. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3255. XMLDocument := TXMLDocument.Create(Self);
  3256. try
  3257. XMLDocument.Active := True;
  3258. if not FileExists(XMLFile) then
  3259. begin
  3260. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  3261. XMLDocument.Active := True;
  3262. end;
  3263. XMLDocument.LoadFromFile(XMLFile);
  3264. GroupConfigNode := XMLDocument.DocumentElement;
  3265. FShowGroup := GroupConfigNode.ChildNodes.FindNode('ShowGroup').Attributes['Value'];
  3266. actShowGroup.Checked := FShowGroup;
  3267. GroupListNode := GroupConfigNode.ChildNodes.FindNode('Groups');
  3268. FGroups.Clear;
  3269. for iLoop := 0 to GroupListNode.ChildNodes.Count - 1 do
  3270. begin
  3271. GroupNode := GroupListNode.ChildNodes[iLoop];
  3272. GroupMembers := TStringList.Create;
  3273. for jLoop := 0 to GroupNode.ChildNodes.Count - 1 do
  3274. begin
  3275. GroupMembers.Add(GroupNode.ChildNodes[jLoop].Text);
  3276. end;
  3277. FGroups.InsertObject(GroupNode.Attributes['Position'], GroupNode.Attributes['Name'], GroupMembers);
  3278. end;
  3279. except
  3280. on E: Exception do
  3281. begin
  3282. Error(E.Message, 'TMainForm.LoadGroupConfigs');
  3283. XMLDocument.Free;
  3284. end;
  3285. end;
  3286. XMLDocument.Free;
  3287. end;
  3288. //------------------------------------------------------------------------------
  3289. procedure TMainForm.miMoveToStrangersClick(Sender: TObject);
  3290. {var
  3291. GroupIndex, iLoop: Integer;
  3292. GroupName: String;
  3293. ListView: TRealICQContacterListView;
  3294. ListItem: TRealICQContacterListItem;
  3295. ItemIndex: Integer;
  3296. RealICQContacterTreeView: TRealICQContacterTreeView;
  3297. Employee: TRealICQEmployee; }
  3298. begin
  3299. { if MessageBox(Handle,
  3300. '确实要将选中的用户移至陌生人中吗?',
  3301. '确认',
  3302. MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then Exit;
  3303. GroupName :='陌生人';// navForContacters.Groups[navForContacters.ActiveGroupIndex];
  3304. if (GroupName = lvStrangers)then exit;
  3305. if GroupName = LVMyContacters then
  3306. begin
  3307. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3308. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3309. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  3310. RealICQClient.MoveToStrangers(Employee.LoginName);
  3311. Exit;
  3312. end;
  3313. GroupIndex := FContacterListViews.IndexOf(GroupName);
  3314. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  3315. ListView.DisableAlign;
  3316. try
  3317. for iLoop := ListView.Items.Count - 1 downto 0 do
  3318. begin
  3319. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  3320. if ListItem.Selected then
  3321. begin
  3322. RealICQClient.MoveToStrangers(ListItem.LoginName);
  3323. Sleep(15);
  3324. end;
  3325. end;
  3326. finally
  3327. ListView.EnableAlign;
  3328. end;
  3329. }
  3330. end;
  3331. procedure TMainForm.miMuteClick(Sender: TObject);
  3332. begin
  3333. FLoginState := stMute;
  3334. FLeaveMessage := '勿扰';
  3335. SetLoginStateControlState;
  3336. end;
  3337. //------------------------------------------------------------------------------
  3338. procedure TMainForm.miOnlineClick(Sender: TObject);
  3339. begin
  3340. FLoginState := stOnline;
  3341. FLeaveMessage := '';
  3342. SetLoginStateControlState;
  3343. end;
  3344. //------------------------------------------------------------------------------
  3345. procedure TMainForm.miOtherStateClick(Sender: TObject);
  3346. var
  3347. LeaveMessage: string;
  3348. begin
  3349. LeaveMessage := Trim(ShowMyInputBox('其它状态', '请输入离开状态说明文字', '', 16));
  3350. if Length(LeaveMessage) > 0 then
  3351. begin
  3352. FLoginState := stLeave;
  3353. FLeaveMessage := LeaveMessage;
  3354. SetLoginStateControlState;
  3355. end;
  3356. end;
  3357. //------------------------------------------------------------------------------
  3358. procedure TMainForm.miMoveToBlacklistsClick(Sender: TObject);
  3359. var
  3360. GroupName: string;
  3361. TreeView: TRealICQContacterTreeView;
  3362. ItemIndex: Integer;
  3363. Friend: TRealICQEmployee;
  3364. Black: TRealICQEmployee;
  3365. begin
  3366. if MessageBox(Handle, '确实要将选中的用户移至黑名单吗?', '确认', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  3367. Exit;
  3368. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  3369. TreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3370. Friend := TreeView.GetSelectedEmployee;
  3371. if Friend = nil then
  3372. Exit;
  3373. Black := TRealICQEmployee.Create(Friend.LoginName);
  3374. Black.BranchID := LvBlackLists;
  3375. Black.DisplayName := Friend.DisplayName;
  3376. GroupName := Friend.BranchID;
  3377. if (GroupName = lvBlacklists) then
  3378. exit;
  3379. if GroupName = LvFriends then
  3380. begin
  3381. RealICQClient.DelFriend(Friend.LoginName);
  3382. RealICQClient.MoveToBlacklists(Friend.LoginName);
  3383. TreeView.AddEmployee(Black);
  3384. end;
  3385. end;
  3386. procedure TMainForm.miSkinClick(Sender: TObject);
  3387. var
  3388. OldSkin: string;
  3389. begin
  3390. OldSkin := SkinName;
  3391. try
  3392. SkinName := (Sender as TMenuItem).Caption;
  3393. ChangeAddFriendFormSkin(SkinName);
  3394. ChangeAddFriendRequestFormSkin(SkinName);
  3395. ChangeTalkingFormSkin(SkinName);
  3396. ChangeSMSFormSkin(SkinName);
  3397. ChangeSystemMessageFormsSkin(SkinName);
  3398. // ChangeSeeUserInformationFormsSkin(SkinName);
  3399. ChangeTeamOptionsFormSkin(SkinName);
  3400. if VideoForm <> nil then
  3401. begin
  3402. VideoForm.SkinName := SkinName;
  3403. VideoForm.ChangeUIColor(VideoForm.TalkingForm.WindowColor);
  3404. end;
  3405. if CreateTeamForm <> nil then
  3406. begin
  3407. CreateTeamForm.SkinName := SkinName;
  3408. CreateTeamForm.ChangeUIColor(UIMainColor);
  3409. end;
  3410. if SearchForm <> nil then
  3411. begin
  3412. SearchForm.SkinName := SkinName;
  3413. SearchForm.ChangeUIColor(UIMainColor);
  3414. end;
  3415. if SearchTeamForm <> nil then
  3416. begin
  3417. SearchTeamForm.SkinName := SkinName;
  3418. SearchTeamForm.ChangeUIColor(UIMainColor);
  3419. end;
  3420. if CustomFacesManagerForm <> nil then
  3421. begin
  3422. CustomFacesManagerForm.SkinName := SkinName;
  3423. CustomFacesManagerForm.ChangeUIColor(UIMainColor);
  3424. end;
  3425. except
  3426. MessageBox(Handle, '加载界面时出错!', '错误', MB_ICONERROR);
  3427. SkinName := OldSkin;
  3428. end;
  3429. ChangeUIColor(UIMainColor);
  3430. PostMessage(Handle, WM_SIZE, 0, 0);
  3431. if RealICQClient.Logined and RealICQClient.Connected then
  3432. SaveStyleConfigs;
  3433. SaveDefaultConfigs;
  3434. end;
  3435. //----------------------------------------------------
  3436. procedure TMainForm.ImageButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  3437. begin
  3438. FHintWindow.ReleaseHandle;
  3439. FHintWindow.Visible := False;
  3440. SetToolBarState(Sender);
  3441. end;
  3442. procedure TMainForm.tsContactersResize(Sender: TObject);
  3443. begin
  3444. { TODO -olqq -c : 注释 2015/1/22 15:30:11 }
  3445. // ScrollBoxContacters.Width := pnlGroups.Width;
  3446. // PnlMoreUser.Width := pnlGroups.Width;
  3447. // ScrollBoxMyFriend.Width := pnlGroups.Width;
  3448. // ScrollBoxTeam.Width := pnlGroups.Width;
  3449. // ScrollBoxLatests.Width := pnlGroups.Width;
  3450. //
  3451. // ScrollBoxContacters.Height := pnlGroups.Height;
  3452. // PnlMoreUser.Height := pnlGroups.Height;
  3453. // ScrollBoxMyFriend.Height := pnlGroups.Height;
  3454. // ScrollBoxTeam.Height := pnlGroups.Height;
  3455. // ScrollBoxLatests.Height := pnlGroups.Height;
  3456. {ScrollBoxContacters.Left := 0;
  3457. PnlMoreUser.Left := ScrollBoxContacters.Left + ScrollBoxContacters.Width;
  3458. ScrollBoxMyFriend.Left := PnlMoreUser.Left + PnlMoreUser.Width;
  3459. ScrollBoxTeam.Left := ScrollBoxMyFriend.Left + ScrollBoxMyFriend.Width;
  3460. ScrollBoxLatests.Left := ScrollBoxTeam.Left + ScrollBoxTeam.Width;}
  3461. end;
  3462. procedure TMainForm.tsContactersShow(Sender: TObject);
  3463. begin
  3464. {ScrollBoxContacters.Visible := True;
  3465. PnlMoreUser.Visible := True;
  3466. ScrollBoxMyFriend.Visible := True;
  3467. ScrollBoxTeam.Visible := True;
  3468. ScrollBoxLatests.Visible := True;}
  3469. { TODO -olqq -c : 注释 2015/1/22 15:33:36 }
  3470. // ScrollBoxContacters.Align := alNone;
  3471. // PnlMoreUser.Align := alNone;
  3472. // ScrollBoxMyFriend.Align := alNone;
  3473. // ScrollBoxTeam.Align := alNone;
  3474. // ScrollBoxLatests.Align := alNone;
  3475. //
  3476. // ScrollBoxContacters.Top := 0;
  3477. // PnlMoreUser.Top := 0;
  3478. // ScrollBoxMyFriend.Top := 0;
  3479. // ScrollBoxTeam.Top := 0;
  3480. // ScrollBoxLatests.Top := 0;
  3481. tsContactersResize(tsContacters);
  3482. end;
  3483. //-----------------------------------------------------
  3484. procedure TMainForm.SetToolBarState(Sender: TObject);
  3485. var
  3486. ImageButton: TRealICQHoverImage;
  3487. TmpImageButton: TRealICQHoverImage;
  3488. TmpImageButtonIcon: TRealICQHoverImage;
  3489. iLoop: Integer;
  3490. OldControl, NewControl: TWinControl;
  3491. ItemIndex, divSize: Integer;
  3492. RealICQContacterTreeView: TRealICQContacterTreeView;
  3493. begin
  3494. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3495. OldControl := nil;
  3496. if ScrollBoxContacters.Visible then
  3497. OldControl := ScrollBoxContacters;
  3498. if PnlMoreUser.Visible then
  3499. OldControl := PnlMoreUser;
  3500. if ScrollBoxMyFriend.Visible then
  3501. OldControl := ScrollBoxMyFriend;
  3502. if ScrollBoxTeam.Visible then
  3503. OldControl := ScrollBoxTeam;
  3504. if ScrollBoxLatests.Visible then
  3505. OldControl := ScrollBoxLatests;
  3506. {if ImageButton.Tag = 2 then
  3507. begin
  3508. if ScrollBoxMoreUser.Tag = 0 then
  3509. begin
  3510. ScrollBoxMoreUser.Tag := 1;
  3511. end;
  3512. end; }
  3513. NewControl := nil;
  3514. if ImageButton.Tag = 1 then
  3515. NewControl := ScrollBoxContacters;
  3516. if ImageButton.Tag = 2 then
  3517. NewControl := PnlMoreUser;
  3518. if ImageButton.Tag = 3 then
  3519. NewControl := ScrollBoxMyFriend;
  3520. if ImageButton.Tag = 4 then
  3521. NewControl := ScrollBoxTeam;
  3522. if ImageButton.Tag = 5 then
  3523. NewControl := ScrollBoxLatests;
  3524. if False and (OldControl <> nil) then
  3525. begin
  3526. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3527. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3528. RealICQContacterTreeView.HideScroll;
  3529. RealICQContacterTreeView.ReDrawAll;
  3530. RealICQContacterTreeView.BeginUpdate;
  3531. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  3532. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3533. RealICQContacterTreeView.HideScroll;
  3534. RealICQContacterTreeView.ReDrawAll;
  3535. RealICQContacterTreeView.BeginUpdate;
  3536. Application.ProcessMessages;
  3537. //Exit;
  3538. NewControl.DisableAlign;
  3539. NewControl.Enabled := False;
  3540. OldControl.DisableAlign;
  3541. OldControl.Enabled := False;
  3542. divSize := pnlGroups.Width div 10;
  3543. try
  3544. if OldControl.Tag < NewControl.Tag then
  3545. begin
  3546. NewControl.Left := OldControl.Left + OldControl.Width;
  3547. NewControl.Visible := True;
  3548. while NewControl.Left > 0 do
  3549. begin
  3550. if NewControl.Left - divSize < 0 then
  3551. begin
  3552. NewControl.Left := 0;
  3553. end
  3554. else
  3555. begin
  3556. OldControl.Left := OldControl.Left - divSize;
  3557. NewControl.Left := NewControl.Left - divSize;
  3558. end;
  3559. Application.ProcessMessages;
  3560. Sleep(10);
  3561. end;
  3562. OldControl.Visible := False;
  3563. end
  3564. else
  3565. begin
  3566. NewControl.Left := OldControl.Left - OldControl.Width;
  3567. NewControl.Visible := True;
  3568. while NewControl.Left < 0 do
  3569. begin
  3570. if NewControl.Left + divSize > 0 then
  3571. begin
  3572. NewControl.Left := 0;
  3573. end
  3574. else
  3575. begin
  3576. OldControl.Left := OldControl.Left + divSize;
  3577. NewControl.Left := NewControl.Left + divSize;
  3578. end;
  3579. Application.ProcessMessages;
  3580. Sleep(10);
  3581. end;
  3582. OldControl.Visible := False;
  3583. end;
  3584. finally
  3585. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3586. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3587. RealICQContacterTreeView.EndUpdate;
  3588. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  3589. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3590. RealICQContacterTreeView.EndUpdate;
  3591. NewControl.EnableAlign;
  3592. NewControl.Enabled := True;
  3593. OldControl.EnableAlign;
  3594. OldControl.Enabled := True;
  3595. end;
  3596. end
  3597. else
  3598. begin
  3599. if OldControl <> nil then
  3600. OldControl.Visible := False;
  3601. NewControl.Left := 0;
  3602. NewControl.Visible := True;
  3603. end;
  3604. pnlTeams.Visible := ImageButton.Tag = 4;
  3605. if pnlTeams.Visible then
  3606. pnlTeams.Height := 22
  3607. else
  3608. pnlTeams.Height := 0;
  3609. {ScrollBoxContacters.Visible := ImageButton.Tag = 1;
  3610. PnlMoreUser.Visible := ImageButton.Tag = 2;
  3611. ScrollBoxMyFriend.Visible := ImageButton.Tag = 3;
  3612. ScrollBoxTeam.Visible := ImageButton.Tag = 4;
  3613. pnlTeams.Visible := ImageButton.Tag = 4;
  3614. if pnlTeams.Visible then
  3615. pnlTeams.Height := 22
  3616. else
  3617. pnlTeams.Height := 0;
  3618. ScrollBoxLatests.Visible := ImageButton.Tag = 5; }
  3619. ActiveButtonTag := ImageButton.Tag;
  3620. for iLoop := 0 to FToolBarButtonList.Count - 1 do
  3621. begin
  3622. TmpImageButton := FToolBarButtonList.Objects[iLoop] as TRealICQHoverImage;
  3623. TmpImageButtonIcon := FToolBarButtonIconList.Objects[iLoop] as TRealICQHoverImage;
  3624. if TmpImageButton.Tag = ImageButton.Tag then
  3625. begin
  3626. TmpImageButton.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\menu\01_On.bmp');
  3627. TmpImageButton.OnMouseUp := nil;
  3628. TmpImageButton.OnMouseEnter := nil;
  3629. TmpImageButton.OnMouseLeave := nil;
  3630. TmpImageButtonIcon.OnMouseUp := nil;
  3631. TmpImageButtonIcon.OnMouseEnter := nil;
  3632. TmpImageButtonIcon.OnMouseLeave := nil;
  3633. end
  3634. else
  3635. begin
  3636. TmpImageButton.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\menu\01_Off.bmp');
  3637. TmpImageButton.OnMouseUp := ImageButtonMouseUp;
  3638. TmpImageButton.OnMouseEnter := ImageButtonEnter;
  3639. TmpImageButton.OnMouseLeave := ImageButtonLeave;
  3640. TmpImageButtonIcon.OnMouseUp := ImageButtonMouseUp;
  3641. TmpImageButtonIcon.OnMouseEnter := ImageButtonEnter;
  3642. TmpImageButtonIcon.OnMouseLeave := ImageButtonLeave;
  3643. end;
  3644. ConvertBitmapToColor(TmpImageButton.Picture.Bitmap, UIMainColor);
  3645. end;
  3646. end;
  3647. //----------------------------
  3648. procedure TMainForm.ImageButtonEnter(Sender: TObject);
  3649. var
  3650. ImageButton: TRealICQHoverImage;
  3651. ImagePath: string;
  3652. procedure OpenHint(HintStr: string);
  3653. var
  3654. TextWidth, TextHeight: Integer;
  3655. rect: TRect;
  3656. begin
  3657. TextWidth := FHintWindow.Canvas.TextWidth(HintStr);
  3658. TextHeight := FHintWindow.Canvas.TextHeight(HintStr);
  3659. rect.Left := Mouse.CursorPos.X;
  3660. rect.Top := Mouse.CursorPos.Y + 20;
  3661. rect.Right := rect.Left + TextWidth + 5;
  3662. rect.Bottom := rect.Top + TextHeight;
  3663. FHintWindow.Color := clInfoBk;
  3664. FHintWindow.ActivateHint(Rect, HintStr);
  3665. FHintWindow.Visible := True;
  3666. end;
  3667. begin
  3668. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3669. ImagePath := ExtractFilePath(Application.ExeName) + 'Images\menu\01_Over.bmp';
  3670. ImageButton.Picture.LoadFromFile(ImagePath);
  3671. ConvertBitmapToColor(ImageButton.Picture.Bitmap, UIMainColor);
  3672. OpenHint(FToolBarButtonList[ImageButton.Tag - 1]);
  3673. end;
  3674. //-----------------------------
  3675. procedure TMainForm.ImageButtonLeave(Sender: TObject);
  3676. var
  3677. ImageButton: TRealICQHoverImage;
  3678. ImagePath: string;
  3679. begin
  3680. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3681. ImagePath := ExtractFilePath(Application.ExeName) + 'Images\menu\01_Off.bmp';
  3682. ImageButton.Picture.LoadFromFile(ImagePath);
  3683. ConvertBitmapToColor(ImageButton.Picture.Bitmap, UIMainColor);
  3684. FHintWindow.ReleaseHandle;
  3685. FHintWindow.Visible := False;
  3686. end;
  3687. procedure TMainForm.miChangeLoginNameClick(Sender: TObject);
  3688. var
  3689. LoginUser: TLoginUser;
  3690. begin
  3691. try
  3692. LoginUser := RealICQClient.LoginedUsers.Objects[(Sender as TMenuItem).Tag] as TLoginUser;
  3693. edPassword.Text := '';
  3694. edLoginName.Text := LoginUser.LoginName;
  3695. if (LoginUser.Password <> '') and (LoginUser.LoginName <> '') then
  3696. begin
  3697. edPassword.Text := RealICQClient.DecyptPassword(LoginUser.Password);
  3698. FSavePassword := True;
  3699. self.ImgLstCheckStates.GetIcon(1, spbSavePassword.Icon);
  3700. end;
  3701. self.lblRemoveMyLoginInfo.Visible := True;
  3702. except
  3703. edLoginName.Text := '';
  3704. end;
  3705. end;
  3706. //------------------------------------------------------------------------------
  3707. procedure TMainForm.miClearLoginHistoryClick(Sender: TObject);
  3708. var
  3709. ClearAll: Boolean;
  3710. begin
  3711. ClearAll := True;
  3712. if UpperCase(Sender.ClassName) = UpperCase('TLabel') then
  3713. ClearAll := False;
  3714. MainForm.RealICQClient.ClearLoginHistory(ClearAll, edLoginName.Text);
  3715. edLoginName.Text := '';
  3716. edPassword.Text := '';
  3717. actLoginAs.Visible := False;
  3718. SetLoginControlsVisible(True);
  3719. end;
  3720. //------------------------------------------------------------------------------
  3721. procedure TMainForm.miColorClick(Sender: TObject);
  3722. begin
  3723. FUIMainColor := (Sender as TMenuItem).Tag;
  3724. ChangeUIColor((Sender as TMenuItem).Tag);
  3725. if RealICQClient.Logined and RealICQClient.Connected then
  3726. SaveStyleConfigs;
  3727. SaveDefaultConfigs;
  3728. end;
  3729. //------------------------------------------------------------------------------
  3730. procedure TMainForm.miHiddenClick(Sender: TObject);
  3731. begin
  3732. FLoginState := stHidden;
  3733. FLeaveMessage := '';
  3734. SetLoginStateControlState;
  3735. end;
  3736. //------------------------------------------------------------------------------
  3737. procedure TMainForm.miMeetingClick(Sender: TObject);
  3738. begin
  3739. FLoginState := stLeave;
  3740. FLeaveMessage := (Sender as TMenuItem).Caption;
  3741. SetLoginStateControlState;
  3742. end;
  3743. //------------------------------------------------------------------------------
  3744. procedure TMainForm.miMoreColorsClick(Sender: TObject);
  3745. begin
  3746. ColorDialog.Color := FUIMainColor;
  3747. if ColorDialog.Execute then
  3748. begin
  3749. ChangeUIColor(ColorDialog.Color);
  3750. FUIMainColor := ColorDialog.Color;
  3751. if RealICQClient.Logined and RealICQClient.Connected then
  3752. SaveStyleConfigs;
  3753. SaveDefaultConfigs;
  3754. end;
  3755. end;
  3756. //------------------------------------------------------------------------------
  3757. procedure TMainForm.miMoveGroupClick(Sender: TObject);
  3758. var
  3759. GroupName, TargetGroupName: string;
  3760. MenuItem: TMenuItem;
  3761. GroupIndex, itemIndex: Integer;
  3762. TreeView: TRealICQContacterTreeView;
  3763. Friend: TRealICQEmployee;
  3764. GroupMembers, TargetGroupMembers: TStringList;
  3765. RealICQUser: TRealICQUser;
  3766. OldScrollBarTop: Integer;
  3767. begin
  3768. MenuItem := Sender as TMenuItem;
  3769. if MenuItem <> nil then
  3770. TargetGroupName := MenuItem.Caption
  3771. else
  3772. TargetGroupName := LVFriends;
  3773. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  3774. TreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3775. Friend := TreeView.GetSelectedEmployee;
  3776. if Friend = nil then
  3777. Exit;
  3778. GroupName := Friend.BranchID;
  3779. OldScrollBarTop := TreeView.ScrollBarTop;
  3780. SetFlashCaptionOnOnlineValue(False);
  3781. LockWindowUpdate(GetDesktopWindow);
  3782. try
  3783. if FGroups.IndexOf(GroupName) >= 0 then
  3784. begin
  3785. GroupIndex := FGroups.IndexOf(GroupName);
  3786. GroupMembers := FGroups.Objects[GroupIndex] as TStringList;
  3787. GroupMembers.Delete(GroupMembers.IndexOf(Friend.LoginName));
  3788. end;
  3789. RealICQUser := Friend.Data;
  3790. TreeView.EmployeeItems.Delete(TreeView.EmployeeItems.IndexOf(Friend.LoginName));
  3791. //在树节点之间移动()
  3792. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  3793. Friend.BranchID := TargetGroupName;
  3794. TreeView.AddEmployee(Friend);
  3795. UpdateFriendNode(Friend, RealICQUser, True);
  3796. if FGroups.IndexOf(TargetGroupName) >= 0 then
  3797. begin
  3798. GroupIndex := FGroups.IndexOf(TargetGroupName);
  3799. TargetGroupMembers := FGroups.Objects[GroupIndex] as TStringList;
  3800. TargetGroupMembers.Add(Friend.LoginName);
  3801. end;
  3802. finally
  3803. TreeView.ScrollBarTop := OldScrollBarTop;
  3804. LockWindowUpdate(0);
  3805. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  3806. SaveGroupConfigs;
  3807. end;
  3808. end;
  3809. //------------------------------------------------------------------------------
  3810. procedure TMainForm.NodeDoubleClick(Employee: TRealICQEmployee);
  3811. var
  3812. SMSForm: TSMSForm;
  3813. begin
  3814. if (pgcMainWorkArea.ActivePage = tsAddrBook) then
  3815. begin
  3816. SMSForm := OpenSMSForm('', True);
  3817. SMSForm.edMobiles.Text := Employee.Mobile;
  3818. Exit;
  3819. end;
  3820. if Employee.Data <> nil then
  3821. begin
  3822. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3823. begin
  3824. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3825. Exit;
  3826. end;
  3827. {if GetActiveTabSheetName=MoreUser then
  3828. begin
  3829. RealICQClient.GetUserInformation(Employee.LoginName,True);
  3830. end; }
  3831. OpenTalkingForm(Employee.LoginName);
  3832. end;
  3833. end;
  3834. //------------------------------------------------------------------------------
  3835. procedure TMainForm.NodeIconButtonClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  3836. var
  3837. RealICQUser: TRealICQUser;
  3838. begin
  3839. if IconButtonType = itHeadImage then
  3840. begin
  3841. HideUserCardForm;
  3842. end;
  3843. if IconButtonType = itSNS then
  3844. begin
  3845. RealICQUser := Employee.Data;
  3846. RealICQUser.ClickedSNSIcon;
  3847. try
  3848. RealICQClientUserInformationReady(RealICQClient, RealICQUser);
  3849. //UpdateEmployeeNode(Employee, RealICQUser, True);
  3850. finally
  3851. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + SNSHomePage, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(RealICQUser.LoginName)])), '', SW_SHOWDEFAULT);
  3852. end;
  3853. end;
  3854. end;
  3855. //------------------------------------------------------------------------------
  3856. procedure TMainForm.NodeIconButtonDblClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  3857. var
  3858. TalkingForm: TTalkingForm;
  3859. iWaitTimes: Integer;
  3860. RealICQUser: TRealICQUser;
  3861. SMSForm: TSMSForm;
  3862. begin
  3863. HideUserCardForm;
  3864. if (pgcMainWorkArea.ActivePage = tsAddrBook) then
  3865. begin
  3866. SMSForm := OpenSMSForm('', True);
  3867. SMSForm.edMobiles.Text := Employee.Mobile;
  3868. Exit;
  3869. end;
  3870. if IconButtonType = itCamera then
  3871. begin
  3872. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3873. begin
  3874. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3875. Exit;
  3876. end;
  3877. TalkingForm := GetTalkingForm(Employee.LoginName);
  3878. if TalkingForm = nil then
  3879. begin
  3880. TalkingForm := OpenTalkingForm(Employee.LoginName, True);
  3881. end;
  3882. iWaitTimes := 0;
  3883. while not TalkingForm.CanWriteMessage do
  3884. begin
  3885. Application.ProcessMessages;
  3886. Inc(iWaitTimes);
  3887. if iWaitTimes > 1000 then
  3888. break;
  3889. Sleep(10);
  3890. end;
  3891. TalkingForm.actVideo.Execute;
  3892. end;
  3893. if IconButtonType = itHeadImage then
  3894. begin
  3895. if pgcMainWorkArea.ActivePage = tsAddrBook then
  3896. Exit;
  3897. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3898. begin
  3899. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3900. Exit;
  3901. end;
  3902. OpenTalkingForm(Employee.LoginName, True);
  3903. end;
  3904. if IconButtonType = itSMS then
  3905. begin
  3906. OpenSMSForm(Employee.LoginName, True);
  3907. end;
  3908. if IconButtonType = itEmail then
  3909. begin
  3910. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(Employee.LoginName);
  3911. if (RealICQUser <> nil) and (RealICQUser.Email <> '') then
  3912. ShellExecute(handle, 'open', PChar('mailto:' + RealICQUser.Email), nil, nil, SW_SHOWNORMAL);
  3913. //AddWebBrowserToPageControl(Format('http://mail.lishui.gov.cn/web_email/module.phtml?module=mcomposef&to=%s', [RealICQUser.Email]), 999);
  3914. //AddWebBrowserToPageControl(Format('http://www.lxtalk.com/rd/', [RealICQUser.Email]), 999);
  3915. end;
  3916. if IconButtonType = itAddFriend then
  3917. begin
  3918. if AnsiSameText(MainForm.RealICQClient.LoginName, Employee.LoginName) then
  3919. begin
  3920. MessageBox(Handle, '不能添加自己为好友', '提示', MB_ICONINFORMATION);
  3921. Exit;
  3922. end;
  3923. ShowAddFriendWindow(Self, Employee.LoginName, Employee.DisplayName);
  3924. end;
  3925. if IconButtonType = itTel then
  3926. begin
  3927. { if not FPCAMessage.GetPCALoginStatus then Exit;
  3928. if (Employee.Mobile<>'') and (Employee.Tel<>'') then
  3929. begin
  3930. MenuItem:=ppSelCallTel.Items[0];
  3931. MenuItem.Hint:=Employee.Mobile+char(10)+Employee.DisplayName;
  3932. MenuItem:=ppSelCallTel.Items[1];
  3933. MenuItem.Hint:=Employee.Tel+char(10)+Employee.DisplayName;
  3934. ppSelCallTel.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y - 50);
  3935. Exit;
  3936. end;
  3937. if Employee.Mobile<>'' then CallNumber:=Employee.Mobile;
  3938. if Employee.Tel<>'' then CallNumber:=Employee.Tel;
  3939. FPCAMessage.SendCallTelOutPCAMessage(CallNumber,Employee.DisplayName);
  3940. }
  3941. end;
  3942. end;
  3943. //------------------------------------------------------------------------------
  3944. procedure TMainForm.miGoSpaceClick(Sender: TObject);
  3945. var
  3946. LoginName: string;
  3947. RealICQUser: TRealICQUser;
  3948. begin
  3949. LoginName := GetSelectedLoginName;
  3950. if LoginName <> '' then
  3951. begin
  3952. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  3953. RealICQUser.ClickedSNSIcon;
  3954. try
  3955. RealICQClientUserInformationReady(RealICQClient, RealICQUser);
  3956. finally
  3957. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + SNSHomePage, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(RealICQUser.LoginName)])), '', SW_SHOWDEFAULT);
  3958. end;
  3959. end;
  3960. end;
  3961. //------------------------------------------------------------------------------
  3962. procedure TMainForm.NodeOnline(Employee: TRealICQEmployee);
  3963. var
  3964. ARealICQUser: TRealICQUser;
  3965. begin
  3966. //MessageBox(Handle, '4', '4', MB_OK);
  3967. if RealICQClient.Me = nil then
  3968. Exit;
  3969. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  3970. Exit;
  3971. //MessageBox(Handle, '5', '5', MB_OK);
  3972. if Employee.Data <> nil then
  3973. begin
  3974. ARealICQUser := TRealICQUser(Employee.Data);
  3975. if ARealICQUser = RealICQClient.Me then
  3976. Exit;
  3977. if PlaySoundOnOnline then
  3978. PlayEventSound(OnlineEventSound);
  3979. if ShowHintOnOnline then
  3980. ShowOnOffAlertForm(ARealICQUser);
  3981. end;
  3982. //MessageBox(Handle, '6', '6', MB_OK);
  3983. end;
  3984. //------------------------------------------------------------------------------
  3985. procedure TMainForm.NodeOffline(Employee: TRealICQEmployee);
  3986. var
  3987. ARealICQUser: TRealICQUser;
  3988. begin
  3989. if RealICQClient.Me = nil then
  3990. Exit;
  3991. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  3992. Exit;
  3993. if Employee.Data <> nil then
  3994. begin
  3995. ARealICQUser := TRealICQUser(Employee.Data);
  3996. if ARealICQUser = RealICQClient.Me then
  3997. Exit;
  3998. if PlaySoundOnOffline then
  3999. PlayEventSound(OfflineEventSound);
  4000. if ShowHintOnOffline then
  4001. ShowOnOffAlertForm(ARealICQUser);
  4002. end;
  4003. end;
  4004. //------------------------------------------------------------------------------
  4005. procedure TMainForm.TimerForHideUserCardTimer(Sender: TObject);
  4006. var
  4007. Rect: TRect;
  4008. begin
  4009. TimerForHideUserCard.Enabled := False;
  4010. if Assigned(UserCardViewForm) then
  4011. begin
  4012. Rect.Left := UserCardViewForm.Left;
  4013. Rect.Top := UserCardViewForm.Top;
  4014. Rect.Right := UserCardViewForm.Left + UserCardViewForm.Width;
  4015. Rect.Bottom := UserCardViewForm.Top + UserCardViewForm.Height;
  4016. if PtInRect(Rect, Mouse.CursorPos) then
  4017. begin
  4018. UserCardViewForm.tmrForClose.Enabled := True;
  4019. Exit;
  4020. end;
  4021. end;
  4022. if not TimerForShowUserCard.Enabled then
  4023. FreeAndNil(UserCardViewForm);
  4024. // TimerForHideUserCard.Enabled := False;
  4025. //
  4026. // if Assigned(UserCardForm) then
  4027. // begin
  4028. // Rect.Left := UserCardForm.Left;
  4029. // Rect.Top := UserCardForm.Top;
  4030. // Rect.Right := UserCardForm.Left + UserCardForm.Width;
  4031. // Rect.Bottom := UserCardForm.Top + UserCardForm.Height;
  4032. // if PtInRect(Rect, Mouse.CursorPos) then
  4033. // begin
  4034. // UserCardForm.TimerForClose.Enabled := True;
  4035. // Exit;
  4036. // end;
  4037. // end;
  4038. // if not TimerForShowUserCard.Enabled then FreeAndNil(UserCardForm);
  4039. end;
  4040. //------------------------------------------------------------------------------
  4041. procedure TMainForm.NodeOnHeadImageMouseEnter(Employee: TRealICQEmployee);
  4042. var
  4043. Rect: TRect;
  4044. P: TPoint;
  4045. begin
  4046. Rect := Employee.Node.DisplayRect(False);
  4047. P.X := Rect.Left;
  4048. P.Y := Rect.Top;
  4049. P := Employee.Node.TreeView.ClientToScreen(P);
  4050. if UserCardForm <> nil then
  4051. begin
  4052. FNeedShowUserCardLoginName := Employee.LoginName;
  4053. FShowUserCardTargetTop := P.Y;
  4054. TimerForShowUserCardTimer(nil);
  4055. end
  4056. else
  4057. begin
  4058. ShowUserCardForm(Employee.LoginName, P.Y);
  4059. end;
  4060. end;
  4061. procedure TMainForm.NodeOnHeadImageMouseLeave(Employee: TRealICQEmployee);
  4062. begin
  4063. HideUserCardForm;
  4064. end;
  4065. procedure TMainForm.ItemOnHeadImageEnter(Item: TRealICQContacterListItem);
  4066. var
  4067. Rect: TRect;
  4068. P: TPoint;
  4069. begin
  4070. Rect := Item.ListView.ListBox.ItemRect(Item.ItemIndex);
  4071. P.X := Rect.Left;
  4072. P.Y := Rect.Top;
  4073. P := Item.ListView.ListBox.ClientToScreen(P);
  4074. if UserCardForm <> nil then
  4075. begin
  4076. FNeedShowUserCardLoginName := Item.LoginName;
  4077. FShowUserCardTargetTop := P.Y;
  4078. TimerForShowUserCardTimer(nil);
  4079. end
  4080. else
  4081. begin
  4082. ShowUserCardForm(Item.LoginName, P.Y);
  4083. end;
  4084. end;
  4085. procedure TMainForm.ItemOnHeadImageLeave(Item: TRealICQContacterListItem);
  4086. begin
  4087. HideUserCardForm;
  4088. end;
  4089. procedure TMainForm.imgHeadImageBorderMouseEnter(Sender: TObject);
  4090. var
  4091. P: TPoint;
  4092. begin
  4093. P.X := 0;
  4094. P.Y := 0;
  4095. P := imgHeadImageBorder.ClientToScreen(P);
  4096. if UserCardForm <> nil then
  4097. begin
  4098. FNeedShowUserCardLoginName := RealICQClient.LoginName;
  4099. FShowUserCardTargetTop := P.Y;
  4100. TimerForShowUserCardTimer(nil);
  4101. end
  4102. else
  4103. begin
  4104. ShowUserCardForm(RealICQClient.LoginName, P.Y);
  4105. end;
  4106. end;
  4107. procedure TMainForm.imgHeadImageBorderMouseLeave(Sender: TObject);
  4108. begin
  4109. HideUserCardForm;
  4110. end;
  4111. procedure TMainForm.ShowUserCardForm(ALoginName: string; ATargetTop: Integer);
  4112. begin
  4113. //FreeAndNil(UserCardForm);
  4114. FNeedShowUserCardLoginName := ALoginName;
  4115. FShowUserCardTargetTop := ATargetTop;
  4116. TimerForShowUserCard.Enabled := False;
  4117. TimerForShowUserCard.Enabled := True;
  4118. TimerForHideUserCard.Enabled := False;
  4119. end;
  4120. procedure TMainForm.HideUserCardForm;
  4121. begin
  4122. if TimerForHideUserCard <> nil then
  4123. begin
  4124. TimerForHideUserCard.Enabled := False;
  4125. TimerForHideUserCard.Enabled := True;
  4126. TimerForShowUserCard.Enabled := False;
  4127. end;
  4128. end;
  4129. //------------------------------------------------------------------------------
  4130. procedure TMainForm.NodeOnMouseEnter(Employee: TRealICQEmployee);
  4131. begin
  4132. end;
  4133. //------------------------------------------------------------------------------
  4134. procedure TMainForm.NodeOnMouseLeave(Employee: TRealICQEmployee);
  4135. begin
  4136. end;
  4137. //------------------------------------------------------------------------------
  4138. procedure TMainForm.ItemOnMouseEnter(Item: TRealICQContacterListItem);
  4139. begin
  4140. //
  4141. end;
  4142. //------------------------------------------------------------------------------
  4143. procedure TMainForm.ItemOnMouseLeave(Item: TRealICQContacterListItem);
  4144. begin
  4145. end;
  4146. //------------------------------------------------------------------------------
  4147. procedure TMainForm.ItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  4148. begin
  4149. if IconButtonType = ltHeadImage then
  4150. begin
  4151. if UserCardForm = nil then
  4152. UserCardForm := TUserCardForm.Create(Self);
  4153. if UserCardForm.Width - 10 >= Left then
  4154. UserCardForm.Left := Left + pnlWorkArea.Width + 20
  4155. else
  4156. UserCardForm.Left := Left - UserCardForm.Width + 10;
  4157. UserCardForm.Top := Mouse.CursorPos.Y - 50;
  4158. UserCardForm.LoginName := Item.LoginName;
  4159. Application.ProcessMessages;
  4160. UserCardForm.Show;
  4161. end;
  4162. end;
  4163. //------------------------------------------------------------------------------
  4164. procedure TMainForm.ItemIconButtonDblClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  4165. var
  4166. TalkingForm: TTalkingForm;
  4167. iWaitTimes: Integer;
  4168. RealICQUser: TRealICQUser;
  4169. // CallNumber:String;
  4170. // MenuItem:TMenuItem;
  4171. begin
  4172. if FSearchListViewInVisible then //设置查找输入框为初始状态
  4173. begin
  4174. edFilterKeyword.Text := '查找联系人...';
  4175. edFilterKeyword.Font.Color := clGray;
  4176. end;
  4177. if pnlSearchMoreUser.Visible then
  4178. begin
  4179. edtSearchMoreUser.Text := '查找联系人...';
  4180. edtSearchMoreUser.Font.Color := clGray;
  4181. end;
  4182. if IconButtonType = ltCamera then
  4183. begin
  4184. TalkingForm := GetTalkingForm(Item.LoginName);
  4185. if TalkingForm = nil then
  4186. begin
  4187. TalkingForm := OpenTalkingForm(Item.LoginName, True);
  4188. end;
  4189. iWaitTimes := 0;
  4190. while not TalkingForm.CanWriteMessage do
  4191. begin
  4192. Application.ProcessMessages;
  4193. Inc(iWaitTimes);
  4194. if iWaitTimes > 1000 then
  4195. break;
  4196. Sleep(10);
  4197. end;
  4198. TalkingForm.actVideo.Execute;
  4199. end;
  4200. if IconButtonType = ltHeadImage then
  4201. begin
  4202. if AnsiSameText(Item.LoginName, RealICQClient.Me.LoginName) then
  4203. begin
  4204. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  4205. Exit;
  4206. end;
  4207. OpenTalkingForm(Item.LoginName, True);
  4208. end;
  4209. if IconButtonType = ltSMS then
  4210. begin
  4211. OpenSMSForm(Item.LoginName, True);
  4212. end;
  4213. if IconButtonType = ltEmail then
  4214. begin
  4215. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(Item.LoginName);
  4216. if RealICQUser <> nil then
  4217. //AddWebBrowserToPageControl(Format('http://mail.lishui.gov.cn/web_email/module.phtml?module=mcomposef&to=%s', [RealICQUser.Email]), 999);
  4218. end;
  4219. if IconButtonType = ltAddFriend then
  4220. begin
  4221. if AnsiSameText(MainForm.RealICQClient.LoginName, Item.LoginName) then
  4222. begin
  4223. MessageBox(Handle, '不能添加自己为好友', '提示', MB_ICONINFORMATION);
  4224. Exit;
  4225. end;
  4226. ShowAddFriendWindow(Self, Item.LoginName, Item.DisplayName);
  4227. end;
  4228. if IconButtonType = ltTel then
  4229. begin
  4230. { if not FPCAMessage.GetPCALoginStatus then Exit;
  4231. if (Item.Mobile<>'') and (Item.Tel<>'') then
  4232. begin
  4233. MenuItem:=ppSelCallTel.Items[0];
  4234. MenuItem.Hint:=Item.Mobile+char(10)+Item.DisplayName;
  4235. MenuItem:=ppSelCallTel.Items[1];
  4236. MenuItem.Hint:=Item.Tel+char(10)+Item.DisplayName;
  4237. ppSelCallTel.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y - 50);
  4238. Exit;
  4239. end;
  4240. if Item.Mobile<>'' then CallNumber:=Item.Mobile;
  4241. if Item.Tel<>'' then CallNumber:=Item.Tel;
  4242. FPCAMessage.SendCallTelOutPCAMessage(CallNumber,Item.DisplayName);
  4243. }
  4244. end;
  4245. end;
  4246. //------------------------------------------------------------------------------
  4247. procedure TMainForm.ItemDoubleClick(Item: TRealICQContacterListItem);
  4248. var
  4249. ATeam: TRealICQTeam;
  4250. Branch: TRealICQBranch;
  4251. begin
  4252. if FSearchListViewInVisible then //设置查找输入框为初始状态
  4253. begin
  4254. edFilterKeyword.Text := '查找联系人...';
  4255. edFilterKeyword.Font.Color := clGray;
  4256. end;
  4257. if IsChild(Handle, Item.ListView.Handle) then
  4258. begin
  4259. if GetActiveTabSheetName = LVTeams then
  4260. begin
  4261. ATeam := TRealICQTeam(Item.Data);
  4262. OpenTeamTalkingForm(ATeam.TeamID);
  4263. Exit;
  4264. end;
  4265. end;
  4266. if (Item.StateIndex = 0) and (Item.Data <> nil) then //双击的是部门
  4267. begin
  4268. Branch := Item.Data;
  4269. Branch.Node.Selected := True;
  4270. end
  4271. else if (Item.Data <> nil) then
  4272. begin
  4273. if AnsiSameText(Item.LoginName, RealICQClient.Me.LoginName) then
  4274. begin
  4275. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  4276. Exit;
  4277. end;
  4278. OpenTalkingForm(Item.LoginName);
  4279. end;
  4280. if pnlSearchMoreUser.Visible then
  4281. begin
  4282. edtSearchMoreUser.Text := '查找联系人...';
  4283. end;
  4284. end;
  4285. //------------------------------------------------------------------------------
  4286. procedure TMainForm.ItemOnline(Item: TRealICQContacterListItem);
  4287. var
  4288. iIndex: Integer;
  4289. ARealICQUser: TRealICQUser;
  4290. begin
  4291. //MessageBox(Handle, '1', '1', MB_OK);
  4292. if RealICQClient.Me = nil then
  4293. Exit;
  4294. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  4295. Exit;
  4296. iIndex := FContacterListViews.IndexOfObject(Item.ListView);
  4297. if FContacterListViews[iIndex] = LVLatests then
  4298. exit;
  4299. //MessageBox(Handle, '2', '2', MB_OK);
  4300. if Item.Data <> nil then
  4301. begin
  4302. ARealICQUser := TRealICQUser(Item.Data);
  4303. if (TFriendsService.GetService.IsFriend(ARealICQUser.LoginName)) and (TWorkmatesService.GetService.IsWorkmate(ARealICQUser.LoginName)) then
  4304. begin
  4305. if PlaySoundOnOnline then
  4306. PlayEventSound(OnlineEventSound);
  4307. if ShowHintOnOnline then
  4308. ShowOnOffAlertForm(ARealICQUser);
  4309. end;
  4310. end;
  4311. //MessageBox(Handle, '3', '3', MB_OK);
  4312. end;
  4313. //------------------------------------------------------------------------------
  4314. procedure TMainForm.ItemOffline(Item: TRealICQContacterListItem);
  4315. var
  4316. iIndex: Integer;
  4317. ARealICQUser: TRealICQUser;
  4318. begin
  4319. if RealICQClient.Me = nil then
  4320. Exit;
  4321. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  4322. Exit;
  4323. iIndex := FContacterListViews.IndexOfObject(Item.ListView);
  4324. if FContacterListViews[iIndex] = LVLatests then
  4325. exit;
  4326. if Item.Data <> nil then
  4327. begin
  4328. ARealICQUser := TRealICQUser(Item.Data);
  4329. if (TFriendsService.GetService.IsFriend(ARealICQUser.LoginName)) and (TWorkmatesService.GetService.IsWorkmate(ARealICQUser.LoginName)) then
  4330. begin
  4331. if PlaySoundOnOffline then
  4332. PlayEventSound(OfflineEventSound);
  4333. if ShowHintOnOffline then
  4334. ShowOnOffAlertForm(ARealICQUser);
  4335. end;
  4336. end;
  4337. end;
  4338. //------------------------------------------------------------------------------
  4339. procedure TMainForm.lblLogsClick(Sender: TObject);
  4340. var
  4341. ANoticesRecord: TSystemNotices;
  4342. begin
  4343. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  4344. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(ReadMessageURL + ANoticesRecord.URL)])), '', SW_SHOWDEFAULT);
  4345. end;
  4346. procedure TMainForm.lblLogsMouseEnter(Sender: TObject);
  4347. begin
  4348. lblLogs.Font.Style := [fsUnderline];
  4349. TimerForShowSystemNotices.Enabled := False;
  4350. end;
  4351. procedure TMainForm.lblLogsMouseLeave(Sender: TObject);
  4352. begin
  4353. lblLogs.Font.Style := [];
  4354. TimerForShowSystemNotices.Enabled := FSystemNotices.Count > 0;
  4355. end;
  4356. procedure TMainForm.lblReConnectClick(Sender: TObject);
  4357. begin
  4358. RealICQClient.ReConnectAndLogin;
  4359. end;
  4360. //------------------------------------------------------------------------------
  4361. procedure TMainForm.lblRegisterMouseEnter(Sender: TObject);
  4362. begin
  4363. (Sender as TLabel).Font.Style := [fsUnderline];
  4364. end;
  4365. //------------------------------------------------------------------------------
  4366. procedure TMainForm.lblRegisterMouseLeave(Sender: TObject);
  4367. begin
  4368. (Sender as TLabel).Font.Style := [];
  4369. end;
  4370. //------------------------------------------------------------------------------
  4371. procedure TMainForm.ChangeUIColor(AColor: TColor);
  4372. var
  4373. iLoop: Integer;
  4374. IUIColor: IRealICQUIColor;
  4375. begin
  4376. inherited ChangeUIColor(AColor);
  4377. TMainFormController.GetController.ChangeUIColor(AColor);
  4378. spb360SD.ChangeUIColor(AColor);
  4379. spb360Safe.ChangeUIColor(AColor);
  4380. spbNetworkBackup.ChangeUIColor(AColor);
  4381. spbRefreshBranchUsers.ChangeUIColor(AColor);
  4382. btShowMiniPage.ChangeUIColor(AColor);
  4383. spbDisplayName.ChangeUIColor(AColor);
  4384. spbWatchword.ChangeUIColor(AColor);
  4385. shpWatchwordBorder.Pen.Color := ConvertColorToColor(shpWatchwordBorder.Pen.Color, AColor);
  4386. spbSelUIColor.ChangeUIColor(AColor);
  4387. spbHistroyMessage.ChangeUIColor(AColor);
  4388. spbAddFriend.ChangeUIColor(AColor);
  4389. spblock.ChangeUIColor(AColor);
  4390. btMainMenu.ChangeUIColor(AColor);
  4391. //btOA.ChangeUIColor(AColor);
  4392. //btSwap.ChangeUIColor(AColor);
  4393. spbShowNotReadMessage.ChangeUIColor(AColor);
  4394. spbWinMeet.ChangeUIColor(AColor);
  4395. spbAddFriend.Font.Color := ConvertColorToColor(spbAddFriend.Font.Color, AColor);
  4396. spbHistroyMessage.Font.Color := ConvertColorToColor(spbHistroyMessage.Font.Color, AColor);
  4397. spblock.Font.Color := ConvertColorToColor(spblock.Font.Color, AColor);
  4398. ConvertBitmapToColor(MyContacters.Picture.Bitmap, AColor);
  4399. ConvertBitmapToColor(SysMsg.Picture.Bitmap, AColor);
  4400. ConvertBitmapToColor(MyFriend.Picture.Bitmap, AColor);
  4401. ConvertBitmapToColor(MyTeam.Picture.Bitmap, AColor);
  4402. ConvertBitmapToColor(Latests.Picture.Bitmap, AColor);
  4403. ConvertBitmapToColor(MyContactersIcon.Picture.Bitmap, AColor);
  4404. ConvertBitmapToColor(SysMsgIcon.Picture.Bitmap, AColor);
  4405. ConvertBitmapToColor(MyFriendIcon.Picture.Bitmap, AColor);
  4406. ConvertBitmapToColor(MyTeamIcon.Picture.Bitmap, AColor);
  4407. ConvertBitmapToColor(LatestsIcon.Picture.Bitmap, AColor);
  4408. ConvertBitmapToColor(RealICQHoverImage1.Picture.Bitmap, AColor);
  4409. {通讯录}
  4410. ConvertBitmapToColor(imgAddrBookToolbarBack.Picture.Bitmap, AColor);
  4411. imgAddrBookToolbarBack.Invalidate;
  4412. spbAddGroupUser.ChangeUIColor(AColor);
  4413. spbAddGroup.ChangeUIColor(AColor);
  4414. spbImportGroupUser.ChangeUIColor(AColor);
  4415. {通讯录}
  4416. ShpHint.Pen.Color := ConvertColorToColor(ShpHint.Pen.Color, AColor);
  4417. btPrevLog.ChangeUIColor(AColor);
  4418. btNextLog.ChangeUIColor(AColor);
  4419. ConvertBitmapToColor(ImageForCustomerTop.Picture.Bitmap, AColor);
  4420. ImageForCustomerTop.Invalidate;
  4421. btCustomerLogin.ChangeUIColor(AColor);
  4422. btCustomerLogout.ChangeUIColor(AColor);
  4423. btCustomerDisplayName.ChangeUIColor(AColor);
  4424. ShpLeft.Pen.Color := ConvertColorToColor(ShpLeft.Pen.Color, AColor);
  4425. ShpBottom.Pen.Color := ConvertColorToColor(ShpBottom.Pen.Color, AColor);
  4426. ShpRight.Pen.Color := ConvertColorToColor(ShpRight.Pen.Color, AColor);
  4427. ShpSearchLeft.Pen.Color := ConvertColorToColor(ShpSearchLeft.Pen.Color, AColor);
  4428. ShpSearchBottom.Pen.Color := ConvertColorToColor(ShpSearchBottom.Pen.Color, AColor);
  4429. ShpSearchRight.Pen.Color := ConvertColorToColor(ShpSearchRight.Pen.Color, AColor);
  4430. spbEmail.ChangeUIColor(AColor);
  4431. sbpSMS.ChangeUIColor(AColor);
  4432. spbPersonManage.ChangeUIColor(AColor);
  4433. spbTelMeeting.ChangeUIColor(AColor);
  4434. pnlToolBar.Color := FormColor;
  4435. PnlTop.Color := FormColor;
  4436. pnlWorkArea.Color := FormColor;
  4437. pnlLogout.Color := FormColor;
  4438. pgcMainWorkArea.BackColor := FormColor;
  4439. pnlLocked.Color := FormColor;
  4440. btn_lock_DisplayName.ChangeUIColor(AColor);
  4441. btn_unlock.ChangeUIColor(AColor);
  4442. ConvertBitmapToColor(img_lockback_top.Picture.Bitmap, AColor);
  4443. //ConvertBitmapToColor(shp_lock_client.Picture.Bitmap, AColor);
  4444. //txt_locked.color:= FormColor;
  4445. pnlClient.Color := FormColor;
  4446. pnlNDToolBar.Color := FormColor;
  4447. pnlNDStateBar.Color := FormColor;
  4448. pnlMiddleClient.Color := FormColor;
  4449. pnlAddrBkStateBar.Color := FormColor;
  4450. pnlCustomerServiceStatus.Color := FormColor;
  4451. ConvertBitmapToColor(imgWebToolBack.Picture.Bitmap, AColor);
  4452. imgWebToolBack.Invalidate;
  4453. spbPrev.ChangeUIColor(AColor);
  4454. spbNext.ChangeUIColor(AColor);
  4455. spbStop.ChangeUIColor(AColor);
  4456. spbRefresh.ChangeUIColor(AColor);
  4457. spbAddToNA.ChangeUIColor(AColor);
  4458. spbGo.ChangeUIColor(AColor);
  4459. spbWebClose.ChangeUIColor(AColor);
  4460. sbpNewWebTab.ChangeUIColor(AColor);
  4461. TabSetMuiltWeb.BackgroundColor := ConvertColorToColor(TabSetMuiltWeb.BackgroundColor, AColor);
  4462. TabSetMuiltWeb.SelectedColor := ConvertColorToColor(TabSetMuiltWeb.SelectedColor, AColor);
  4463. shpWebStatus.Pen.Color := ConvertColorToColor(shpWebStatus.Pen.Color, AColor);
  4464. shpWebLeftBorder.Pen.Color := ConvertColorToColor(shpWebLeftBorder.Pen.Color, AColor);
  4465. ConvertBitmapToColor(imgNDToolbarBack.Picture.Bitmap, AColor);
  4466. imgNDToolbarBack.Invalidate;
  4467. ConvertBitmapToColor(imgLogoutBKTop.Picture.Bitmap, AColor);
  4468. imgLogoutBKTop.Invalidate;
  4469. ConvertBitmapToColor(imgLogoutBK.Picture.Bitmap, AColor);
  4470. imgLogoutBK.Invalidate;
  4471. spLoginNameBorder.Pen.Color := ConvertColorToColor(spLoginNameBorder.Pen.Color, AColor);
  4472. spbChangeLoginName.ChangeUIColor(AColor);
  4473. spPasswordBorder.Pen.Color := ConvertColorToColor(spPasswordBorder.Pen.Color, AColor);
  4474. pnlSelectServer.Color := FormColor;
  4475. spServerListBorder.Pen.Color := ConvertColorToColor(spServerListBorder.Pen.Color, AColor);
  4476. spbSelectServer.ChangeUIColor(AColor);
  4477. shpSearchMoreUser.Pen.Color := ConvertColorToColor(shpSearchMoreUser.Pen.Color, AColor);
  4478. spbCancelFilter.ChangeUIColor(AColor);
  4479. shpFilterBorder.Pen.Color := ConvertColorToColor(shpFilterBorder.Pen.Color, AColor);
  4480. spbLoginState.ChangeUIColor(AColor);
  4481. spbSavePassword.ChangeUIColor(AColor);
  4482. spbAutoLogin.ChangeUIColor(AColor);
  4483. btLogin.ChangeUIColor(AColor);
  4484. spbNDMoveUp.ChangeUIColor(AColor);
  4485. spbNDNewDir.ChangeUIColor(AColor);
  4486. spbNDDelete.ChangeUIColor(AColor);
  4487. shpNDDirBorder.Pen.Color := ConvertColorToColor(shpNDDirBorder.Pen.Color, AColor);
  4488. spbNDUpload.ChangeUIColor(AColor);
  4489. spbNDDownload.ChangeUIColor(AColor);
  4490. spbNDConnect.ChangeUIColor(AColor);
  4491. spbNDDisconnect.ChangeUIColor(AColor);
  4492. spbNDRefresh.ChangeUIColor(AColor);
  4493. spbNDCancelAll.ChangeUIColor(AColor);
  4494. TabSetNDMissions.SelectedColor := clWhite;
  4495. TabSetNDMissions.BackgroundColor := clWhite;
  4496. pnlNDMissions.Color := clWhite;
  4497. ConvertBitmapToColor(imgHeadImageBorder.Picture.Bitmap, AColor);
  4498. imgHeadImageBorder.Invalidate;
  4499. ConvertBitmapToColor(imgBottomMenu.Picture.Bitmap, AColor);
  4500. imgBottomMenu.Invalidate;
  4501. ConvertBitmapToColor(imgTitleBackMiddle.Picture.Bitmap, AColor);
  4502. imgTitleBackMiddle.Invalidate;
  4503. IUIColor := pgcMainWorkArea;
  4504. IUIColor.ChangeUIColor(AColor);
  4505. for iLoop := 0 to FContacterListViews.Count - 1 do
  4506. begin
  4507. IUIColor := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  4508. IUIColor.ChangeUIColor(AColor);
  4509. end;
  4510. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  4511. begin
  4512. IUIColor := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  4513. IUIColor.ChangeUIColor(AColor);
  4514. end;
  4515. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  4516. begin
  4517. IUIColor := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  4518. IUIColor.ChangeUIColor(AColor);
  4519. end;
  4520. if Assigned(FTVCustomerLatests) then
  4521. FTVCustomerLatests.ChangeUIColor(AColor);
  4522. // if Assigned(FLVCustomers) then FLVCustomers.ChangeUIColor(AColor);
  4523. if Assigned(FLVSystemMessage) then
  4524. FLVSystemMessage.ChangeUIColor(AColor);
  4525. if Assigned(FLVTeams) then
  4526. FLVTeams.ChangeUIColor(AColor);
  4527. if tsNetWorkDisk.Parent <> nil then
  4528. begin
  4529. FLVNetWorkDisk.ChangeUIColor(AColor);
  4530. FLVNetWorkDiskUploadingFiles.ChangeUIColor(AColor);
  4531. FLVNetWorkDiskDownloadingFiles.ChangeUIColor(AColor);
  4532. end;
  4533. btLogin.ChangeUIColor(AColor);
  4534. btLogin.Invalidate;
  4535. spbContacterViewStyle.ChangeUIColor(AColor);
  4536. spbCreateTeam.ChangeUIColor(AColor);
  4537. spbFindTeam.ChangeUIColor(AColor);
  4538. pnlTeams.Color := ConvertColorToColor(pnlTeams.Color, AColor);
  4539. if CreateTeamForm <> nil then
  4540. CreateTeamForm.ChangeUIColor(AColor);
  4541. if SearchForm <> nil then
  4542. SearchForm.ChangeUIColor(AColor);
  4543. if SearchTeamForm <> nil then
  4544. SearchTeamForm.ChangeUIColor(AColor);
  4545. if SelFaceForm <> nil then
  4546. SelFaceForm.ChangeUIColor(AColor);
  4547. if CustomFacesManagerForm <> nil then
  4548. CustomFacesManagerForm.ChangeUIColor(AColor);
  4549. if NotReadMessageBoxForm <> nil then
  4550. NotReadMessageBoxForm.ChangeUIColor(AColor);
  4551. ChangeAddFriendFormColor(AColor);
  4552. ChangeAddFriendRequestFormColor(AColor);
  4553. // ChangeSeeUserInformationFormColor(AColor);
  4554. ChangeTalkingFormColor(AColor);
  4555. ChangeSMSFormColor(AColor);
  4556. ChangeTeamOptionsFormColor(AColor);
  4557. ChangeSystemMessageFormsColor(AColor);
  4558. end;
  4559. //------------------------------------------------------------------------------
  4560. function TMainForm.GetListViewByLoginName(ALoginName: string; AOnlyInGroups: Boolean = False): TRealICQContacterListView;
  4561. var
  4562. GroupName: string;
  4563. iLoop, jLoop, iIndex, ContacterIndex: Integer;
  4564. GroupMembers: TStringList;
  4565. ListView: TRealICQContacterListView;
  4566. begin
  4567. Result := nil;
  4568. if not AOnlyInGroups then
  4569. begin
  4570. if (TFriendsService.GetService.IsFriend(ALoginName)) and (TWorkmatesService.GetService.IsWorkmate(ALoginName)) then
  4571. begin
  4572. ContacterIndex := FContacterListViews.IndexOf(LVFriends);
  4573. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4574. Result := ListView;
  4575. end
  4576. else if RealICQClient.Blacklists.IndexOf(ALoginName) >= 0 then
  4577. begin
  4578. ContacterIndex := FContacterListViews.IndexOf(LVBlacklists);
  4579. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4580. if ListView.Items.IndexOf(ALoginName) = -1 then
  4581. ListView.Items.Add(ALoginName);
  4582. Result := ListView;
  4583. exit;
  4584. end
  4585. else if RealICQClient.Strangers.IndexOf(ALoginName) >= 0 then
  4586. begin
  4587. ContacterIndex := FContacterListViews.IndexOf(LVStrangers);
  4588. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4589. if ListView.Items.IndexOf(ALoginName) = -1 then
  4590. ListView.Items.Add(ALoginName);
  4591. Result := ListView;
  4592. exit;
  4593. end;
  4594. end;
  4595. if FShowGroup then
  4596. begin
  4597. for iLoop := 0 to FGroups.Count - 1 do
  4598. begin
  4599. GroupName := FGroups[iLoop];
  4600. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  4601. for jLoop := 0 to GroupMembers.Count - 1 do
  4602. begin
  4603. if AnsiSameText(GroupMembers[jLoop], ALoginName) then
  4604. begin
  4605. iIndex := FContacterListViews.IndexOf(GroupName);
  4606. if iIndex >= 0 then
  4607. begin
  4608. ListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  4609. if ListView.Items.IndexOf(ALoginName) = -1 then
  4610. ListView.Items.Add(ALoginName);
  4611. Result := ListView;
  4612. end;
  4613. exit;
  4614. end;
  4615. end;
  4616. end;
  4617. end;
  4618. if Result <> nil then
  4619. if Result.Items.IndexOf(ALoginName) = -1 then
  4620. Result.Items.Add(ALoginName);
  4621. end;
  4622. //------------------------------------------------------------------------------
  4623. procedure TMainForm.ShowNavBarNumeric;
  4624. begin
  4625. //
  4626. end;
  4627. //-------------------显示好友列表---------------
  4628. procedure TMainForm.ShowFriendLists;
  4629. var
  4630. iLoop, itemIndex: Integer;
  4631. RealICQUser: TRealICQUser;
  4632. RealICQFriendTreeView: TRealICQContacterTreeView;
  4633. Friend: TRealICQEmployee;
  4634. begin
  4635. itemIndex := FContacterTreeViews.IndexOf(LvFriends);
  4636. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4637. for iLoop := FNotAddedEmployeeList.Count - 1 downto 0 do
  4638. begin
  4639. RealICQUser := FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  4640. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  4641. Continue;
  4642. if (RealICQFriendTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then
  4643. Continue;
  4644. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  4645. Friend.BranchID := LVFriends;
  4646. RealICQFriendTreeView.AddEmployee(Friend);
  4647. UpdateFriendNode(Friend, RealICQUser, False);
  4648. end;
  4649. end;
  4650. //------------------------------------------------------------------------------
  4651. procedure TMainForm.ShowGroupInterface;
  4652. var
  4653. GroupName, LoginName: string;
  4654. iLoop, jLoop, itemIndex: Integer;
  4655. RealICQUser: TRealICQUser;
  4656. RealICQFriendTreeView: TRealICQContacterTreeView;
  4657. Friend: TRealICQEmployee;
  4658. FriendGroup: TRealICQBranch;
  4659. GroupMembers: TStringList;
  4660. begin
  4661. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  4662. if ItemIndex >= 0 then
  4663. begin
  4664. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4665. try
  4666. RealICQFriendTreeView.Clear;
  4667. FreeAndNil(RealICQFriendTreeView);
  4668. FContacterTreeViews.Delete(ItemIndex);
  4669. except
  4670. end;
  4671. end;
  4672. ItemIndex := AddFriendTreeView(scrollBoxMyFriend, LVFriends);
  4673. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4674. RealICQFriendTreeView.AdjustPosition := False;
  4675. RealICQFriendTreeView.HideSystemScrollBar;
  4676. RealICQFriendTreeView.BeginUpdate;
  4677. SetFlashCaptionOnOnlineValue(False);
  4678. Screen.Cursor := crHourGlass;
  4679. try
  4680. //显示好友
  4681. ShowFriendLists;
  4682. //显示黑名单
  4683. //ShowBlacklists;
  4684. {$region '添加自定义分组'}
  4685. if FShowGroup then
  4686. begin
  4687. for iLoop := 0 to FGroups.Count - 1 do
  4688. begin
  4689. GroupName := FGroups[iLoop];
  4690. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  4691. FriendGroup := TRealICQBranch.Create(GroupName);
  4692. FriendGroup.BranchID := GroupName;
  4693. FriendGroup.ParentID := '';
  4694. FriendGroup.BranchName := GroupName;
  4695. RealICQFriendTreeView.AddBranch(FriendGroup);
  4696. RealICQFriendTreeView.MoveBranch(GroupName, LvFriends);
  4697. for jLoop := 0 to GroupMembers.Count - 1 do
  4698. begin
  4699. LoginName := GroupMembers[jLoop];
  4700. if (not TFriendsService.GetService.IsFriend(LoginName)) and (not TWorkmatesService.GetService.IsWorkmate(LoginName)) then
  4701. continue;
  4702. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  4703. continue;
  4704. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  4705. ItemIndex := RealICQFriendTreeView.EmployeeItems.IndexOf(LoginName);
  4706. if ItemIndex >= 0 then
  4707. RealICQFriendTreeView.EmployeeItems.Delete(ItemIndex);
  4708. Friend := TRealICQEmployee.Create(LoginName);
  4709. Friend.BranchID := FriendGroup.BranchName;
  4710. RealICQFriendTreeView.AddEmployee(Friend);
  4711. UpdateFriendNode(Friend, RealICQUser, False);
  4712. end;
  4713. end;
  4714. end;
  4715. {$endregion}
  4716. //展开好友列表
  4717. ItemIndex := RealICQFriendTreeView.BranchItems.IndexOf(LvFriends);
  4718. FriendGroup := RealICQFriendTreeView.BranchItems.Objects[itemIndex] as TRealICQBranch;
  4719. FriendGroup.Node.Expanded := True;
  4720. finally
  4721. //RealICQFriendTreeView.MoveFriendGroup(LvBlackLists,LvFriends);
  4722. PostMessage(RealICQFriendTreeView.Handle, WM_SIZE, 0, 0);
  4723. RealICQFriendTreeView.EndUpdate;
  4724. Screen.Cursor := crDefault;
  4725. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  4726. end;
  4727. end;
  4728. //------------------------------------------------------------------------------
  4729. function TMainForm.AddFriendTreeView(AOwner: TWinControl; GroupName: string): Integer;
  4730. var
  4731. RealICQFriendTreeView: TRealICQContacterTreeView;
  4732. Group: TRealICQBranch;
  4733. begin
  4734. RealICQFriendTreeView := TRealICQContacterTreeView.Create(AOwner);
  4735. RealICQFriendTreeView.Parent := AOwner;
  4736. RealICQFriendTreeView.Align := alClient;
  4737. RealICQFriendTreeView.Caption := '';
  4738. RealICQFriendTreeView.Color := clWhite;
  4739. RealICQFriendTreeView.ShowHint := True;
  4740. RealICQFriendTreeView.ParentFont := True;
  4741. RealICQFriendTreeView.ShowLine := False;
  4742. RealICQFriendTreeView.ShowBranchImage := False;
  4743. RealICQFriendTreeView.MustDrawButton := True;
  4744. RealICQFriendTreeView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4745. RealICQFriendTreeView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4746. RealICQFriendTreeView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4747. RealICQFriendTreeView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4748. RealICQFriendTreeView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4749. RealICQFriendTreeView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4750. RealICQFriendTreeView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4751. RealICQFriendTreeView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4752. RealICQFriendTreeView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4753. RealICQFriendTreeView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4754. RealICQFriendTreeView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4755. RealICQFriendTreeView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4756. RealICQFriendTreeView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4757. RealICQFriendTreeView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4758. RealICQFriendTreeView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4759. RealICQFriendTreeView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4760. RealICQFriendTreeView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4761. RealICQFriendTreeView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4762. RealICQFriendTreeView.ScrollBarButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarButtonPicture);
  4763. RealICQFriendTreeView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4764. RealICQFriendTreeView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4765. RealICQFriendTreeView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4766. RealICQFriendTreeView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4767. RealICQFriendTreeView.HeadImageBackColor := FLVHeadImageBackColor;
  4768. RealICQFriendTreeView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4769. RealICQFriendTreeView.DefaultPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4770. RealICQFriendTreeView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig44);
  4771. RealICQFriendTreeView.BranchClosedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + GroupClosedButtonPicture);
  4772. RealICQFriendTreeView.BranchOpenedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + GroupOpenedButtonPicture);
  4773. RealICQFriendTreeView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4774. RealICQFriendTreeView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4775. RealICQFriendTreeView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4776. RealICQFriendTreeView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4777. RealICQFriendTreeView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4778. RealICQFriendTreeView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4779. RealICQFriendTreeView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4780. RealICQFriendTreeView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4781. RealICQFriendTreeView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4782. RealICQFriendTreeView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4783. RealICQFriendTreeView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4784. RealICQFriendTreeView.ShowMobileButton := True;
  4785. RealICQFriendTreeView.ShowTelButton := False;
  4786. RealICQFriendTreeView.ShowCameraButton := True;
  4787. RealICQFriendTreeView.ShowHeadImageButton := False;
  4788. RealICQFriendTreeView.ShowEmailButton := False;
  4789. RealICQFriendTreeView.ShowSMSButton := True;
  4790. RealICQFriendTreeView.Style := FLVStyle;
  4791. RealICQFriendTreeView.CaptionStyle := FLVCaptionStyle;
  4792. RealICQFriendTreeView.ChangeUIColor(FUIMainColor);
  4793. RealICQFriendTreeView.PopupMenu := ppUserItemRightMenu;
  4794. RealICQFriendTreeView.OnItemOnline := NodeOnline;
  4795. RealICQFriendTreeView.OnItemOffline := NodeOffline;
  4796. RealICQFriendTreeView.OnItemDoubleClick := NodeDoubleClick;
  4797. RealICQFriendTreeView.OnItemIconButtonClick := NodeIconButtonClick;
  4798. RealICQFriendTreeView.OnItemIconButtonDblClick := NodeIconButtonDblClick;
  4799. RealICQFriendTreeView.OnItemMouseEnter := NodeOnMouseEnter;
  4800. RealICQFriendTreeView.OnItemMouseLeave := NodeOnMouseLeave;
  4801. Result := FContacterTreeViews.AddObject(GroupName, RealICQFriendTreeView);
  4802. RealICQFriendTreeView.AdjustPosition := False;
  4803. RealICQFriendTreeView.HideSystemScrollBar;
  4804. RealICQFriendTreeView.BeginUpdate;
  4805. try
  4806. Group := TRealICQBranch.Create(LVFriends);
  4807. Group.BranchID := LvFriends;
  4808. Group.ParentID := '0';
  4809. Group.BranchName := LvFriends;
  4810. RealICQFriendTreeView.AddBranch(Group);
  4811. finally
  4812. RealICQFriendTreeView.EndUpdate;
  4813. end;
  4814. end;
  4815. //------------------------------------------------------------------------------
  4816. function TMainForm.AddContacterTreeView(AOwner: TWinControl; GroupName: string): Integer;
  4817. var
  4818. RealICQContacterTreeView: TRealICQContacterTreeView;
  4819. begin
  4820. RealICQContacterTreeView := TRealICQContacterTreeView.Create(AOwner);
  4821. RealICQContacterTreeView.Parent := AOwner;
  4822. RealICQContacterTreeView.Align := alClient;
  4823. RealICQContacterTreeView.Caption := '';
  4824. RealICQContacterTreeView.Color := clWhite;
  4825. RealICQContacterTreeView.ShowHint := True;
  4826. RealICQContacterTreeView.ParentFont := True;
  4827. RealICQContacterTreeView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4828. RealICQContacterTreeView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4829. RealICQContacterTreeView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4830. RealICQContacterTreeView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4831. RealICQContacterTreeView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4832. RealICQContacterTreeView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4833. RealICQContacterTreeView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4834. RealICQContacterTreeView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4835. RealICQContacterTreeView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4836. RealICQContacterTreeView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4837. RealICQContacterTreeView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4838. RealICQContacterTreeView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4839. RealICQContacterTreeView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4840. RealICQContacterTreeView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4841. RealICQContacterTreeView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4842. RealICQContacterTreeView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4843. RealICQContacterTreeView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4844. RealICQContacterTreeView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4845. RealICQContacterTreeView.ScrollBarButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarButtonPicture);
  4846. RealICQContacterTreeView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4847. RealICQContacterTreeView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4848. RealICQContacterTreeView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4849. RealICQContacterTreeView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4850. RealICQContacterTreeView.HeadImageBackColor := FLVHeadImageBackColor;
  4851. RealICQContacterTreeView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4852. RealICQContacterTreeView.DefaultPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4853. RealICQContacterTreeView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig44);
  4854. RealICQContacterTreeView.BranchExpandedPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchExpandedPicture);
  4855. RealICQContacterTreeView.BranchCollapsedPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedPicture);
  4856. RealICQContacterTreeView.BranchClosedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchClosedButtonPicture);
  4857. RealICQContacterTreeView.BranchOpenedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchOpenedButtonPicture);
  4858. RealICQContacterTreeView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4859. RealICQContacterTreeView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4860. RealICQContacterTreeView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4861. RealICQContacterTreeView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4862. RealICQContacterTreeView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4863. RealICQContacterTreeView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4864. RealICQContacterTreeView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4865. RealICQContacterTreeView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4866. RealICQContacterTreeView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4867. RealICQContacterTreeView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4868. RealICQContacterTreeView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4869. RealICQContacterTreeView.AddFriendIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + AddFriendIcon);
  4870. RealICQContacterTreeView.NewSNSUpdateIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SNSIcon);
  4871. RealICQContacterTreeView.CheckFalsePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CheckFalse.bmp');
  4872. RealICQContacterTreeView.CheckTruePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CheckTrue.bmp');
  4873. RealICQContacterTreeView.ShowMobileButton := True;
  4874. RealICQContacterTreeView.ShowTelButton := False;
  4875. RealICQContacterTreeView.ShowCameraButton := True;
  4876. RealICQContacterTreeView.ShowHeadImageButton := False;
  4877. RealICQContacterTreeView.ShowEmailButton := False;
  4878. RealICQContacterTreeView.ShowSMSButton := True;
  4879. RealICQContacterTreeView.ShowNewSNSButton := True;
  4880. RealICQContacterTreeView.Style := FLVStyle;
  4881. RealICQContacterTreeView.CaptionStyle := FLVCaptionStyle;
  4882. RealICQContacterTreeView.ChangeUIColor(FUIMainColor);
  4883. RealICQContacterTreeView.PopupMenu := ppUserItemRightMenu;
  4884. if GroupName = LVMoreUsers then
  4885. begin
  4886. RealICQContacterTreeView.OnBranchClick := NodeBranchClick;
  4887. RealICQContacterTreeView.ShowAddFriendButton := True;
  4888. end;
  4889. if GroupName = LVAddrbook then
  4890. begin
  4891. RealICQContacterTreeView.OnBranchClick := NodeGroupClick;
  4892. end;
  4893. RealICQContacterTreeView.OnItemOnline := NodeOnline;
  4894. RealICQContacterTreeView.OnItemOffline := NodeOffline;
  4895. RealICQContacterTreeView.OnItemDoubleClick := NodeDoubleClick;
  4896. RealICQContacterTreeView.OnItemIconButtonClick := NodeIconButtonClick;
  4897. RealICQContacterTreeView.OnItemIconButtonDblClick := NodeIconButtonDblClick;
  4898. RealICQContacterTreeView.OnItemMouseEnter := NodeOnMouseEnter;
  4899. RealICQContacterTreeView.OnItemMouseLeave := NodeOnMouseLeave;
  4900. Result := FContacterTreeViews.AddObject(GroupName, RealICQContacterTreeView);
  4901. end;
  4902. procedure TMainForm.UpdateContacterListView(RealICQContacterListView: TRealICQContacterListView);
  4903. begin
  4904. RealICQContacterListView.Align := alClient;
  4905. RealICQContacterListView.Caption := '';
  4906. RealICQContacterListView.Color := clWhite;
  4907. RealICQContacterListView.ShowHint := True;
  4908. RealICQContacterListView.ParentFont := True;
  4909. RealICQContacterListView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4910. RealICQContacterListView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4911. RealICQContacterListView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4912. RealICQContacterListView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4913. RealICQContacterListView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4914. RealICQContacterListView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4915. RealICQContacterListView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4916. RealICQContacterListView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4917. RealICQContacterListView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4918. RealICQContacterListView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4919. RealICQContacterListView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4920. RealICQContacterListView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4921. RealICQContacterListView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4922. RealICQContacterListView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4923. RealICQContacterListView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4924. RealICQContacterListView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4925. RealICQContacterListView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4926. RealICQContacterListView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4927. RealICQContacterListView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4928. RealICQContacterListView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4929. RealICQContacterListView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4930. RealICQContacterListView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4931. RealICQContacterListView.HeadImageBackColor := FLVHeadImageBackColor;
  4932. RealICQContacterListView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4933. RealICQContacterListView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  4934. RealICQContacterListView.DefaultPictureMiddle.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureMiddle);
  4935. RealICQContacterListView.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4936. //RealICQContacterListView.DefaultPictureBigOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBigOffline);
  4937. //RealICQContacterListView.DefaultPictureMiddleOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureMiddleOffline);
  4938. //RealICQContacterListView.DefaultPictureSmallOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmallOffline);
  4939. RealICQContacterListView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4940. RealICQContacterListView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4941. RealICQContacterListView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4942. RealICQContacterListView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4943. RealICQContacterListView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4944. RealICQContacterListView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4945. RealICQContacterListView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4946. RealICQContacterListView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4947. RealICQContacterListView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4948. RealICQContacterListView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4949. RealICQContacterListView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4950. RealICQContacterListView.AddFriendIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + AddFriendIcon);
  4951. RealICQContacterListView.ShowAddFriendButton := False;
  4952. RealICQContacterListView.ShowMobileButton := True;
  4953. RealICQContacterListView.ShowTelButton := True;
  4954. RealICQContacterListView.ShowCameraButton := True;
  4955. RealICQContacterListView.ShowHeadImageButton := False;
  4956. RealICQContacterListView.ShowEmailButton := True;
  4957. RealICQContacterListView.ShowSMSButton := True;
  4958. RealICQContacterListView.Style := FLVStyle;
  4959. RealICQContacterListView.CaptionStyle := FLVCaptionStyle;
  4960. RealICQContacterListView.ChangeUIColor(FUIMainColor);
  4961. RealICQContacterListView.PopupMenu := ppUserItemRightMenu;
  4962. RealICQContacterListView.OnItemDoubleClick := ItemDoubleClick;
  4963. RealICQContacterListView.OnItemIconButtonClick := ItemIconButtonClick;
  4964. RealICQContacterListView.OnItemIconButtonDblClick := ItemIconButtonDblClick;
  4965. RealICQContacterListView.OnItemMouseEnter := nil; // ItemOnMouseEnter;
  4966. RealICQContacterListView.OnItemMouseLeave := nil; // ItemOnMouseLeave;
  4967. end;
  4968. //------------------------------------------------------------------------------
  4969. function TMainForm.AddContacterListView(AOwner: TWinControl; GroupName: string): Integer;
  4970. var
  4971. RealICQContacterListView: TRealICQContacterListView;
  4972. begin
  4973. RealICQContacterListView := TRealICQContacterListView.Create(AOwner);
  4974. RealICQContacterListView.Parent := AOwner;
  4975. UpdateContacterListView(RealICQContacterListView);
  4976. RealICQContacterListView.ShowAddFriendButton := GroupName = LVMoreUsers;
  4977. RealICQContacterListView.ShowMobileButton := not (GroupName = LVMoreUsers);
  4978. RealICQContacterListView.ShowTelButton := not (GroupName = LVMoreUsers);
  4979. RealICQContacterListView.ShowCameraButton := not (GroupName = LVMoreUsers);
  4980. RealICQContacterListView.ShowHeadImageButton := False; //not (GroupName=LVMoreUsers);
  4981. RealICQContacterListView.ShowEmailButton := False; // not (GroupName=LVMoreUsers);
  4982. RealICQContacterListView.ShowSMSButton := not (GroupName = LVMoreUsers);
  4983. if GroupName = LVMoreUsers then
  4984. begin
  4985. RealICQContacterListView.OnItemOnline := nil;
  4986. RealICQContacterListView.OnItemOffline := nil;
  4987. end
  4988. else
  4989. begin
  4990. RealICQContacterListView.OnItemOnline := ItemOnline;
  4991. RealICQContacterListView.OnItemOffline := ItemOffline;
  4992. end;
  4993. Result := FContacterListViews.AddObject(GroupName, RealICQContacterListView);
  4994. end;
  4995. //------------------------------------------------------------------------------
  4996. procedure TMainForm.ApplicationEventsDeactivate(Sender: TObject);
  4997. begin
  4998. if edWatchword.Visible then
  4999. edWatchwordExit(edWatchword);
  5000. FDblClickedTrayIcon := False;
  5001. end;
  5002. //------------------------------------------------------------------------------
  5003. procedure TMainForm.ApplicationEventsException(Sender: TObject; E: Exception);
  5004. var
  5005. LogFile: TextFile;
  5006. Log: string;
  5007. begin
  5008. Exit;
  5009. try
  5010. Log := DateTimeToStr(Now) + ':' + E.Message;
  5011. AssignFile(LogFile, ExtractFilePath(Application.ExeName) + 'Logs.txt');
  5012. try
  5013. try
  5014. Append(LogFile);
  5015. except
  5016. ReWrite(LogFile);
  5017. end;
  5018. Writeln(LogFile, Log);
  5019. finally
  5020. CloseFile(LogFile);
  5021. end;
  5022. except
  5023. end;
  5024. end;
  5025. procedure TMainForm.ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean);
  5026. var
  5027. classname: array[0..254] of char;
  5028. begin
  5029. if (Msg.message = WM_CLOSE) then
  5030. begin
  5031. getclassname(msg.hwnd, @classname, sizeof(classname)); //取类名
  5032. if classname = 'Shell Embedding' then
  5033. begin
  5034. PeekMessage(Msg, Msg.Hwnd, 0, 0, PM_REMOVE);
  5035. Handled := True; //该消息已处理,不再需要后续处理
  5036. end;
  5037. end;
  5038. if (Msg.message = WM_LBUTTONDOWN) or (Msg.message = WM_NCLBUTTONDOWN) then
  5039. begin
  5040. if IsChild(Handle, Msg.hwnd) then
  5041. begin
  5042. HideUserCardForm;
  5043. end;
  5044. end;
  5045. end;
  5046. procedure TMainForm.ppAddrBookListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5047. begin
  5048. ChangePPMenuColorMap(ppAddrBookList.PopupMenu);
  5049. end;
  5050. procedure TMainForm.ppAddrBookListPopup(Sender: TObject);
  5051. var
  5052. ItemIndex: Integer;
  5053. RealICQContacterTreeView: TRealICQContacterTreeView;
  5054. begin
  5055. ItemIndex := FContacterTreeViews.IndexOf(LVAddrBook);
  5056. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5057. miUpdateGroup.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5058. miDelGroup.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5059. miImportGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5060. miDelGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5061. miUpdateGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5062. miCut.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil) or (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5063. miPaste.Enabled := (FCutNode <> nil);
  5064. miSetRemark.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5065. end;
  5066. procedure TMainForm.ppChangeCustomerStateGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5067. begin
  5068. ChangePPMenuColorMap(ppChangeCustomerState.PopupMenu);
  5069. end;
  5070. procedure TMainForm.ppChangeStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5071. begin
  5072. ChangePPMenuColorMap(ppChangeStates.PopupMenu);
  5073. end;
  5074. //------------------------------------------------------------------------------
  5075. procedure TMainForm.ppChangeStatesPopup(Sender: TObject);
  5076. begin
  5077. end;
  5078. //------------------------------------------------------------------------------
  5079. procedure TMainForm.ppColorsGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5080. begin
  5081. ChangePPMenuColorMap(ppColors.PopupMenu);
  5082. end;
  5083. //------------------------------------------------------------------------------
  5084. procedure TMainForm.ppColorsPopup(Sender: TObject);
  5085. var
  5086. iLoop: Integer;
  5087. ColorStr: string;
  5088. MenuItem: TMenuItem;
  5089. Bitmap: TBitmap;
  5090. procedure FindSkins(APath: string);
  5091. var
  5092. DSearchRec: TSearchRec;
  5093. FindResult: Integer;
  5094. begin
  5095. FindResult := FindFirst(APath + '*.*', faDirectory, DSearchRec);
  5096. while FindResult = 0 do
  5097. begin
  5098. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  5099. if (DSearchRec.Attr and faDirectory) = faDirectory then
  5100. begin
  5101. MenuItem := TMenuItem.Create(miSkins);
  5102. MenuItem.Caption := DSearchRec.Name;
  5103. MenuItem.OnClick := miSkinClick;
  5104. MenuItem.Enabled := SkinName <> DSearchRec.Name;
  5105. MenuItem.Checked := SkinName = DSearchRec.Name;
  5106. miSkins.Insert(0, MenuItem);
  5107. end;
  5108. FindResult := FindNext(DSearchRec);
  5109. end;
  5110. end;
  5111. begin
  5112. ImgLstColors.Clear;
  5113. while ppColors.Items.Count > 4 do
  5114. ppColors.Items.Delete(0);
  5115. Bitmap := TBitmap.Create;
  5116. Bitmap.SetSize(16, 16);
  5117. try
  5118. for iLoop := ColorDialog.CustomColors.Count - 1 downto 0 do
  5119. begin
  5120. ColorStr := Copy(ColorDialog.CustomColors[iLoop], 8, 6);
  5121. if ColorStr = 'FFFFFF' then
  5122. continue;
  5123. ColorStr := '$00' + ColorStr;
  5124. Bitmap.Canvas.Pen.Color := clGray;
  5125. Bitmap.Canvas.Pen.Style := psSolid;
  5126. Bitmap.Canvas.Brush.Color := StrToInt(ColorStr);
  5127. Bitmap.Canvas.Brush.Style := bsSolid;
  5128. Bitmap.Canvas.Rectangle(0, 0, Width, Height);
  5129. ImgLstColors.Add(Bitmap, nil);
  5130. MenuItem := TMenuItem.Create(ppColors);
  5131. MenuItem.Caption := '颜色' + IntToStr(iLoop);
  5132. MenuItem.Tag := StrToInt(ColorStr);
  5133. MenuItem.ImageIndex := ImgLstColors.Count - 1;
  5134. MenuItem.OnClick := miColorClick;
  5135. MenuItem.Enabled := MenuItem.Tag <> UIMainColor;
  5136. MenuItem.Checked := MenuItem.Tag = UIMainColor;
  5137. if MenuItem.Checked then
  5138. MenuItem.ImageIndex := -1;
  5139. ppColors.Items.Insert(0, MenuItem);
  5140. end;
  5141. finally
  5142. Bitmap.Free;
  5143. end;
  5144. miSkins.Clear;
  5145. //FindSkins(ExtractFilePath(Application.ExeName) + 'Skins\');
  5146. FindSkins(ExtractFilePath(Application.ExeName) + SkinPath);
  5147. end;
  5148. //------------------------------------------------------------------------------
  5149. procedure TMainForm.ChangePPMenuColorMap(PopupMenuEx: TCustomActionPopupMenuEx);
  5150. begin
  5151. HideUserCardForm;
  5152. PopupMenuEx.ColorMap.Color := FormColor;
  5153. PopupMenuEx.ColorMap.SelectedColor := ConvertColorToColor(PopupMenuEx.ColorMap.SelectedColor, UIMainColor);
  5154. PopupMenuEx.ColorMap.BtnFrameColor := ConvertColorToColor(PopupMenuEx.ColorMap.BtnFrameColor, UIMainColor);
  5155. PopupMenuEx.Font.Name := '宋体';
  5156. PopupMenuEx.Font.Size := 9;
  5157. end;
  5158. //------------------------------------------------------------------------------
  5159. procedure TMainForm.ppContacterViewStyleGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5160. begin
  5161. ChangePPMenuColorMap(ppContacterViewStyle.PopupMenu);
  5162. end;
  5163. //------------------------------------------------------------------------------
  5164. procedure TMainForm.ppLoginedUsersGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5165. begin
  5166. ChangePPMenuColorMap(ppLoginedUsers.PopupMenu);
  5167. end;
  5168. //------------------------------------------------------------------------------
  5169. procedure TMainForm.ppLoginedUsersPopup(Sender: TObject);
  5170. var
  5171. iLoop: Integer;
  5172. MenuItem: TMenuItem;
  5173. begin
  5174. while ppLoginedUsers.Items.Count > 2 do
  5175. ppLoginedUsers.Items.Delete(0);
  5176. for iLoop := 0 to RealICQClient.LoginedUsers.Count - 1 do
  5177. begin
  5178. if iLoop >= 20 then
  5179. Break;
  5180. MenuItem := TMenuItem.Create(ppLoginedUsers);
  5181. MenuItem.AutoHotkeys := maManual;
  5182. MenuItem.AutoLineReduction := maManual;
  5183. MenuItem.Caption := RealICQClient.LoginedUsers[iLoop];
  5184. MenuItem.OnClick := miChangeLoginNameClick;
  5185. MenuItem.Tag := iLoop;
  5186. ppLoginedUsers.Items.Insert(0, MenuItem);
  5187. end;
  5188. end;
  5189. procedure TMainForm.ppLoginStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5190. begin
  5191. ChangePPMenuColorMap(ppLoginStates.PopupMenu);
  5192. end;
  5193. procedure TMainForm.ppMainMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5194. begin
  5195. ChangePPMenuColorMap(ppMainMenu.PopupMenu);
  5196. end;
  5197. //------------------------------------------------------------------------------
  5198. procedure TMainForm.ppNetWorkFileGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5199. begin
  5200. ChangePPMenuColorMap(ppNetWorkFile.PopupMenu);
  5201. end;
  5202. //------------------------------------------------------------------------------
  5203. procedure TMainForm.ppNetWorkFilePopup(Sender: TObject);
  5204. begin
  5205. NDSelectItemChanged(nil);
  5206. miNDNewDir.Enabled := spbNDNewDir.Enabled;
  5207. miNDDelete.Enabled := spbNDDelete.Enabled;
  5208. miNDDownload.Enabled := spbNDDownload.Enabled;
  5209. miNDRename.Enabled := (FLVNetWorkDisk.SelCount = 1) and (not pnlNDMissions.Visible);
  5210. end;
  5211. //------------------------------------------------------------------------------
  5212. procedure TMainForm.ppNetWorkMissonGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5213. begin
  5214. ChangePPMenuColorMap(ppNetWorkMisson.PopupMenu);
  5215. end;
  5216. //------------------------------------------------------------------------------
  5217. procedure TMainForm.ppNetWorkMissonPopup(Sender: TObject);
  5218. begin
  5219. if PageControlNDMission.ActivePageIndex = 0 then
  5220. miNDCancel.Enabled := FLVNetWorkDiskUploadingFiles.SelCount > 0
  5221. else
  5222. miNDCancel.Enabled := FLVNetWorkDiskDownloadingFiles.SelCount > 0;
  5223. end;
  5224. procedure TMainForm.ppSelCallTelGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5225. begin
  5226. ChangePPMenuColorMap(ppSelCallTel.PopupMenu);
  5227. end;
  5228. procedure TMainForm.ppServerListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5229. begin
  5230. ChangePPMenuColorMap(ppServerList.PopupMenu);
  5231. end;
  5232. procedure TMainForm.MeasureItem(Sender: TObject; ACanvas: TCanvas; var Width, Height: Integer);
  5233. begin
  5234. //在OnMeasureItem事件中改变菜单的宽度和高度
  5235. //改变菜单的宽度和高度以容纳文本
  5236. Width := edServerList.Width;
  5237. end;
  5238. procedure TMainForm.miChangeServerClick(Sender: TObject);
  5239. var
  5240. ServerInfo: TServerInfo;
  5241. ItemIndex: Integer;
  5242. RealICQContacterTreeView: TRealICQContacterTreeView;
  5243. begin
  5244. try
  5245. SetGetMoreUserEvent;
  5246. if Sender = nil then
  5247. begin
  5248. //RealICQClient.SendGetMoreBranch(FCurrentServerID);
  5249. RealICQClient.SendGetBranchs(FCurrentServerID, 0);
  5250. end
  5251. else
  5252. begin
  5253. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf((Sender as TMenuItem).Hint)] as TServerInfo;
  5254. if ServerInfo.ServerName = edServerList.Text then
  5255. Exit;
  5256. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  5257. if ItemIndex >= 0 then
  5258. begin
  5259. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5260. try
  5261. RealICQContacterTreeView.Clear;
  5262. FreeAndNil(RealICQContacterTreeView);
  5263. FContacterTreeViews.Delete(ItemIndex);
  5264. except
  5265. //Exit;
  5266. end;
  5267. end;
  5268. ImgLoadingMoreBranchs.Visible := True;
  5269. ScrollBoxMoreUser.Visible := False;
  5270. edServerList.Text := ServerInfo.ServerName;
  5271. //RealICQClient.SendGetMoreBranch(ServerInfo.ServerId);
  5272. RealICQClient.SendGetBranchs(ServerInfo.ServerId, 0);
  5273. FCurrentServerID := ServerInfo.ServerId;
  5274. end;
  5275. except
  5276. edServerList.Text := '';
  5277. end;
  5278. end;
  5279. //------------------------------------------------------------------------------
  5280. procedure TMainForm.ppTeamListViewGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5281. begin
  5282. ChangePPMenuColorMap(ppTeamListView.PopupMenu);
  5283. end;
  5284. //------------------------------------------------------------------------------
  5285. procedure TMainForm.ppTeamListViewPopup(Sender: TObject);
  5286. var
  5287. iLoop: Integer;
  5288. RealICQTeam: TRealICQTeam;
  5289. ListItem: TRealICQContacterListItem;
  5290. begin
  5291. actSendTeamMessage.Visible := FLVTeams.SelCount = 1;
  5292. actSeeTeamInformation.Visible := FLVTeams.SelCount = 1;
  5293. actShowTeamHistory.Visible := FLVTeams.SelCount = 1;
  5294. actQuitTeam.Visible := FLVTeams.SelCount = 1;
  5295. actDisbandTeam.Visible := FLVTeams.SelCount = 1;
  5296. actQuitOrDisbandTeams.Visible := FLVTeams.SelCount > 1;
  5297. self.miSendTeamSMS.Visible := FLVTeams.SelCount = 1;
  5298. if FLVTeams.SelCount = 1 then
  5299. begin
  5300. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  5301. begin
  5302. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  5303. if ListItem.Selected then
  5304. begin
  5305. RealICQTeam := ListItem.Data;
  5306. actDisbandTeam.Visible := AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName);
  5307. actQuitTeam.Visible := not actDisbandTeam.Visible;
  5308. if actDisbandTeam.Visible then
  5309. actSeeTeamInformation.Caption := '修改群组详细资料(&D)...'
  5310. else
  5311. actSeeTeamInformation.Caption := '查看群组详细资料(&D)...';
  5312. Break;
  5313. end;
  5314. end;
  5315. end;
  5316. end;
  5317. //------------------------------------------------------------------------------
  5318. procedure TMainForm.ppTrayIconGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5319. begin
  5320. ChangePPMenuColorMap(ppTrayIcon.PopupMenu);
  5321. end;
  5322. //------------------------------------------------------------------------------
  5323. procedure TMainForm.ppUserItemRightMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5324. begin
  5325. ChangePPMenuColorMap(ppUserItemRightMenu.PopupMenu);
  5326. end;
  5327. //------------------
  5328. function TMainForm.GetActiveTabSheetName: string;
  5329. //var ImageButton:TRealICQHoverImage;
  5330. begin
  5331. if ActiveButtonTag < 1 then
  5332. ActiveButtonTag := 1;
  5333. // ImageButton:=FToolBarButtonIconList.Objects[ActiveButtonTag-1] as TRealICQHoverImage;
  5334. Result := FToolBarButtonIconList[ActiveButtonTag - 1];
  5335. end;
  5336. //------------------------------------------------------------------------------
  5337. procedure TMainForm.ppUserItemRightMenuPopup(Sender: TObject);
  5338. var
  5339. iLoop, ItemIndex: Integer;
  5340. GroupName, TabSheetName: string;
  5341. Friend: TRealICQEmployee;
  5342. MenuItem: TMenuItem;
  5343. RealICQContacterTreeView: TRealICQContacterTreeView;
  5344. RealICQFriendTreeView: TRealICQContacterTreeView;
  5345. procedure SetMenuItemVisible;
  5346. begin
  5347. actSendMessage.Visible := actSendMessage.Enabled;
  5348. actSeeInformation.Visible := actSeeInformation.Enabled;
  5349. actShowHistory.Visible := actShowHistory.Enabled;
  5350. actChangeRemark.Visible := actChangeRemark.Enabled;
  5351. actDelFriend.Visible := actDelFriend.Enabled;
  5352. actRemoveUser.Visible := actRemoveUser.Enabled;
  5353. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5354. miGroup.Visible := miGroup.Enabled;
  5355. end;
  5356. begin
  5357. miGoSpace.Visible := ShowSNS;
  5358. RealICQContacterTreeView := nil;
  5359. RealICQFriendTreeView := nil;
  5360. TabSheetName := GetActiveTabSheetName;
  5361. //如果是在“最近联系人”中弹出右键菜单
  5362. if TabSheetName = LVLatests then
  5363. begin
  5364. actSendMessage.Enabled := FLVLatests.SelCount = 1;
  5365. actSeeInformation.Enabled := FLVLatests.SelCount = 1;
  5366. actShowHistory.Enabled := FLVLatests.SelCount = 1;
  5367. actChangeRemark.Enabled := False;
  5368. actDelFriend.Enabled := False;
  5369. actRemoveUser.Enabled := False;
  5370. miGroup.Enabled := False;
  5371. miManageGroup.Enabled := False;
  5372. miManageGroup.Visible := False;
  5373. menuItemShowGroup.Visible := False;
  5374. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5375. SetMenuItemVisible;
  5376. Exit;
  5377. end;
  5378. actSendMessage.Enabled := False;
  5379. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5380. actSeeInformation.Enabled := False;
  5381. ;
  5382. actShowHistory.Enabled := False;
  5383. actChangeRemark.Enabled := False;
  5384. actRemoveUser.Enabled := False;
  5385. actDelFriend.Enabled := False;
  5386. miGroup.Enabled := False;
  5387. miManageGroup.Enabled := False;
  5388. miManageGroup.Visible := False;
  5389. menuItemShowGroup.Visible := False;
  5390. if TabSheetName = LVMyContacters then
  5391. begin
  5392. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  5393. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5394. if (RealICQContacterTreeView.GetSelectedEmployee <> nil) then
  5395. begin
  5396. actSendMessage.Enabled := True;
  5397. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5398. actSeeInformation.Enabled := True;
  5399. actShowHistory.Enabled := True;
  5400. actChangeRemark.Enabled := True;
  5401. miGroup.Enabled := False;
  5402. actRemoveUser.Enabled := False;
  5403. actDelFriend.Enabled := False;
  5404. end;
  5405. SetMenuItemVisible;
  5406. Exit;
  5407. end;
  5408. if TabSheetName = LVMoreUsers then
  5409. begin
  5410. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  5411. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5412. if (RealICQContacterTreeView.GetSelectedEmployee <> nil) then
  5413. begin
  5414. actSendMessage.Enabled := True;
  5415. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5416. actSeeInformation.Enabled := True;
  5417. actShowHistory.Enabled := True;
  5418. actChangeRemark.Enabled := True;
  5419. miGroup.Enabled := False;
  5420. actRemoveUser.Enabled := False;
  5421. actDelFriend.Enabled := False;
  5422. end;
  5423. SetMenuItemVisible;
  5424. Exit;
  5425. end;
  5426. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  5427. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5428. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  5429. miManageGroup.Enabled := True;
  5430. miManageGroup.Visible := True;
  5431. menuItemShowGroup.Visible := True;
  5432. if Friend <> nil then
  5433. begin
  5434. GroupName := Friend.BranchID;
  5435. if GroupName = LvFriends then
  5436. actDelFriend.Enabled := True;
  5437. actSendMessage.Enabled := True;
  5438. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5439. actSeeInformation.Enabled := True;
  5440. actShowHistory.Enabled := True;
  5441. actChangeRemark.Enabled := True;
  5442. miGroup.Enabled := True and (not FSearchListViewInVisible);
  5443. actRemoveUser.Enabled := True;
  5444. SetMenuItemVisible;
  5445. end
  5446. else
  5447. begin
  5448. SetMenuItemVisible;
  5449. Exit;
  5450. end;
  5451. if AnsiSameStr(GroupName, LVFriends) then
  5452. begin
  5453. miGroup.Caption := '移动至组(&M)...';
  5454. actRemoveUser.Enabled := False;
  5455. end
  5456. else
  5457. begin
  5458. //在自定义组的用户列表控件上弹出右键菜单
  5459. actSendMessage.Enabled := True;
  5460. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5461. actSeeInformation.Enabled := True;
  5462. actShowHistory.Enabled := True;
  5463. actChangeRemark.Enabled := True;
  5464. miGroup.Enabled := True and (not FSearchListViewInVisible);
  5465. miGroup.Caption := '移动至组(&M)...';
  5466. end;
  5467. miGroup.Clear;
  5468. if FShowGroup then
  5469. begin
  5470. for iLoop := 0 to FGroups.Count - 1 do
  5471. begin
  5472. if GroupName = FGroups[iLoop] then
  5473. continue;
  5474. MenuItem := TMenuItem.Create(miGroup);
  5475. MenuItem.Caption := FGroups[iLoop];
  5476. MenuItem.OnClick := miMoveGroupClick;
  5477. MenuItem.Enabled := miGroup.Enabled;
  5478. miGroup.Add(MenuItem);
  5479. end;
  5480. MenuItem := TMenuItem.Create(miGroup);
  5481. MenuItem.Caption := '-';
  5482. miGroup.Add(MenuItem);
  5483. end;
  5484. miGroup.Enabled := miGroup.Count > 0;
  5485. end;
  5486. //------------------------------------------------------------------------------
  5487. procedure TMainForm.WMQueryEndSession(var message: TWMQUERYENDSESSION);
  5488. begin
  5489. try
  5490. try
  5491. //Dialogs.ShowMessage('关机');
  5492. FreeAndNil(NotReadMessageBoxForm);
  5493. Application.Terminate;
  5494. if RealICQClient.Logined then
  5495. RealICQClient.Logout;
  5496. except
  5497. end;
  5498. finally
  5499. message.Result := 1; //允许
  5500. end;
  5501. end;
  5502. //------------------------------------------------------------------------------
  5503. procedure TMainForm.WMPowerBroadcast(var message: TMessage);
  5504. begin
  5505. try
  5506. try
  5507. if message.wparam = 4 then //..休眠
  5508. begin
  5509. if RealICQClient.Logined then
  5510. RealICQClient.Logout;
  5511. end;
  5512. if message.wparam = 18 then // 休眠重起
  5513. begin
  5514. if RealICQClient.SavedPassword then
  5515. RealICQClient.LoginAsSaved;
  5516. end;
  5517. except
  5518. end;
  5519. finally
  5520. message.Result := 1; //允许
  5521. end;
  5522. end;
  5523. //------------------------------------------------------------------------------
  5524. procedure TMainForm.CMWininichange(var Message: TWMWinIniChange);
  5525. begin
  5526. ChangeUIColor(FUIMainColor);
  5527. DisableAlign;
  5528. try
  5529. PostMessage(Handle, WM_SIZE, 0, 0);
  5530. finally
  5531. EnableAlign;
  5532. end;
  5533. end;
  5534. //------------------------------------------------------------------------------
  5535. procedure TMainForm.SetSearchListViewVisible(AShow: Boolean);
  5536. begin
  5537. FSearchListViewInVisible := AShow;
  5538. if AShow then
  5539. begin
  5540. pnlSearch.Left := shpFilterBorder.Left + 9;
  5541. pnlSearch.Top := shpFilterBorder.Top + shpFilterBorder.Height + 28;
  5542. pnlSearch.Width := shpFilterBorder.Width;
  5543. pnlSearch.Visible := True;
  5544. end
  5545. else
  5546. begin
  5547. pnlSearch.Visible := False;
  5548. end;
  5549. end;
  5550. //------------------------------------------------------------------------------
  5551. procedure TMainForm.edFilterKeywordChange(Sender: TObject);
  5552. var
  5553. iLoop: Integer;
  5554. RealICQUser: TRealICQUser;
  5555. KeyWord, UserCaption: string;
  5556. ItemIndex: Integer;
  5557. ListItem: TRealICQContacterListItem;
  5558. AUsers: TStringList;
  5559. begin
  5560. KeyWord := Trim(edFilterKeyword.Text);
  5561. if (KeyWord = '查找联系人...') or (KeyWord = '') then
  5562. begin
  5563. if FSearchListViewInVisible then
  5564. SetSearchListViewVisible(False);
  5565. end
  5566. else
  5567. begin
  5568. if not FSearchListViewInVisible then
  5569. SetSearchListViewVisible(True);
  5570. if AnsiSameText(KeyWord, FLastSearchKeyWord) then
  5571. Exit;
  5572. //删除当前结果中不符合新的查询条件的记录
  5573. FLastSearchKeyWord := KeyWord;
  5574. for iLoop := FSearchListView.Items.Count - 1 downto 0 do
  5575. begin
  5576. if not AnsiSameText(Trim(edFilterKeyword.Text), KeyWord) then
  5577. Exit;
  5578. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  5579. RealICQUser := ListItem.Data;
  5580. UserCaption := RealICQUser.DisplayName + '' + RealICQUser.LoginName + '' + RealICQUser.Watchword;
  5581. 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
  5582. FSearchListView.Items.Delete(iLoop);
  5583. Application.ProcessMessages;
  5584. end;
  5585. FSearchListView.FlashCaptionOnOnline := False;
  5586. //在好友列表中查找
  5587. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  5588. try
  5589. for iLoop := 0 to AUsers.Count - 1 do
  5590. begin
  5591. if not AnsiSameText(FLastSearchKeyWord, KeyWord) then
  5592. begin
  5593. Exit;
  5594. end;
  5595. RealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  5596. if (RealICQUser = RealICQClient.Me) then
  5597. continue;
  5598. UserCaption := RealICQUser.DisplayName + ' ' + RealICQUser.LoginName + ' ' + RealICQUser.Watchword;
  5599. 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
  5600. begin
  5601. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  5602. if ItemIndex = -1 then
  5603. begin
  5604. ItemIndex := FSearchListView.Items.Add(RealICQUser.LoginName);
  5605. ListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  5606. BindUserDataToItem(ListItem, RealICQUser);
  5607. Application.ProcessMessages;
  5608. end;
  5609. end;
  5610. end;
  5611. finally
  5612. FreeAndNil(AUsers);
  5613. end;
  5614. FSearchListView.FlashCaptionOnOnline := FFlashCaptionOnOnline;
  5615. if FSearchListView.Items.Count <= 0 then
  5616. begin
  5617. ScrollBoxSearchUser.Visible := False;
  5618. lblSearchResult.Caption := #10 + #13 + ' 无搜索结果';
  5619. lblSearchResult.Visible := True;
  5620. end
  5621. else
  5622. begin
  5623. ScrollBoxSearchUser.Visible := True;
  5624. lblSearchResult.Visible := False;
  5625. end;
  5626. end;
  5627. end;
  5628. procedure TMainForm.edFilterKeywordClick(Sender: TObject);
  5629. var
  5630. KeyWord: string;
  5631. begin
  5632. KeyWord := Trim(edFilterKeyword.Text);
  5633. if KeyWord = '查找联系人...' then
  5634. edFilterKeyword.Text := '';
  5635. edFilterKeyword.Font.Color := clWindowText;
  5636. end;
  5637. //------------------------------------------------------------------------------
  5638. procedure TMainForm.edFilterKeywordExit(Sender: TObject);
  5639. var
  5640. KeyWord: string;
  5641. begin
  5642. KeyWord := Trim(edFilterKeyword.Text);
  5643. if KeyWord = '' then
  5644. edFilterKeyword.Text := '查找联系人...';
  5645. edFilterKeyword.Font.Color := clGray;
  5646. end;
  5647. //------------------------------------------------------------------------------
  5648. procedure TMainForm.SetLoginStateControlState;
  5649. const
  5650. CA_TEXT: string = '您选择了使用CA登录';
  5651. begin
  5652. if (FLoginState = stLeave) or (FLoginState = stBusy) then
  5653. spbLoginState.Caption := FLeaveMessage
  5654. else
  5655. spbLoginState.Caption := StateValues[Integer(FLoginState)];
  5656. RealICQClient.LoginState := FLoginState;
  5657. RealICQClient.LeaveMessage := FLeaveMessage;
  5658. if FSavePassword then
  5659. ImgLstCheckStates.GetIcon(1, spbSavePassword.Icon)
  5660. else
  5661. ImgLstCheckStates.GetIcon(0, spbSavePassword.Icon);
  5662. if RealICQClient.CALogin then
  5663. begin
  5664. ImgLstCheckStates.GetIcon(1, btnCaLogin.Icon);
  5665. edLoginName.Text := CA_TEXT;
  5666. edLoginName.Enabled := False;
  5667. edPassword.Enabled := False;
  5668. spbChangeLoginName.Enabled := False;
  5669. end
  5670. else
  5671. begin
  5672. ImgLstCheckStates.GetIcon(0, btnCaLogin.Icon);
  5673. if SameText(CA_TEXT, edLoginName.Text) then
  5674. edLoginName.Text := '';
  5675. edLoginName.Enabled := True;
  5676. edPassword.Enabled := True;
  5677. spbChangeLoginName.Enabled := True;
  5678. end;
  5679. FAutoLogin := FAutoLogin and FSavePassword;
  5680. spbAutoLogin.Enabled := FSavePassword;
  5681. if FAutoLogin then
  5682. ImgLstCheckStates.GetIcon(1, spbAutoLogin.Icon)
  5683. else
  5684. ImgLstCheckStates.GetIcon(0, spbAutoLogin.Icon);
  5685. end;
  5686. //------------------------------------------------------------------------------
  5687. procedure TMainForm.edLoginNameChange(Sender: TObject);
  5688. begin
  5689. if AnsiSameText(edLoginName.Text, RealICQClient.LoginName) and RealICQClient.SavedPassword then
  5690. begin
  5691. edPassword.Text := '保存的密码';
  5692. lblPasswordTitle.Enabled := False;
  5693. edPassword.Enabled := False;
  5694. spbSavePassword.Enabled := False;
  5695. FLoginAsSavePassword := True;
  5696. FLoginState := RealICQClient.LoginState;
  5697. FLeaveMessage := RealICQClient.LeaveMessage;
  5698. FSavePassword := RealICQClient.SavedPassword;
  5699. FAutoLogin := RealICQClient.AutoLogin;
  5700. SetLoginStateControlState;
  5701. end
  5702. else if FLoginAsSavePassword then
  5703. begin
  5704. edPassword.Text := '';
  5705. edPassword.Enabled := True;
  5706. lblPasswordTitle.Enabled := True;
  5707. spbSavePassword.Enabled := True;
  5708. FLoginAsSavePassword := False;
  5709. FLoginState := stOnline;
  5710. FLeaveMessage := '';
  5711. FSavePassword := False;
  5712. FAutoLogin := False;
  5713. SetLoginStateControlState;
  5714. end;
  5715. end;
  5716. //------------------------------------------------------------------------------
  5717. procedure TMainForm.edPasswordEnter(Sender: TObject);
  5718. begin
  5719. if not RealICQClient.CALogin then
  5720. begin
  5721. Self.FSavePassword := True;
  5722. FAutoLogin := True;
  5723. RealICQClient.AutoLogin := FAutoLogin;
  5724. SetLoginStateControlState;
  5725. end;
  5726. end;
  5727. //------全市查找-----------------------------
  5728. procedure TMainForm.edtSearchMoreUserChange(Sender: TObject);
  5729. var
  5730. KeyWord: string;
  5731. iIndex, iLoop: Integer;
  5732. //FSearchMoreUserListView:TRealICQContacterListView;
  5733. begin
  5734. KeyWord := Trim((Sender as TEdit).Text);
  5735. iIndex := FContacterListViews.IndexOf(LVMoreUsers);
  5736. FSearchMoreUserListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  5737. FSearchMoreUserListView.Items.Clear;
  5738. if (KeyWord = '查找联系人...') or (KeyWord = '') then
  5739. begin
  5740. pnlSearchMoreUser.Visible := False;
  5741. Exit;
  5742. end
  5743. else
  5744. begin
  5745. RealICQClient.OnSearchUserResult := RealICQClientSearchUserResult;
  5746. RealICQClient.SendSearchMoreUser(KeyWord, FCurrentServerID);
  5747. pnlSearchMoreUser.Left := shpSearchMoreUser.Left;
  5748. pnlSearchMoreUser.Width := pnlSelectServer.Width - 22;
  5749. pnlSearchMoreUser.Top := shpSearchMoreUser.Top + shpSearchMoreUser.Height;
  5750. LblSearchHint.Caption := #10 + #10 + #10 + #10 + #10'正在查询,请稍侯。';
  5751. LblSearchHint.Visible := True;
  5752. ScrollBoxSearchMoreUser.Visible := False;
  5753. ImgLogining.Visible := True;
  5754. pnlSearchMoreUser.Visible := True;
  5755. pnlSearchMoreUser.BringToFront;
  5756. end;
  5757. end;
  5758. //--------------------------------------------------------
  5759. procedure TMainForm.edtSearchMoreUserClick(Sender: TObject);
  5760. var
  5761. KeyWord: string;
  5762. begin
  5763. KeyWord := Trim(edtSearchMoreUser.Text);
  5764. if KeyWord = '查找联系人...' then
  5765. edtSearchMoreUser.Text := '';
  5766. edtSearchMoreUser.Font.Color := clWindowText;
  5767. end;
  5768. procedure TMainForm.edtSearchMoreUserExit(Sender: TObject);
  5769. var
  5770. KeyWord: string;
  5771. begin
  5772. KeyWord := Trim(edtSearchMoreUser.Text);
  5773. if KeyWord = '' then
  5774. edtSearchMoreUser.Text := '查找联系人...';
  5775. edtSearchMoreUser.Font.Color := clGray;
  5776. end;
  5777. //------------------------------------------------------------------------------
  5778. procedure TMainForm.edWatchwordExit(Sender: TObject);
  5779. var
  5780. AWatchword: WideString;
  5781. begin
  5782. spbWatchword.Visible := True;
  5783. shpWatchwordBorder.Visible := False;
  5784. edWatchword.Visible := False;
  5785. if RealICQClient.Logined then
  5786. begin
  5787. if (not AnsiSameStr(Trim(edWatchword.Text), RealICQClient.Me.Watchword)) and (not AnsiSameStr(Trim(edWatchword.Text), '在此键入您的个性签名')) then
  5788. begin
  5789. AWatchword := Trim(edWatchword.Text);
  5790. spbWatchword.Hint := AWatchword;
  5791. spbWatchword.ShowHint := False;
  5792. //字符串长度过长时,截短字符串并在后面显示“...”
  5793. while spbWatchword.Canvas.TextWidth(AWatchword) > pnlTop.Width - 86 do
  5794. begin
  5795. if Length(AWatchword) > 3 then
  5796. begin
  5797. if Copy(AWatchword, Length(AWatchword) - 2, Length(AWatchword)) = '...' then
  5798. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 3);
  5799. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 1) + '...';
  5800. end
  5801. else
  5802. break;
  5803. spbWatchword.ShowHint := True;
  5804. end;
  5805. spbWatchword.Caption := edWatchword.Text;
  5806. RealICQClient.ChangeBaseInformation(RealICQClient.Me.DisplayName, Trim(edWatchword.Text));
  5807. end;
  5808. end;
  5809. end;
  5810. //------------------------------------------------------------------------------
  5811. procedure TMainForm.edWatchwordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  5812. begin
  5813. if Key = 13 then
  5814. edWatchwordExit(edWatchword);
  5815. end;
  5816. //------------------------------------------------------------------------------
  5817. procedure TMainForm.edWebSearchKeyWordEnter(Sender: TObject);
  5818. begin
  5819. //
  5820. end;
  5821. //------------------------------------------------------------------------------
  5822. procedure TMainForm.edWebSearchKeyWordExit(Sender: TObject);
  5823. begin
  5824. end;
  5825. //------------------------------------------------------------------------------
  5826. procedure TMainForm.edWebSearchKeyWordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  5827. begin
  5828. if Key = 13 then
  5829. spbWebSearchClick(nil);
  5830. end;
  5831. //------------------------------------------------------------------------------
  5832. procedure TMainForm.spbWatchwordClick(Sender: TObject);
  5833. begin
  5834. if not RealICQClient.Logined then
  5835. Exit;
  5836. spbWatchword.Visible := False;
  5837. shpWatchwordBorder.Left := spbWatchword.Left;
  5838. shpWatchwordBorder.Top := spbWatchword.Top;
  5839. shpWatchwordBorder.Width := pnlTop.Width - 66;
  5840. shpWatchwordBorder.Height := spbWatchword.Height;
  5841. edWatchword.Left := shpWatchwordBorder.Left + 2;
  5842. edWatchword.Top := shpWatchwordBorder.Top + (shpWatchwordBorder.Height - edWatchword.Height) div 2 + 1;
  5843. edWatchword.Width := shpWatchwordBorder.Width - 6;
  5844. edWatchword.Text := RealICQClient.Me.Watchword;
  5845. shpWatchwordBorder.Visible := True;
  5846. edWatchword.Visible := True;
  5847. edWatchword.SetFocus;
  5848. edWatchword.SelStart := 0;
  5849. edWatchword.SelLength := Length(edWatchword.Text);
  5850. shpWatchwordBorder.BringToFront;
  5851. edWatchword.BringToFront;
  5852. end;
  5853. //------------------------------------------------------------------------------
  5854. procedure TMainForm.spbWebSearchClick(Sender: TObject);
  5855. begin
  5856. //
  5857. end;
  5858. //------------------------------------------------------------------------------
  5859. procedure TMainForm.spbWinMeetClick(Sender: TObject);
  5860. var
  5861. WinMeetPath, Parameter: string;
  5862. Branch: TRealICQBranch;
  5863. ItemIndex: Integer;
  5864. RealICQContacterTreeView: TRealICQContacterTreeView;
  5865. begin
  5866. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  5867. if (ItemIndex < 0) then
  5868. Exit;
  5869. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5870. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(MainForm.RealICQClient.Me.BranchID);
  5871. if (ItemIndex < 0) then
  5872. Exit;
  5873. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  5874. while Branch.Node.Parent <> nil do
  5875. begin
  5876. Branch := TRealICQBranch(Branch.Node.Parent.Data);
  5877. end;
  5878. WinMeetPath := GetFilePahtFromRegedit('\Software\WinSoft\WinMeet', 'AppPath');
  5879. if Trim(WinMeetPath) = '' then
  5880. begin
  5881. ShowMessage('您还没有安装视频会议客户端!');
  5882. Exit;
  5883. end;
  5884. Parameter := ' ' + MainForm.RealICQClient.LoginName + ' ' + MD5En(RealICQClient.Password) + ' ' + Branch.BranchID;
  5885. ShellExecute(handle, 'open', PChar(WinMeetPath), PChar(Parameter), '', SW_SHOWNORMAL);
  5886. end;
  5887. //------------------------------------------------------------------------------
  5888. procedure TMainForm.CreateParams(var Params: TCreateParams);
  5889. begin
  5890. inherited;
  5891. with Params do
  5892. begin
  5893. Params.WndParent := 0;
  5894. end;
  5895. end;
  5896. //------------------------------------------------------------------------------
  5897. procedure TMainForm.WndProc(var Message: TMessage);
  5898. begin
  5899. inherited wndproc(message);
  5900. if message.msg = WM_DEVICECHANGE then
  5901. RealICQClient.CheckAVDevice;
  5902. if message.msg = CLOSEWINDOWS then
  5903. QuitWindows;
  5904. {if (message.msg = WM_PAINT) or (message.msg = WM_NCPAINT) then
  5905. begin
  5906. ActionMainMenuBar.Refresh;
  5907. end;}
  5908. end;
  5909. procedure TMainForm.spbAddToNAClick(Sender: TObject);
  5910. var
  5911. TabSheet: TTabSheet;
  5912. WebBrowser: TWebBrowser;
  5913. begin
  5914. MainForm.FormStyle := fsNormal;
  5915. try
  5916. try
  5917. TabSheet := pgcMultiWeb.ActivePage;
  5918. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  5919. AddToFavorite(WebBrowser);
  5920. except
  5921. end;
  5922. finally
  5923. // if MainForm.AlwaysOnTop then
  5924. // MainForm.FormStyle := fsStayOnTop
  5925. // else
  5926. // MainForm.FormStyle := fsNormal;
  5927. end;
  5928. end;
  5929. //------------------------------------------------------------------------------
  5930. procedure TMainForm.spbWebCloseClick(Sender: TObject);
  5931. var
  5932. TabSheet: TTabSheet;
  5933. WebBrowser: TWebBrowser;
  5934. begin
  5935. TabSheet := pgcMultiWeb.ActivePage;
  5936. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  5937. if pgcMultiWeb.PageCount > 1 then
  5938. begin
  5939. try
  5940. if WebBrowser.Busy then
  5941. WebBrowser.Stop;
  5942. except
  5943. end;
  5944. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  5945. TabSheet.PageControl := nil;
  5946. FreeAndNil(TabSheet);
  5947. end
  5948. else
  5949. begin
  5950. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  5951. WebBrowser.Navigate('about:blank');
  5952. end;
  5953. end;
  5954. procedure TMainForm.spbAutoLoginClick(Sender: TObject);
  5955. begin
  5956. FAutoLogin := not FAutoLogin;
  5957. RealICQClient.AutoLogin := FAutoLogin;
  5958. SetLoginStateControlState;
  5959. end;
  5960. //------------------------------------------------------------------------------
  5961. procedure TMainForm.HideMainForm;
  5962. var
  5963. BaseTop, BaseLeft: Integer;
  5964. begin
  5965. if FMovingMainForm then
  5966. Exit;
  5967. if RealICQClient.Logining then
  5968. begin
  5969. FDblClickedTrayIcon := True;
  5970. TimerForShowMainForm.Enabled := False;
  5971. TimerForShowMainForm.Enabled := True;
  5972. Exit;
  5973. end;
  5974. BaseTop := (Height - ClientHeight) div 2;
  5975. BaseLeft := (Width - ClientWidth) div 2;
  5976. DisableAlign;
  5977. try
  5978. if FHidePosition = hpTop then
  5979. begin
  5980. Top := -(Height - BaseTop * 2 - 2);
  5981. end;
  5982. if FHidePosition = hpLeft then
  5983. begin
  5984. Left := -(Width - BaseLeft * 2 - 2);
  5985. end;
  5986. if FHidePosition = hpRight then
  5987. begin
  5988. Left := Screen.WorkAreaWidth - BaseLeft - 4;
  5989. end;
  5990. finally
  5991. EnableAlign;
  5992. PostMessage(Handle, WM_KILLFOCUS, 0, 0);
  5993. FMainFormHidden := True;
  5994. end;
  5995. end;
  5996. //------------------------------------------------------------------------------
  5997. procedure TMainForm.ShowMainForm;
  5998. var
  5999. BaseTop, BaseLeft: Integer;
  6000. begin
  6001. if FMovingMainForm then
  6002. Exit;
  6003. BaseTop := (Height - ClientHeight) div 2;
  6004. BaseLeft := (Width - ClientWidth) div 2;
  6005. DisableAlign;
  6006. try
  6007. if FHidePosition = hpTop then
  6008. begin
  6009. Top := -BaseTop;
  6010. end;
  6011. if FHidePosition = hpLeft then
  6012. begin
  6013. Left := -BaseLeft;
  6014. end;
  6015. if FHidePosition = hpRight then
  6016. begin
  6017. Left := Screen.WorkAreaWidth - Width + BaseLeft;
  6018. end;
  6019. finally
  6020. EnableAlign;
  6021. PostMessage(Handle, WM_SETFOCUS, 0, 0);
  6022. FMainFormHidden := False;
  6023. end;
  6024. end;
  6025. //------------------------------------------------------------------------------
  6026. procedure TMainForm.TimerForShowMainFormTimer(Sender: TObject);
  6027. begin
  6028. FDblClickedTrayIcon := False;
  6029. TimerForShowMainForm.Enabled := False;
  6030. end;
  6031. //------------------------------------------------------------------------------
  6032. procedure TMainForm.TimerForHideMainFormTimer(Sender: TObject);
  6033. begin
  6034. if not FAutoHide then
  6035. begin
  6036. if FMainFormHidden then
  6037. ShowMainForm;
  6038. FHidePosition := hpNone;
  6039. TimerForHideMainForm.Enabled := False;
  6040. Exit;
  6041. end;
  6042. TimerForHideMainForm.Enabled := False;
  6043. try
  6044. if FMovingMainForm then
  6045. Exit;
  6046. if (Mouse.CursorPos.X >= Left) and (Mouse.CursorPos.X <= Left + Width) and (Mouse.CursorPos.Y >= Top) and (Mouse.CursorPos.Y <= Top + Height) then
  6047. begin
  6048. if FMainFormHidden then
  6049. ShowMainForm;
  6050. FDblClickedTrayIcon := False;
  6051. end
  6052. else
  6053. begin
  6054. if (not FMainFormHidden) and (not FDblClickedTrayIcon) then
  6055. HideMainForm;
  6056. end;
  6057. finally
  6058. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  6059. end;
  6060. end;
  6061. //------------------------------------------------------------------------------
  6062. procedure TMainForm.WMMove(var Msg: TMessage);
  6063. var
  6064. BaseTop: Integer;
  6065. begin
  6066. HideUserCardForm;
  6067. FMovingMainForm := False;
  6068. BaseTop := (Height - ClientHeight) div 2;
  6069. if (FHidePosition = hpLeft) or (FHidePosition = hpRight) then
  6070. Height := Screen.WorkAreaHeight + BaseTop * 2;
  6071. if TimerForHideMainForm <> nil then
  6072. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  6073. end;
  6074. //------------------------------------------------------------------------------
  6075. procedure TMainForm.WMSizing(var Msg: TMessage);
  6076. begin
  6077. inherited;
  6078. HideUserCardForm;
  6079. FMovingMainForm := True;
  6080. end;
  6081. //------------------------------------------------------------------------------
  6082. procedure TMainForm.WMSize(var Msg: TMessage);
  6083. begin
  6084. inherited;
  6085. HideUserCardForm;
  6086. FMovingMainForm := False;
  6087. CheckWindowPositon;
  6088. end;
  6089. //------------------------------------------------------------------------------
  6090. procedure TMainForm.WMMoving(var Msg: TMessage);
  6091. var
  6092. BaseTop, BaseLeft: Integer;
  6093. begin
  6094. HideUserCardForm;
  6095. FMovingMainForm := True;
  6096. BaseTop := (Height - ClientHeight) div 2;
  6097. BaseLeft := (Width - ClientWidth) div 2;
  6098. with PRECT(Msg.LParam)^ do
  6099. begin
  6100. if (Top < -BaseTop) then
  6101. begin
  6102. FHidePosition := hpTop;
  6103. Top := -BaseTop;
  6104. Bottom := Top + Height;
  6105. end
  6106. else if (Left < -BaseLeft) then
  6107. begin
  6108. FHidePosition := hpLeft;
  6109. Right := Right + (-BaseLeft - Left);
  6110. Top := -BaseTop;
  6111. Left := -BaseLeft;
  6112. Bottom := Screen.WorkAreaHeight + BaseTop * 2;
  6113. end
  6114. else if (Right > (Screen.WorkAreaWidth + BaseLeft)) then
  6115. begin
  6116. FHidePosition := hpRight;
  6117. Top := -BaseTop;
  6118. Right := Screen.WorkAreaWidth + BaseLeft;
  6119. Left := Right - Width;
  6120. Bottom := Screen.WorkAreaHeight + BaseTop * 2;
  6121. end
  6122. else if (Top > -BaseTop) and (Left > -BaseLeft) and (Right < (Screen.WorkAreaWidth + BaseLeft)) then
  6123. begin
  6124. FHidePosition := hpNone;
  6125. Bottom := Top + Height;
  6126. end;
  6127. end;
  6128. end;
  6129. //------------------------------------------------------------------------------
  6130. procedure TMainForm.spbTelMeetingClick(Sender: TObject);
  6131. begin
  6132. //
  6133. end;
  6134. procedure TMainForm.spbCancelFilterClick(Sender: TObject);
  6135. begin
  6136. edFilterKeyword.Text := '查找联系人...';
  6137. edFilterKeyword.Font.Color := clGray;
  6138. end;
  6139. procedure TMainForm.spbChangeLoginNameClick(Sender: TObject);
  6140. var
  6141. Point: TPoint;
  6142. begin
  6143. Point.X := 0;
  6144. Point.Y := spLoginNameBorder.Height + 1;
  6145. Point := spLoginNameBorder.ClientToScreen(Point);
  6146. ppLoginedUsers.Popup(Point.X, Point.Y);
  6147. end;
  6148. procedure TMainForm.spbContacterViewStyleClick(Sender: TObject);
  6149. var
  6150. Point: TPoint;
  6151. begin
  6152. Point.X := 0;
  6153. Point.Y := spbContacterViewStyle.Height + 1;
  6154. Point := spbContacterViewStyle.ClientToScreen(Point);
  6155. ppContacterViewStyle.Popup(Point.X, Point.Y);
  6156. end;
  6157. //------------------------------------------------------------------------------
  6158. procedure TMainForm.spbDisplayNameClick(Sender: TObject);
  6159. var
  6160. Point: TPoint;
  6161. begin
  6162. Point.X := 0;
  6163. Point.Y := spbDisplayName.Height + 1;
  6164. Point := spbDisplayName.ClientToScreen(Point);
  6165. ppChangeStates.Popup(Point.X, Point.Y);
  6166. end;
  6167. //------------------------------------------------------------------------------
  6168. procedure TMainForm.spbEmailClick(Sender: TObject);
  6169. begin
  6170. //AddWebBrowserToPageControl('http://www.lxtalk.com/rd/', 999);
  6171. end;
  6172. //------------------------------------------------------------------------------
  6173. procedure TMainForm.spbFindTeamClick(Sender: TObject);
  6174. begin
  6175. if SearchTeamForm <> nil then
  6176. begin
  6177. SearchTeamForm.BringToFront;
  6178. Exit;
  6179. end;
  6180. SearchTeamForm := TSearchTeamForm.Create(Application);
  6181. SearchTeamForm.Show;
  6182. end;
  6183. //------------------------------------------------------------------------------
  6184. procedure TMainForm.spbGoClick(Sender: TObject);
  6185. var
  6186. TabSheet: TTabSheet;
  6187. WebBrowser: TWebBrowser;
  6188. begin
  6189. TabSheet := pgcMultiWeb.ActivePage;
  6190. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6191. WebBrowser.Tag := -1;
  6192. try
  6193. if (WebBrowser.Busy) then
  6194. WebBrowser.Stop;
  6195. except
  6196. end;
  6197. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  6198. WebBrowser.Navigate(cbxURLInputer.Text);
  6199. end;
  6200. //------------------------------------------------------------------------------
  6201. procedure TMainForm.spbLoginStateClick(Sender: TObject);
  6202. var
  6203. Point: TPoint;
  6204. begin
  6205. Point.X := 0;
  6206. Point.Y := spbLoginState.Height + 1;
  6207. Point := spbLoginState.ClientToScreen(Point);
  6208. ppLoginStates.Popup(Point.X, Point.Y);
  6209. end;
  6210. //------------------------------------------------------------------------------
  6211. procedure TMainForm.spbNDCancelAllClick(Sender: TObject);
  6212. var
  6213. AMissionID: string;
  6214. UploadMission: TUploadMission;
  6215. ListItem: TRealICQContacterListItem;
  6216. begin
  6217. try
  6218. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count > 0) then
  6219. begin
  6220. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  6221. if Assigned(ListItem) then
  6222. begin
  6223. UploadMission := TUploadMission(ListItem.Data);
  6224. if Assigned(UploadMission) then
  6225. begin
  6226. AMissionID := UploadMission.FID;
  6227. try
  6228. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  6229. FreeAndNil(UploadMission);
  6230. except
  6231. end;
  6232. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  6233. end;
  6234. end;
  6235. end;
  6236. except
  6237. end;
  6238. try
  6239. if FLVNetWorkDiskUploadingFiles <> nil then
  6240. begin
  6241. FLVNetWorkDiskUploadingFiles.Items.Clear;
  6242. FLVNetWorkDiskUploadingFiles.ReDrawAll;
  6243. end;
  6244. except
  6245. end;
  6246. try
  6247. if FLVNetWorkDiskDownloadingFiles <> nil then
  6248. begin
  6249. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  6250. FLVNetWorkDiskDownloadingFiles.ReDrawAll;
  6251. end;
  6252. except
  6253. end;
  6254. ClearFileMissions;
  6255. pnlNDMissions.Visible := False;
  6256. SplitterNDMissions.Visible := False;
  6257. spbNDCancelAll.Enabled := False;
  6258. FConfirmReplaceResult := -1;
  6259. FLastDownloadDirectory := '';
  6260. CheckNDControlState;
  6261. end;
  6262. //------------------------------------------------------------------------------
  6263. procedure TMainForm.spbNDConnectClick(Sender: TObject);
  6264. var
  6265. LoginName: string;
  6266. begin
  6267. RealICQNetWorkDiskClient.TCPClient.RemoteAddress := RealICQClient.NetWorkDiskServerAddress;
  6268. RealICQNetWorkDiskClient.TCPClient.RemotePort := RealICQClient.NetWorkDiskServerPort;
  6269. RealICQNetWorkDiskClient.TCPClient.Proxy.Assign(RealICQClient.TCPClient.Proxy);
  6270. LoginName := RealICQClient.LoginName;
  6271. if Pos('+', RealICQClient.LoginName) > 0 then
  6272. LoginName := Copy(RealICQClient.LoginName, Pos('+', RealICQClient.LoginName) + 1, Length(RealICQClient.LoginName));
  6273. RealICQNetWorkDiskClient.Login(LoginName, RealICQClient.Password);
  6274. end;
  6275. //------------------------------------------------------------------------------
  6276. procedure TMainForm.spbSavePasswordClick(Sender: TObject);
  6277. begin
  6278. FSavePassword := not FSavePassword;
  6279. SetLoginStateControlState;
  6280. end;
  6281. //------------------------------------------------------------------------------
  6282. procedure TMainForm.spbSelectServerClick(Sender: TObject);
  6283. var
  6284. Point: TPoint;
  6285. begin
  6286. Point.X := 0;
  6287. Point.Y := spServerListBorder.Height;
  6288. Point := spServerListBorder.ClientToScreen(Point);
  6289. ppServerList.Popup(Point.X, Point.Y);
  6290. end;
  6291. procedure TMainForm.spbSelLanguageClick(Sender: TObject);
  6292. var
  6293. Point: TPoint;
  6294. begin
  6295. Point.X := 0;
  6296. Point.Y := (Sender as TRealICQSpeedButton).Height + 1;
  6297. Point := (Sender as TRealICQSpeedButton).ClientToScreen(Point);
  6298. ppLanguages.Popup(Point.X, Point.Y);
  6299. end;
  6300. procedure TMainForm.spbSelUIColorClick(Sender: TObject);
  6301. var
  6302. Point: TPoint;
  6303. begin
  6304. Point.X := 0;
  6305. Point.Y := (Sender as TRealICQSpeedButton).Height + 1;
  6306. Point := (Sender as TRealICQSpeedButton).ClientToScreen(Point);
  6307. ppColors.Popup(Point.X, Point.Y);
  6308. end;
  6309. procedure TMainForm.spbShowHideRightClick(Sender: TObject);
  6310. begin
  6311. //ShowOrHideMuiltiWeb;
  6312. end;
  6313. procedure TMainForm.spbStopClick(Sender: TObject);
  6314. var
  6315. TabSheet: TTabSheet;
  6316. WebBrowser: TWebBrowser;
  6317. begin
  6318. try
  6319. TabSheet := pgcMultiWeb.ActivePage;
  6320. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6321. if WebBrowser.Busy then
  6322. WebBrowser.Stop;
  6323. except
  6324. end;
  6325. end;
  6326. //------------------------------------------------------------------------------
  6327. procedure TMainForm.TabSetMuiltWebClick(Sender: TObject);
  6328. var
  6329. TabSheet: TTabSheet;
  6330. WebBrowser: TWebBrowser;
  6331. begin
  6332. pgcMultiWeb.ActivePageIndex := TabSetMuiltWeb.TabIndex;
  6333. try
  6334. TabSheet := pgcMultiWeb.ActivePage;
  6335. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6336. if not AnsiSameText(WebBrowser.LocationURL, 'about:blank') then
  6337. begin
  6338. with cbxURLInputer.ItemsEx.Add do
  6339. begin
  6340. Caption := WebBrowser.LocationURL;
  6341. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  6342. ImageIndex := 2
  6343. else if Copy(Caption, 1, 4) = 'ftp:' then
  6344. ImageIndex := 1
  6345. else
  6346. ImageIndex := 0;
  6347. end;
  6348. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  6349. end;
  6350. except
  6351. end;
  6352. end;
  6353. //------------------------------------------------------------------------------
  6354. procedure TMainForm.TabSetMuiltWebGetImageIndex(Sender: TObject; TabIndex: Integer; var ImageIndex: Integer);
  6355. var
  6356. TabSheet: TTabSheet;
  6357. WebBrowser: TWebBrowser;
  6358. AImageIndex: Integer;
  6359. begin
  6360. AImageIndex := 0;
  6361. try
  6362. TabSheet := pgcMultiWeb.Pages[TabIndex];
  6363. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6364. if not AnsiSameText(WebBrowser.LocationURL, 'about:blank') then
  6365. begin
  6366. with cbxURLInputer.ItemsEx.Add do
  6367. begin
  6368. Caption := WebBrowser.LocationURL;
  6369. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  6370. ImageIndex := 2
  6371. else if Copy(Caption, 1, 4) = 'ftp:' then
  6372. ImageIndex := 1
  6373. else
  6374. ImageIndex := 0;
  6375. AImageIndex := ImageIndex;
  6376. end;
  6377. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  6378. end;
  6379. except
  6380. end;
  6381. ImageIndex := AImageIndex;
  6382. end;
  6383. //------------------------------------------------------------------------------
  6384. procedure TMainForm.TabSetNDMissionsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
  6385. begin
  6386. PageControlNDMission.ActivePageIndex := TabSetNDMissions.TabIndex;
  6387. end;
  6388. //------------------------------------------------------------------------------
  6389. procedure TMainForm.TabSetNDMissionsClick(Sender: TObject);
  6390. begin
  6391. PageControlNDMission.ActivePageIndex := TabSetNDMissions.TabIndex;
  6392. end;
  6393. //------------------------------------------------------------------------------
  6394. procedure TMainForm.TimerForCheckDblClickTimer(Sender: TObject);
  6395. begin
  6396. TimerForCheckDblClick.Enabled := False;
  6397. //if AutoUpdateForm <> nil then Exit;
  6398. SetForegroundWindow(TrueHiddenMainForm.Handle);
  6399. if RealICQClient.Logined and RealICQClient.Connected then
  6400. ppChangeStates.Popup(FCursorPosX, Screen.WorkAreaHeight)
  6401. else
  6402. ppTrayIcon.Popup(FCursorPosX, Screen.WorkAreaHeight);
  6403. end;
  6404. //------------------------------------------------------------------------------
  6405. procedure TMainForm.TimerForCheckLogoutTimeoutTimer(Sender: TObject);
  6406. begin
  6407. TimerForCheckLogoutTimeout.Enabled := False;
  6408. RealICQClient.Logout;
  6409. SetUIState;
  6410. end;
  6411. //------------------------------------------------------------------------------
  6412. procedure TMainForm.TrayIconClick(Sender: TObject);
  6413. begin
  6414. FCursorPosX := Mouse.CursorPos.X;
  6415. TimerForCheckDblClick.Interval := GetDoubleClickTime();
  6416. if not TimerForCheckDblClick.Enabled then
  6417. TimerForCheckDblClick.Enabled := True;
  6418. end;
  6419. //------------------------------------------------------------------------------
  6420. procedure TMainForm.OpenNotReadMessage(iIndex: Integer);
  6421. var
  6422. nTeamID: string;
  6423. MessageID, SMSReceiver: string;
  6424. SystemMessage: TRealICQSystemMessage;
  6425. SMSForm: TSMSForm;
  6426. MessageList: TList;
  6427. NotReadMessage: TNotReadMessage;
  6428. begin
  6429. if (iIndex < 0) and (iIndex >= FNotReadMessages.Count) then
  6430. Exit;
  6431. if FNotReadMessages.Count = 0 then
  6432. actOpenMainForm.Execute
  6433. else
  6434. begin
  6435. MessageID := FNotReadMessages.Strings[iIndex];
  6436. if AnsiSameStr(Copy(MessageID, 1, Length(SMSMessageID)), SMSMessageID) then
  6437. begin
  6438. SMSReceiver := Copy(MessageID, Length(SMSMessageID) + 1, Length(MessageID) - Length(SMSMessageID));
  6439. // if SMSReceiver <> '' then
  6440. SMSForm := OpenSMSForm(SMSReceiver)
  6441. // else
  6442. // SMSForm := OpenSMSForm()
  6443. end
  6444. else if AnsiSameStr(Copy(MessageID, 1, Length(TeamMessageID)), TeamMessageID) then
  6445. begin
  6446. nTeamID := Copy(MessageID, Length(TeamMessageID) + 1, Length(MessageID) - Length(TeamMessageID));
  6447. OpenTeamTalkingForm(nTeamID);
  6448. end
  6449. else if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  6450. begin
  6451. try
  6452. SystemMessage := FNotReadMessages.Objects[iIndex] as TRealICQSystemMessage;
  6453. ShowSystemMessage(SystemMessage);
  6454. finally
  6455. FNotReadMessages.Delete(iIndex);
  6456. try
  6457. NotReadMessageBoxForm.ShowNotReadMessage;
  6458. NotReadMessageBoxForm.Height := 0;
  6459. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  6460. except
  6461. end;
  6462. end;
  6463. end
  6464. else
  6465. begin
  6466. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  6467. NotReadMessage := MessageList[0];
  6468. OpenTalkingForm(MessageID, True, NotReadMessage.FRealICQClient);
  6469. end;
  6470. end;
  6471. end;
  6472. //------------------------------------------------------------------------------
  6473. procedure TMainForm.TrayIconDblClick(Sender: TObject);
  6474. begin
  6475. TimerForCheckDblClick.Enabled := False;
  6476. OpenNotReadMessage(FNotReadMessages.Count - 1);
  6477. end;
  6478. //------------------------------------------------------------------------------
  6479. procedure TMainForm.TrayIconMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  6480. var
  6481. iTimes: Integer;
  6482. ANeedShow: Boolean;
  6483. rcTray: TRect;
  6484. hwndTray: hWnd;
  6485. hwndChild: hWnd;
  6486. begin
  6487. try
  6488. if not Assigned(NotReadMessageBoxForm) then
  6489. Exit;
  6490. ANeedShow := (FNotReadMessages <> nil) and (FNotReadMessages.Count > 0) and (MainForm.RealICQClient.Connected) and (TimerForFlashTrayIcon.Enabled);
  6491. if not ANeedShow then
  6492. begin
  6493. if NotReadMessageBoxForm.Visible then
  6494. begin
  6495. NotReadMessageBoxForm.Visible := False;
  6496. NotReadMessageBoxForm.Timer1.Enabled := False;
  6497. end;
  6498. Exit;
  6499. end;
  6500. if (not NotReadMessageBoxForm.Visible) and (NotReadMessageBoxForm.Tag = 1) then
  6501. begin
  6502. //TrayIcon.Hint := '';
  6503. NotReadMessageBoxForm.Tag := 0;
  6504. hwndTray := FindWindow('Shell_TrayWnd', nil);
  6505. hwndChild := FindWindowEx(hwndTray, 0, 'TrayNotifyWnd', nil);
  6506. GetWindowRect(hwndChild, rcTray);
  6507. FTrayIconRect.Left := X - 20;
  6508. FTrayIconRect.Top := rcTray.Top;
  6509. FTrayIconRect.Right := FTrayIconRect.Left + 40;
  6510. FTrayIconRect.Bottom := rcTray.Bottom;
  6511. NotReadMessageBoxForm.ShowNotReadMessage;
  6512. NotReadMessageBoxForm.Height := 0;
  6513. NotReadMessageBoxForm.FRect := FTrayIconRect;
  6514. //NotReadMessageBoxForm.Left := X - NotReadMessageBoxForm.Width div 2;
  6515. NotReadMessageBoxForm.Left := Screen.WorkAreaWidth - NotReadMessageBoxForm.Width;
  6516. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  6517. NotReadMessageBoxForm.FRect.Left := NotReadMessageBoxForm.FRect.Left;
  6518. NotReadMessageBoxForm.FRect.Top := NotReadMessageBoxForm.Top;
  6519. NotReadMessageBoxForm.FRect.Right := NotReadMessageBoxForm.FRect.Right;
  6520. NotReadMessageBoxForm.FRect.Bottom := NotReadMessageBoxForm.FRect.Bottom;
  6521. NotReadMessageBoxForm.Visible := True;
  6522. NotReadMessageBoxForm.Timer1.Enabled := True;
  6523. end;
  6524. //MessageBoxForm.Visible := FNotReadMessages.Count > 0;
  6525. except
  6526. end;
  6527. end;
  6528. procedure TMainForm.TrayIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  6529. begin
  6530. //if AutoUpdateForm <> nil then Exit;
  6531. if Button = mbRight then
  6532. begin
  6533. SetForegroundWindow(TrueHiddenMainForm.Handle);
  6534. ppTrayIcon.Popup(Mouse.CursorPos.X, Screen.WorkAreaHeight);
  6535. end;
  6536. end;
  6537. //------------------------------------------------------------------------------
  6538. {通讯录}
  6539. //------------------------------------------------------------------------------
  6540. procedure TMainForm.tsAddrBookShow(Sender: TObject);
  6541. begin
  6542. //
  6543. end;
  6544. //----保存联系人----------------------------------------------------- ---------
  6545. procedure TMainForm.SaveContacter(Name, Mobile, Tel, Email, Remark, BranchId: string);
  6546. var
  6547. MessageId, ParamValue: string;
  6548. begin
  6549. MessageId := IntToStr(GetTickCount);
  6550. CreateManageGroupMemberMessage('', Name, '', Mobile, Tel, Email, Remark, BranchId, MessageId);
  6551. //发送新增联系人消息
  6552. ParamValue := MessageId + #10 + '' + #10 + Name + #10 + Mobile + #10 + Tel + #10 + Email + #10 + Remark + #10 + '' + #10 + BranchId;
  6553. RealICQClient.SendAddrBookCommand(1, 1, ParamValue);
  6554. end;
  6555. //----修改备注名称--------------------------------------------------------------
  6556. procedure TMainForm.miSendTeamSMSClick(Sender: TObject);
  6557. var
  6558. iLoop: Integer;
  6559. ListItem: TRealICQContacterListItem;
  6560. RealICQTeam: TRealICQTeam;
  6561. begin
  6562. if (not MainForm.RealICQClient.UserPermission.EnableMultiSendSms) or (not MainForm.RealICQClient.UserPermission.EnableSendSms) then
  6563. begin
  6564. ShowMessage('您没有群发手机短信的权限!');
  6565. Exit;
  6566. end;
  6567. if FLVTeams.SelCount = 1 then
  6568. begin
  6569. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  6570. begin
  6571. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  6572. if ListItem.Selected then
  6573. begin
  6574. RealICQTeam := ListItem.Data;
  6575. OpenTeamSMSForm(RealICQTeam.TeamID);
  6576. Break;
  6577. end;
  6578. end;
  6579. end;
  6580. end;
  6581. procedure TMainForm.miSetRemarkClick(Sender: TObject);
  6582. var
  6583. LoginName: string;
  6584. Remark, MessageId, ParamValue: string;
  6585. RealICQUser: TRealICQUser;
  6586. Employee: TRealICQEmployee;
  6587. RealICQContacterTreeView: TRealICQContacterTreeView;
  6588. ItemIndex: Integer;
  6589. begin
  6590. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6591. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6592. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6593. LoginName := Employee.LoginName;
  6594. if LoginName <> '' then
  6595. begin
  6596. RealICQUser := GetAddrBookUser(Employee.BranchID, LoginName);
  6597. if RealICQUser = nil then
  6598. Exit;
  6599. Remark := RealICQUser.Remark;
  6600. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  6601. if not AnsiSameStr(Remark, RealICQUser.Remark) then//发送修改备注
  6602. begin
  6603. MessageId := IntToStr(GetTickCount);
  6604. CreateManageGroupMemberMessage(RealICQUser.LoginName, RealICQUser.DisplayName, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, Remark, Employee.BranchID, MessageId);
  6605. //发送修改联系人消息
  6606. RealICQUser.Remark := Remark;
  6607. LoginName := Employee.LoginName;
  6608. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6609. ParamValue := MessageId + #10 + LoginName + #10 + RealICQUser.DisplayName + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Watchword + #10 + Remark + #10 + Employee.BranchId;
  6610. MainForm.RealICQClient.SendAddrBookCommand(6, 1, ParamValue);
  6611. end;
  6612. end;
  6613. end;
  6614. //------------------------------------------------------------------------------
  6615. procedure TMainForm.miAddGroupClick(Sender: TObject);
  6616. var
  6617. ItemIndex, iLoop: Integer;
  6618. RealICQContacterTreeView: TRealICQContacterTreeView;
  6619. TmpBranch: TRealICQBranchInfo;
  6620. Branch: TRealICQBranch;
  6621. GroupName, ResultStr, SelBranchName: string;
  6622. ParamValue: string;
  6623. MessageId: string;
  6624. BranchNames, TmpList: TStringList;
  6625. Employee: TRealICQEmployee;
  6626. begin
  6627. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6628. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6629. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6630. if Branch = nil then
  6631. begin
  6632. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6633. if Employee <> nil then
  6634. Branch := Employee.Node.Parent.Data;
  6635. end;
  6636. if Branch <> nil then
  6637. SelBranchName := Branch.BranchName
  6638. else
  6639. SelBranchName := '我的通讯录';
  6640. BranchNames := TStringList.Create;
  6641. try
  6642. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6643. begin
  6644. TmpBranch := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6645. GroupName := '';
  6646. GetParentGroupNameList(TmpBranch, GroupName);
  6647. BranchNames.AddObject(GroupName, TmpBranch);
  6648. if TmpBranch.ID = Branch.BranchID then
  6649. SelBranchName := GroupName;
  6650. end;
  6651. ResultStr := ShowAddrGroupInputBox('新建组', SelBranchName, BranchNames);
  6652. if ResultStr = '' then
  6653. exit;
  6654. TmpList := SplitString(ResultStr, #10);
  6655. GroupName := TmpList[1];
  6656. if BranchNames.IndexOf(TmpList[0] + GroupName + '\') >= 0 then
  6657. begin
  6658. ShowMessage('已存在相同名称的组!');
  6659. Exit;
  6660. end;
  6661. TmpBranch := BranchNames.Objects[BranchNames.IndexOf(TmpList[0])] as TRealICQBranchInfo;
  6662. //发送添加通讯录组消息
  6663. MessageId := IntToStr(GetTickCount);
  6664. CreateManageGroupMessage(TmpBranch.ID, GroupName, TmpBranch.ParentID, MessageId);
  6665. ParamValue := MessageId + #10 + GroupName + #10 + '0' + #10 + TmpBranch.ID + #10 + MainForm.RealICQClient.Me.LoginName;
  6666. MainForm.RealICQClient.SendAddrBookCommand(1, 0, ParamValue);
  6667. finally
  6668. BranchNames.Free;
  6669. end;
  6670. end;
  6671. //---修改组----------------------------------------------------------
  6672. procedure TMainForm.miUpdateGroupClick(Sender: TObject);
  6673. var
  6674. ItemIndex: Integer;
  6675. RealICQContacterTreeView: TRealICQContacterTreeView;
  6676. Branch: TRealICQBranch;
  6677. GroupName, MessageId, ParamValue: string;
  6678. begin
  6679. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6680. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6681. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6682. if Branch <> nil then
  6683. begin
  6684. GroupName := Branch.BranchName;
  6685. if GroupName = '我的通讯录' then
  6686. begin
  6687. ShowMessage('默认组不允许修改!');
  6688. Exit;
  6689. end;
  6690. end
  6691. else
  6692. begin
  6693. ShowMessage('请选择要修改的组!');
  6694. Exit;
  6695. end;
  6696. GroupName := ShowMyInputBox('修改组', '组名称', GroupName, 500);
  6697. if (GroupName <> Branch.BranchName) and (GroupName <> '') then
  6698. begin
  6699. //发送修改通讯录组名消息
  6700. MessageId := IntToStr(GetTickCount);
  6701. CreateManageGroupMessage(Branch.BranchID, GroupName, Branch.ParentID, MessageId);
  6702. ParamValue := MessageId + #10 + GroupName + #10 + Branch.BranchID + #10 + Branch.ParentID + #10 + MainForm.RealICQClient.Me.LoginName;
  6703. MainForm.RealICQClient.SendAddrBookCommand(2, 0, ParamValue);
  6704. end;
  6705. end;
  6706. //-----删除通讯录组----------------------------------------------------
  6707. procedure TMainForm.miDelGroupClick(Sender: TObject);
  6708. var
  6709. ItemIndex: Integer;
  6710. RealICQContacterTreeView: TRealICQContacterTreeView;
  6711. Branch: TRealICQBranch;
  6712. GroupId: string;
  6713. ParamValue: string;
  6714. MessageId: string;
  6715. begin
  6716. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6717. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6718. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6719. GroupId := '';
  6720. if Branch <> nil then
  6721. begin
  6722. if Branch.ParentID = '0' then
  6723. begin
  6724. ShowMessage('默认组不可以删除');
  6725. Exit;
  6726. end;
  6727. if MessageBox(Handle, '确定要将选中的组删除吗?', '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  6728. Exit;
  6729. //发送删除通讯录组消息
  6730. MessageId := IntToStr(GetTickCount);
  6731. GetChildsGroupId(Branch.BranchID, GroupId);
  6732. CreateManageGroupMessage(GroupId, Branch.BranchName, Branch.ParentID, MessageId);
  6733. ParamValue := MessageId + #10 + GroupId + #10 + Branch.BranchID + #10 + Branch.ParentID + #10 + MainForm.RealICQClient.Me.LoginName;
  6734. MainForm.RealICQClient.SendAddrBookCommand(3, 0, ParamValue);
  6735. end
  6736. else
  6737. ShowMessage('请选择要删除的组!');
  6738. end;
  6739. //-----新增用户到通讯录---------------------------------------
  6740. procedure TMainForm.miAddGroupUserClick(Sender: TObject);
  6741. var
  6742. MessageId, ParamValue, BranchID: string;
  6743. Branch: TRealICQBranch;
  6744. TmpBranch: TRealICQBranchInfo;
  6745. Employee: TRealICQEmployee;
  6746. RealICQUser: TRealICQUser;
  6747. Node: TTreeNode;
  6748. ItemIndex, iLoop: Integer;
  6749. BranchNames: TStringList;
  6750. BranchName, GroupName: string;
  6751. RealICQContacterTreeView: TRealICQContacterTreeView;
  6752. begin
  6753. BranchName := '我的通讯录\';
  6754. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6755. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6756. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6757. if Branch = nil then
  6758. begin
  6759. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6760. if Employee <> nil then
  6761. begin
  6762. Node := Employee.Node.Parent;
  6763. Branch := Node.Data;
  6764. end;
  6765. end;
  6766. if Branch <> nil then
  6767. begin
  6768. if Branch.BranchName = '我的通讯录' then
  6769. begin
  6770. ShowMessage('默认组下面不允许添加联系人!');
  6771. Exit;
  6772. end;
  6773. BranchID := Branch.BranchID;
  6774. end;
  6775. if (GetGroupUserCount + 1) > MainForm.RealICQClient.UserPermission.AddrBookSize then
  6776. begin
  6777. ShowMessage('您的通讯录已满或者没有添加联系人的权限!' + #13 + '请联系系统管理员。');
  6778. Exit;
  6779. end;
  6780. BranchNames := TStringList.Create;
  6781. try
  6782. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6783. begin
  6784. TmpBranch := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6785. GroupName := '';
  6786. GetParentGroupNameList(TmpBranch, GroupName);
  6787. if TmpBranch.ID = BranchID then
  6788. BranchNames.InsertObject(0, GroupName, TmpBranch)
  6789. else
  6790. BranchNames.AddObject(GroupName, TmpBranch);
  6791. end;
  6792. //弹出新增联系人窗体
  6793. RealICQUser := TRealICQUser.Create('', RealICQClient);
  6794. if not ShowAddrUserInputBox('新增联系人', RealICQUser, BranchNames) then
  6795. Exit;
  6796. if Trim(RealICQUser.Nickname) = '' then
  6797. Exit;
  6798. MessageId := IntToStr(GetTickCount);
  6799. CreateManageGroupMemberMessage('', RealICQUser.Nickname, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, RealICQUser.Remark1, BranchID, MessageId);
  6800. //发送新增联系人消息
  6801. ParamValue := MessageId + #10 + '' + #10 + RealICQUser.Nickname + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Remark1 + #10 + RealICQUser.Remark + #10 + BranchID;
  6802. RealICQClient.SendAddrBookCommand(1, 1, ParamValue);
  6803. finally
  6804. BranchNames.Free;
  6805. end;
  6806. end;
  6807. procedure TMainForm.miBusyClick(Sender: TObject);
  6808. begin
  6809. FLoginState := stBusy;
  6810. FLeaveMessage := '忙碌';
  6811. SetLoginStateControlState;
  6812. end;
  6813. //-----------------------------------------------------------------
  6814. procedure TMainForm.miUpdateGroupUserClick(Sender: TObject);
  6815. var
  6816. ItemIndex, iLoop: Integer;
  6817. RealICQContacterTreeView: TRealICQContacterTreeView;
  6818. Employee: TRealICQEmployee;
  6819. BranchNames: TStringList;
  6820. Branch: TRealICQBranch;
  6821. RealICQUser: TRealICQUser;
  6822. LoginName: string;
  6823. ParamValue: string;
  6824. MessageId: string;
  6825. ParentNode: TTreeNode;
  6826. begin
  6827. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6828. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6829. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6830. if Employee <> nil then
  6831. begin
  6832. //弹出修改窗体
  6833. BranchNames := TStringList.Create;
  6834. try
  6835. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  6836. begin
  6837. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  6838. if Branch.BranchID = Employee.BranchID then
  6839. BranchNames.Insert(0, Branch.BranchName)
  6840. else
  6841. BranchNames.Add(Branch.BranchName);
  6842. end;
  6843. ParentNode := Employee.Node.Parent;
  6844. Branch := ParentNode.Data;
  6845. RealICQUser := GetAddrBookUser(Employee.BranchID, Employee.LoginName);
  6846. if not ShowAddrUserInputBox('查看/编辑联系人', RealICQUser, BranchNames) then
  6847. Exit;
  6848. MessageId := IntToStr(GetTickCount);
  6849. CreateManageGroupMemberMessage(RealICQUser.LoginName, RealICQUser.DisplayName, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, RealICQUser.Remark1, Employee.BranchID, MessageId);
  6850. //发送修改联系人消息
  6851. LoginName := Employee.LoginName;
  6852. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6853. 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;
  6854. MainForm.RealICQClient.SendAddrBookCommand(2, 1, ParamValue);
  6855. finally
  6856. BranchNames.Free;
  6857. end;
  6858. end
  6859. else
  6860. ShowMessage('请选择要修改的联系人!');
  6861. end;
  6862. //----删除联系人-------------------------------------------------------------
  6863. procedure TMainForm.miDelGroupUserClick(Sender: TObject);
  6864. var
  6865. ItemIndex: Integer;
  6866. RealICQContacterTreeView: TRealICQContacterTreeView;
  6867. Employee: TRealICQEmployee;
  6868. ParamValue: string;
  6869. MessageId, LoginName: string;
  6870. begin
  6871. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6872. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6873. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6874. if Employee = nil then
  6875. begin
  6876. ShowMessage('请选择要删除的联系人');
  6877. Exit
  6878. end;
  6879. //发送删除通讯录组联系人消息
  6880. MessageId := IntToStr(GetTickCount);
  6881. CreateManageGroupMemberMessage(Employee.LoginName, Employee.DisplayName, '', Employee.Mobile, '', '', '', Employee.BranchID, MessageId);
  6882. LoginName := Employee.LoginName;
  6883. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6884. ParamValue := MessageId + #10 + LoginName + #10 + Employee.DisplayName + #10 + Employee.Mobile + #10 + '' + #10 + '' + #10 + '' + #10 + '' + #10 + Employee.BranchId;
  6885. MainForm.RealICQClient.SendAddrBookCommand(3, 1, ParamValue);
  6886. end;
  6887. procedure TMainForm.spbExportGroupUserClick(Sender: TObject);
  6888. var
  6889. ItemIndex, iLoop, jLoop, IIndex: Integer;
  6890. RealICQContacterTreeView: TRealICQContacterTreeView;
  6891. Branch: TRealICQBranch;
  6892. RealICQUser: TRealICQUser;
  6893. BranchInfo: TRealICQBranchInfo;
  6894. GroupId: string;
  6895. begin
  6896. SD.Title := '导出通讯录另存为';
  6897. SD.Filter := 'CSV(*.csv)|*.csv';
  6898. CsvLines := TStringList.Create;
  6899. CommaStr := TStringList.Create;
  6900. CommaStr.CommaText := '姓名 手机 电话 电子邮箱 备注';
  6901. CsvLines.Add(CommaStr.CommaText);
  6902. MainForm.RealICQClient.OnGettedAddrBookUsers := GettedAddrBookUsers1;
  6903. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6904. if (ItemIndex < 0) then
  6905. Exit;
  6906. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6907. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6908. if Branch = nil then
  6909. begin
  6910. ShowMessage('请在通讯录中选择组!');
  6911. Exit;
  6912. end;
  6913. if Branch.BranchName = '我的通讯录' then
  6914. begin
  6915. ShowMessage('默认组下面不允许导出联系人!');
  6916. Exit;
  6917. end;
  6918. SD.FileName := Branch.BranchName + '.csv';
  6919. GetChildsGroupId(Branch.BranchID, GroupId);
  6920. MainForm.RealICQClient.ExAddrBookUsers.Clear;
  6921. while Pos(',', GroupId) > 0 do
  6922. begin
  6923. IIndex := Pos(',', GroupId);
  6924. MainForm.RealICQClient.SendGetAddrbookUser(Copy(GroupId, 1, IIndex - 1));
  6925. sleep(200);
  6926. Delete(GroupId, 1, IIndex);
  6927. end;
  6928. MainForm.RealICQClient.SendGetAddrbookUser(GroupId);
  6929. if SD.Execute then
  6930. begin
  6931. CsvLines.SaveToFile(SD.FileName);
  6932. end;
  6933. CsvLines.Free;
  6934. CommaStr.Free;
  6935. end;
  6936. procedure TMainForm.GettedAddrBookUsers1(Sender: TObject);
  6937. var
  6938. iLoop: integer;
  6939. RealICQUser: TRealICQUser;
  6940. BranchInfo: TRealICQBranchInfo;
  6941. begin
  6942. for iLoop := MainForm.RealICQClient.ExAddrBookUsers.Count - 1 downto 0 do
  6943. begin
  6944. RealICQUser := MainForm.RealICQClient.ExAddrBookUsers.Objects[iLoop] as TRealICQUser;
  6945. CommaStr.CommaText := AnsiRePlaceStr(RealICQUser.DisplayName, ' ', '') + ',' + RealICQUser.Mobile + ',' + RealICQUser.Tel + ',' + RealICQUser.Email + ',' + RealICQUser.Remark1;
  6946. CsvLines.Add(CommaStr.CommaText);
  6947. end;
  6948. MainForm.RealICQClient.ExAddrBookUsers.Clear;
  6949. end;
  6950. //-----导入联系人---------------------------------
  6951. procedure TMainForm.spbImportGroupUserClick(Sender: TObject);
  6952. var
  6953. ItemIndex: Integer;
  6954. RealICQContacterTreeView: TRealICQContacterTreeView;
  6955. Branch: TRealICQBranch;
  6956. begin
  6957. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6958. if (ItemIndex < 0) then
  6959. Exit;
  6960. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6961. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6962. if Branch = nil then
  6963. begin
  6964. ShowMessage('请在通讯录中选择组!');
  6965. Exit;
  6966. end;
  6967. if ImportGuideFrom = nil then
  6968. ImportGuideFrom := TImportGuideFrom.Create(self);
  6969. ImportGuideFrom.SelBranch := Branch;
  6970. ImportGuideFrom.Show;
  6971. ForceForeGroundWindow(ImportGuideFrom.Handle);
  6972. end;
  6973. //-----得到指定通讯录组的所有子节点ID----------------------------------
  6974. procedure TMainForm.GetChildsGroupId(GroupId: string; var Groups: string);
  6975. var
  6976. iLoop: Integer;
  6977. BranchInfo: TRealICQBranchInfo;
  6978. begin
  6979. if Groups <> '' then
  6980. Groups := Groups + ',';
  6981. Groups := Groups + GroupId;
  6982. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6983. begin
  6984. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6985. if BranchInfo.ParentID = GroupId then
  6986. GetChildsGroupId(BranchInfo.ID, Groups);
  6987. end;
  6988. end;
  6989. //----剪切-----------------------------------------------------------
  6990. procedure TMainForm.miCutClick(Sender: TObject);
  6991. var
  6992. ItemIndex: Integer;
  6993. Employee: TRealICQEmployee;
  6994. Branch: TRealICQBranch;
  6995. RealICQContacterTreeView: TRealICQContacterTreeView;
  6996. begin
  6997. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6998. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6999. if FCutNode <> nil then
  7000. begin
  7001. if FCutNode.StateIndex = 0 then
  7002. begin
  7003. Branch := FCutNode.Data;
  7004. Branch.IsCutState := False;
  7005. Branch.Update;
  7006. end
  7007. else
  7008. begin
  7009. Employee := FCutNode.Data;
  7010. Employee.IsCutState := False;
  7011. Employee.Update;
  7012. end;
  7013. end;
  7014. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7015. if Employee <> nil then
  7016. begin
  7017. Employee.IsCutState := True;
  7018. Employee.Update;
  7019. FCutNode := Employee.Node;
  7020. Exit;
  7021. end;
  7022. Branch := RealICQContacterTreeView.GetSelectedBranch;
  7023. if Branch <> nil then
  7024. begin
  7025. if Branch.BranchName = '我的通讯录' then
  7026. begin
  7027. ShowMessage('默认组不允许剪切!');
  7028. Exit;
  7029. end;
  7030. Branch.IsCutState := True;
  7031. Branch.Update;
  7032. FCutNode := Branch.Node;
  7033. end;
  7034. end;
  7035. //---粘贴------------------------------------------------------------
  7036. procedure TMainForm.miPasteClick(Sender: TObject);
  7037. var
  7038. ItemIndex, EmployeeCount, iLoop: Integer;
  7039. MessageId, ParamValue, LoginName: string;
  7040. Employee, TmpEmployee: TRealICQEmployee;
  7041. SelBranch, TmpBranch, Branch: TRealICQBranch;
  7042. RealICQContacterTreeView: TRealICQContacterTreeView;
  7043. ParentNode: TTreeNode;
  7044. RealICQUser: TRealICQUser;
  7045. begin
  7046. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7047. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7048. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7049. if Employee <> nil then
  7050. begin
  7051. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(Employee.BranchID);
  7052. SelBranch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7053. end
  7054. else
  7055. SelBranch := RealICQContacterTreeView.GetSelectedBranch;
  7056. if SelBranch = nil then
  7057. Exit;
  7058. if FCutNode.StateIndex = 0 then
  7059. begin
  7060. TmpBranch := FCutNode.Data;
  7061. //判断同一级别是否存在相同的部门
  7062. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  7063. begin
  7064. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  7065. if (Branch.ParentID = SelBranch.BranchID) and (Branch.BranchName = TmpBranch.BranchName) then
  7066. begin
  7067. ShowMessage('已存在名称相同的组!');
  7068. TmpBranch.IsCutState := False;
  7069. TmpBranch.Update;
  7070. FCutNode := nil;
  7071. Exit;
  7072. end;
  7073. end;
  7074. ParentNode := TmpBranch.Node.Parent;
  7075. TmpBranch.Node.MoveTo(SelBranch.Node, naAddChild);
  7076. TmpBranch.ParentID := SelBranch.BranchID;
  7077. TmpBranch.Node.Selected := True;
  7078. TmpBranch.IsCutState := False;
  7079. TmpBranch.Update;
  7080. MessageId := IntToStr(GetTickCount);
  7081. CreateManageGroupMessage(TmpBranch.BranchID, TmpBranch.BranchName, SelBranch.BranchID, MessageId);
  7082. //发送修改组的父级ID
  7083. ParamValue := MessageId + #10 + TmpBranch.BranchName + #10 + TmpBranch.BranchID + #10 + SelBranch.BranchID + #10 + MainForm.RealICQClient.Me.LoginName;
  7084. MainForm.RealICQClient.SendAddrBookCommand(4, 0, ParamValue);
  7085. EmployeeCount := TmpBranch.EmployeeCount;
  7086. while ParentNode <> nil do
  7087. begin
  7088. TmpBranch := ParentNode.Data;
  7089. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount - EmployeeCount;
  7090. TmpBranch.Update;
  7091. ParentNode := TmpBranch.Node.Parent;
  7092. end;
  7093. ParentNode := SelBranch.Node;
  7094. while ParentNode <> nil do
  7095. begin
  7096. TmpBranch := ParentNode.Data;
  7097. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount + EmployeeCount;
  7098. TmpBranch.Update;
  7099. ParentNode := TmpBranch.Node.Parent;
  7100. end;
  7101. end
  7102. else
  7103. begin
  7104. TmpEmployee := FCutNode.Data;
  7105. if GetAddrBookUserIndex(SelBranch.BranchID, TmpEmployee.LoginName) >= 0 then
  7106. begin
  7107. ShowMessage('已存在名称相同的联系人!');
  7108. TmpEmployee.IsCutState := False;
  7109. TmpEmployee.Update;
  7110. FCutNode := nil;
  7111. Exit;
  7112. end;
  7113. MessageId := IntToStr(GetTickCount);
  7114. CreateManageGroupMemberMessage(TmpEmployee.LoginName, TmpEmployee.DisplayName, '', TmpEmployee.Mobile, TmpEmployee.Tel, TmpEmployee.EmailHint, '', SelBranch.BranchID, MessageId);
  7115. //发送修改联系人所属组消息
  7116. LoginName := TmpEmployee.LoginName;
  7117. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  7118. ParamValue := MessageId + #10 + LoginName + #10 + TmpEmployee.DisplayName + #10 + TmpEmployee.Mobile + #10 + '' + #10 + '' + #10 + TmpEmployee.BranchID + #10 + '' + #10 + SelBranch.BranchId;
  7119. MainForm.RealICQClient.SendAddrBookCommand(5, 1, ParamValue);
  7120. end;
  7121. end;
  7122. //----得到父级的所有组名称---------------------------------------------
  7123. procedure TMainForm.GetParentGroupNameList(BranchInfo: TRealICQBranchInfo; var Groups: string);
  7124. var
  7125. iLoop: Integer;
  7126. TmpBranchInfo: TRealICQBranchInfo;
  7127. begin
  7128. Groups := BranchInfo.BranchName + '\' + Groups;
  7129. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7130. begin
  7131. TmpBranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7132. if BranchInfo.ParentID = TmpBranchInfo.ID then
  7133. GetParentGroupNameList(TmpBranchInfo, Groups);
  7134. end;
  7135. end;
  7136. //----创建管理组消息
  7137. procedure TMainForm.CreateManageGroupMessage(GroupId, GroupName, ParentId, MessageId: string);
  7138. var
  7139. ManageGroupMessage: TManageGroupMessage;
  7140. begin
  7141. ManageGroupMessage := TManageGroupMessage.Create;
  7142. ManageGroupMessage.MessageId := MessageId;
  7143. ManageGroupMessage.FGroupID := GroupId;
  7144. ManageGroupMessage.FGroupName := GroupName;
  7145. ManageGroupMessage.FParentID := ParentId;
  7146. FManageGroupMsgList.AddObject(ManageGroupMessage.MessageId, ManageGroupMessage);
  7147. end;
  7148. //----创建管理联系人消息
  7149. procedure TMainForm.CreateManageGroupMemberMessage(ID, DisplayName, NickName, Mobile, Tel, Email, Remark, GroupId, MessageId: string);
  7150. var
  7151. ManageGroupMemberMessage: TManageGroupMemberMessage;
  7152. begin
  7153. ManageGroupMemberMessage := TManageGroupMemberMessage.Create;
  7154. ManageGroupMemberMessage.MessageId := MessageId;
  7155. ManageGroupMemberMessage.FID := Id;
  7156. ManageGroupMemberMessage.FDisplayName := DisplayName;
  7157. ManageGroupMemberMessage.FNickName := NickName;
  7158. ManageGroupMemberMessage.FMobile := Mobile;
  7159. ManageGroupMemberMessage.FTel := Tel;
  7160. ManageGroupMemberMessage.FEmail := Email;
  7161. ManageGroupMemberMessage.FRemark := Remark;
  7162. ManageGroupMemberMessage.FGroupId := GroupId;
  7163. FManageGroupMemberMsgList.AddObject(ManageGroupMemberMessage.MessageId, ManageGroupMemberMessage);
  7164. end;
  7165. //----------------------------------------------------------
  7166. procedure TMainForm.GettedManageAddrBookResult(Sender: TObject; OperatModal: Integer; OperatCommand: Integer; RetValue, MessageId: Cardinal);
  7167. var
  7168. Branch: TRealICQBranch;
  7169. RealICQBranch: TRealICQBranchInfo;
  7170. RealICQUser, TmpRealICQUser: TRealICQUser;
  7171. TreeViewIndex, ItemIndex, iLoop, i, jLoop: Integer;
  7172. RealICQContacterTreeView: TRealICQContacterTreeView;
  7173. ManageGroupMessage: TManageGroupMessage;
  7174. ManageGroupMemberMsg: TManageGroupMemberMessage;
  7175. TmpList, TmpDelUsers: TStringList;
  7176. Employee, TmpEmployee: TRealICQEmployee;
  7177. ErrMsg, TmpUsers: string;
  7178. begin
  7179. try
  7180. TreeViewIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7181. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[TreeViewIndex] as TRealICQContacterTreeView;
  7182. if RetValue = -1 then
  7183. begin
  7184. case OperatCommand of
  7185. 1:
  7186. ErrMsg := '新建';
  7187. 2:
  7188. ErrMsg := '修改';
  7189. 3:
  7190. ErrMsg := '删除';
  7191. 4:
  7192. ErrMsg := '批量添加';
  7193. end;
  7194. if OperatModal = 0 then
  7195. begin
  7196. if OperatCommand = 4 then
  7197. ErrMsg := '粘贴';
  7198. ErrMsg := ErrMsg + '组失败';
  7199. end
  7200. else
  7201. begin
  7202. ErrMsg := ErrMsg + '联系人失败';
  7203. if OperatCommand = 5 then
  7204. ErrMsg := '粘贴联系人失败';
  7205. if OperatCommand = 6 then
  7206. ErrMsg := '修改联系人备注失败';
  7207. end;
  7208. ShowMessage(ErrMsg);
  7209. Exit;
  7210. end;
  7211. if OperatModal = 0 then //对组操作
  7212. begin
  7213. i := FManageGroupMsgList.IndexOf(IntToStr(MessageId));
  7214. ManageGroupMessage := FManageGroupMsgList.Objects[i] as TManageGroupMessage;
  7215. case OperatCommand of
  7216. 1:
  7217. begin //增加组
  7218. Branch := TRealICQBranch.Create(ManageGroupMessage.FGroupName);
  7219. Branch.BranchID := IntToStr(RetValue);
  7220. Branch.ParentID := ManageGroupMessage.FGroupID;
  7221. RealICQBranch := TRealICQBranchInfo.Create;
  7222. RealICQBranch.ID := IntToStr(RetValue);
  7223. RealICQBranch.ParentID := ManageGroupMessage.FGroupID;
  7224. RealICQBranch.BranchName := ManageGroupMessage.FGroupName;
  7225. RealICQContacterTreeView.AddBranch(Branch);
  7226. MainForm.RealICQClient.AddrBookGroups.AddObject(RealICQBranch.ID, RealICQBranch);
  7227. Branch.Node.Selected := True;
  7228. end;
  7229. 2:
  7230. begin //修改组
  7231. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(ManageGroupMessage.FGroupID);
  7232. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7233. Branch.BranchName := ManageGroupMessage.FGroupName;
  7234. Branch.Update;
  7235. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(ManageGroupMessage.FGroupID);
  7236. RealICQBranch := MainForm.RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7237. RealICQBranch.BranchName := ManageGroupMessage.FGroupName;
  7238. end;
  7239. 3:
  7240. begin //删除组
  7241. try
  7242. TmpList := SplitString(ManageGroupMessage.FGroupID, ',');
  7243. for iLoop := 0 to TmpList.Count - 1 do
  7244. begin
  7245. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(TmpList[iLoop]);
  7246. if ItemIndex >= 0 then
  7247. begin
  7248. MainForm.RealICQClient.AddrBookGroups.Delete(ItemIndex);
  7249. ItemIndex := GetGroupUsers(TmpList[iLoop]);
  7250. while ItemIndex >= 0 do
  7251. begin
  7252. MainForm.RealICQClient.AddrBookUsers.Delete(ItemIndex);
  7253. ItemIndex := GetGroupUsers(TmpList[iLoop]);
  7254. end;
  7255. end;
  7256. end;
  7257. RealICQContacterTreeView.Clear;
  7258. FreeAndNil(RealICQContacterTreeView);
  7259. MainForm.ContacterTreeViews.Delete(TreeViewIndex);
  7260. MainForm.AddContacterTreeView(ScrollBoxAddrBook, LVAddrBook);
  7261. LoadAddrBook(ManageGroupMessage.FParentId);
  7262. TreeViewIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7263. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[TreeViewIndex] as TRealICQContacterTreeView;
  7264. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(ManageGroupMessage.FParentID);
  7265. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7266. while Branch.ParentID <> '0' do
  7267. begin
  7268. NodeGroupClick(nil, Branch);
  7269. Branch := Branch.Node.Parent.Data;
  7270. end;
  7271. finally
  7272. if TmpList <> nil then
  7273. TmpList.Free;
  7274. if TmpDelUsers <> nil then
  7275. TmpDelUsers.Free;
  7276. end;
  7277. end;
  7278. 4:
  7279. begin //剪切粘贴
  7280. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(ManageGroupMessage.FGroupID);
  7281. RealICQBranch := MainForm.RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7282. RealICQBranch.ParentID := ManageGroupMessage.FParentID;
  7283. end;
  7284. end;
  7285. FManageGroupMsgList.Delete(i);
  7286. end
  7287. else //对联系人操作
  7288. begin
  7289. i := FManageGroupMemberMsgList.IndexOf(IntToStr(MessageId));
  7290. ManageGroupMemberMsg := FManageGroupMemberMsgList.Objects[i] as TManageGroupMemberMessage;
  7291. case OperatCommand of
  7292. 1:
  7293. begin //新增联系人
  7294. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7295. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7296. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + 1;
  7297. //---------------------------------------------
  7298. RealICQUser := TRealICQUser.Create(IntToStr(RetValue), MainForm.RealICQClient);
  7299. RealICQUser.LoginName := IntToStr(RetValue);
  7300. RealICQUser.DisplayName := ManageGroupMemberMsg.FDisplayName;
  7301. RealICQUser.Remark := ManageGroupMemberMsg.FNickName;
  7302. RealICQUser.Mobile := ManageGroupMemberMsg.FMobile;
  7303. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7304. RealICQUser.Tel := ManageGroupMemberMsg.FTel;
  7305. RealICQUser.Email := ManageGroupMemberMsg.FEmail;
  7306. RealICQUser.Remark1 := ManageGroupMemberMsg.FRemark;
  7307. MainForm.RealICQClient.AddrBookUsers.AddObject(RealICQUser.LoginName, RealICQUser);
  7308. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7309. Employee.BranchID := RealICQUser.BranchID;
  7310. Employee.DisplayName := RealICQUser.DisplayName;
  7311. Employee.Mobile := RealICQUser.Mobile;
  7312. Employee.HasSMS := (Length(RealICQUser.Mobile) > 0);
  7313. Employee.SMSHint := RealICQUser.Mobile;
  7314. Employee.HasEmail := False;
  7315. Employee.HasAddFreindButton := False;
  7316. RealICQContacterTreeView.AddEmployee(Employee);
  7317. Employee.Node.Selected := True;
  7318. end;
  7319. 2:
  7320. begin //修改联系人
  7321. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7322. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7323. Employee.DisplayName := ManageGroupMemberMsg.FDisplayName;
  7324. Employee.Mobile := ManageGroupMemberMsg.FMobile;
  7325. Employee.SMSHint := ManageGroupMemberMsg.FMobile;
  7326. Employee.HasSMS := (Length(ManageGroupMemberMsg.FMobile) > 0);
  7327. Employee.Update;
  7328. end;
  7329. 3:
  7330. begin //删除联系人
  7331. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7332. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7333. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount - 1;
  7334. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7335. if ItemIndex >= 0 then
  7336. begin
  7337. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7338. RealICQUser := GetAddrBookUser(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7339. RealICQClient.AddrBookUsers.Delete(RealICQClient.AddrBookUsers.IndexOfObject(RealICQUser));
  7340. end;
  7341. end;
  7342. 4:
  7343. begin //批量添加联系人
  7344. TmpList := SplitString(ManageGroupMemberMsg.FId, ',');
  7345. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7346. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7347. RealICQBranch.IsGetUserList := True;
  7348. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + TmpList.Count;
  7349. for iLoop := 0 to TmpList.Count - 1 do
  7350. begin
  7351. if GetAddrBookUser(ManageGroupMemberMsg.FGroupId, TmpList[iLoop]) = nil then
  7352. begin
  7353. ItemIndex := MainForm.RealICQClient.MoreUsers.IndexOf(TmpList[iLoop]);
  7354. if ItemIndex >= 0 then
  7355. RealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser
  7356. else
  7357. begin
  7358. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(TmpList[iLoop]);
  7359. end;
  7360. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7361. Employee.BranchID := ManageGroupMemberMsg.FGroupId;
  7362. Employee.DisplayName := RealICQUser.DisplayName;
  7363. Employee.Mobile := RealICQUser.Mobile;
  7364. Employee.HasSMS := (Length(RealICQUser.Mobile) > 0);
  7365. Employee.EmailHint := RealICQUser.Email;
  7366. Employee.SMSHint := RealICQUser.Mobile;
  7367. Employee.HasEmail := False;
  7368. Employee.HasAddFreindButton := False;
  7369. RealICQContacterTreeView.AddEmployee(Employee);
  7370. Employee.Node.Selected := True;
  7371. end;
  7372. end;
  7373. for iLoop := TmpList.Count - 1 downto 0 do
  7374. begin
  7375. ItemIndex := MainForm.RealICQClient.MoreUsers.IndexOf(TmpList[iLoop]);
  7376. if ItemIndex >= 0 then
  7377. RealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser
  7378. else
  7379. begin
  7380. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(TmpList[iLoop]);
  7381. end;
  7382. TmpRealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser;
  7383. RealICQUser := TRealICQUser.Create(TmpList[iLoop], RealICQClient);
  7384. RealICQUser.LoginName := TmpRealICQUser.LoginName;
  7385. RealICQUser.DisplayName := TmpRealICQUser.DisplayName;
  7386. RealICQUser.Mobile := TmpRealICQUser.Mobile;
  7387. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7388. RealICQUser.Tel := TmpRealICQUser.Tel;
  7389. //RealICQUser.Email:=RealICQUser.EmailHint;
  7390. MainForm.RealICQClient.AddrBookUsers.AddObject(RealICQUser.LoginName, RealICQUser);
  7391. end;
  7392. end;
  7393. 5:
  7394. begin
  7395. TmpEmployee := FCutNode.Data;
  7396. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7397. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7398. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + 1;
  7399. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(TmpEmployee.BranchID);
  7400. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7401. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount - 1;
  7402. ItemIndex := GetAddrBookUserIndex(TmpEmployee.BranchID, TmpEmployee.LoginName);
  7403. Employee := TRealICQEmployee.Create(TmpEmployee.LoginName);
  7404. Employee.BranchID := ManageGroupMemberMsg.FGroupId;
  7405. Employee.DisplayName := TmpEmployee.DisplayName;
  7406. Employee.Tel := TmpEmployee.Tel;
  7407. Employee.Mobile := TmpEmployee.Mobile;
  7408. RealICQContacterTreeView.AddEmployee(Employee);
  7409. RealICQUser := GetAddrBookUser(TmpEmployee.BranchID, TmpEmployee.LoginName);
  7410. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7411. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7412. Employee.Node.Selected := True;
  7413. end;
  7414. 6:
  7415. begin
  7416. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7417. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7418. if Employee <> nil then
  7419. begin
  7420. Employee.DisplayName := ManageGroupMemberMsg.FRemark;
  7421. Employee.Update;
  7422. end;
  7423. end;
  7424. end;
  7425. FManageGroupMemberMsgList.Delete(i);
  7426. end;
  7427. finally
  7428. if FCutNode <> nil then
  7429. FCutNode := nil;
  7430. end;
  7431. end;
  7432. //------得到联系人-----------------------------
  7433. function TMainForm.GetAddrBookUser(GroupId, LoginName: string): TRealICQUser;
  7434. var
  7435. iLoop: Integer;
  7436. RealICQUser: TRealICQUser;
  7437. begin
  7438. Result := nil;
  7439. for iLoop := 0 to MainForm.RealICQClient.AddrBookUsers.Count - 1 do
  7440. begin
  7441. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7442. if (RealICQUser.BranchID = GroupId) and (RealICQUser.LoginName = LoginName) then
  7443. begin
  7444. Result := RealICQUser;
  7445. Break;
  7446. end;
  7447. end;
  7448. end;
  7449. //------得到联系人的下标------------------------------
  7450. function TMainForm.GetAddrBookUserIndex(GroupId, LoginName: string): Integer;
  7451. var
  7452. iLoop: Integer;
  7453. Employee: TRealICQEmployee;
  7454. RealICQContacterTreeView: TRealICQContacterTreeView;
  7455. begin
  7456. Result := -1;
  7457. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[MainForm.ContacterTreeViews.IndexOf(LVAddrBook)] as TRealICQContacterTreeView;
  7458. for iLoop := 0 to RealICQContacterTreeView.EmployeeItems.Count - 1 do
  7459. begin
  7460. Employee := RealICQContacterTreeView.EmployeeItems.Objects[iLoop] as TRealICQEmployee;
  7461. if (Employee.BranchID = GroupId) and (Employee.LoginName = LoginName) then
  7462. begin
  7463. Result := iLoop;
  7464. break;
  7465. end;
  7466. end;
  7467. end;
  7468. //-----得到联系人总的人数------------------
  7469. function TMainForm.GetGroupUserCount: Integer;
  7470. var
  7471. iLoop, ItemIndex: Integer;
  7472. TmpBranch: TRealICQBranch;
  7473. RealICQContacterTreeView: TRealICQContacterTreeView;
  7474. begin
  7475. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7476. if ItemIndex < 0 then
  7477. Exit;
  7478. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7479. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  7480. begin
  7481. TmpBranch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  7482. if TmpBranch.ParentID = '0' then
  7483. begin
  7484. Result := TmpBranch.EmployeeCount;
  7485. break;
  7486. end;
  7487. end;
  7488. end;
  7489. //-------------------------显示联系人-------
  7490. procedure TMainForm.GettedAddrBookUsers(Sender: TObject);
  7491. var
  7492. iLoop, ItemIndex: Integer;
  7493. RealICQContacterTreeView: TRealICQContacterTreeView;
  7494. RealICQUser: TRealICQUser;
  7495. TmpBranch: TRealICQBranch;
  7496. Employee: TRealICQEmployee;
  7497. ParentNode: TTreeNode;
  7498. BranchInfo: TRealICQBranchInfo;
  7499. begin
  7500. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7501. if ItemIndex < 0 then
  7502. Exit;
  7503. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7504. RealICQContacterTreeView.AdjustPosition := False;
  7505. RealICQContacterTreeView.HideSystemScrollBar;
  7506. RealICQContacterTreeView.BeginUpdate;
  7507. TmpBranch := nil;
  7508. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载联系人');
  7509. if ItemIndex >= 0 then
  7510. begin
  7511. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7512. TmpBranch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(Employee.BranchID)] as TRealICQBranch;
  7513. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7514. BranchInfo := RealICQClient.AddrBookGroups.Objects[RealICQClient.AddrBookGroups.IndexOf(TmpBranch.BranchID)] as TRealICQBranchInfo;
  7515. BranchInfo.IsGetUserList := True;
  7516. end;
  7517. {$region '添加联系人'}
  7518. for iLoop := MainForm.RealICQClient.AddrBookUsers.Count - 1 downto 0 do
  7519. begin
  7520. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7521. if GetAddrBookUserIndex(RealICQUser.BranchID, RealICQUser.LoginName) >= 0 then
  7522. Continue;
  7523. if RealICQUser.BranchID <> TmpBranch.BranchID then
  7524. Continue;
  7525. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7526. Employee.BranchID := RealICQUser.BranchID;
  7527. Employee.Mobile := RealICQUser.Mobile;
  7528. Employee.HasSMS := Length(RealICQUser.Mobile) > 0;
  7529. Employee.SMSHint := RealICQUser.Mobile;
  7530. Employee.HasEmail := False;
  7531. if Trim(RealICQUser.Remark) <> '' then
  7532. Employee.DisplayName := RealICQUser.Remark
  7533. else
  7534. Employee.DisplayName := RealICQUser.DisplayName;
  7535. Employee.HasAddFreindButton := False;
  7536. RealICQContacterTreeView.AddEmployee(Employee);
  7537. end;
  7538. {$endregion}
  7539. if TmpBranch <> nil then
  7540. begin
  7541. ParentNode := TmpBranch.Node;
  7542. while ParentNode <> nil do
  7543. begin
  7544. ParentNode.Expanded := True;
  7545. ParentNode := ParentNode.Parent;
  7546. end;
  7547. TmpBranch.Node.Selected := True;
  7548. TmpBranch.IsGetUserList := True;
  7549. end;
  7550. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  7551. RealICQContacterTreeView.MoveScrollBarToTop;
  7552. RealICQContacterTreeView.EndUpdate;
  7553. end;
  7554. //----------显示组-------------------------
  7555. procedure TMainForm.GettedAddrBookGroups(Sender: TObject);
  7556. begin
  7557. LoadAddrBook('0');
  7558. end;
  7559. //-------------------------------------------------------------------------
  7560. procedure TMainForm.LoadAddrBook(ExpandGroupId: string);
  7561. var
  7562. iLoop, ItemIndex: Integer;
  7563. RealICQContacterTreeView: TRealICQContacterTreeView;
  7564. RealICQUser: TRealICQUser;
  7565. BranchInfo: TRealICQBranchInfo;
  7566. Branch, TmpBranch: TRealICQBranch;
  7567. Employee: TRealICQEmployee;
  7568. ParentNode: TTreeNode;
  7569. BranchId: string;
  7570. OnlineEmployee, EmployeeCount: Integer;
  7571. begin
  7572. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7573. if ItemIndex < 0 then
  7574. Exit;
  7575. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7576. RealICQContacterTreeView.OnItemOnline := nil;
  7577. RealICQContacterTreeView.OnItemOffline := nil;
  7578. RealICQContacterTreeView.OnItemIconButtonClick := nil;
  7579. RealICQContacterTreeView.OnItemMouseEnter := nil;
  7580. RealICQContacterTreeView.OnItemMouseLeave := nil;
  7581. RealICQContacterTreeView.ShowOnlineNumber := False;
  7582. RealICQContacterTreeView.ShowLoginState := False;
  7583. RealICQContacterTreeView.PopupMenu := ppAddrbookList;
  7584. RealICQContacterTreeView.AdjustPosition := False;
  7585. RealICQContacterTreeView.HideSystemScrollBar;
  7586. RealICQContacterTreeView.BeginUpdate;
  7587. TmpBranch := nil;
  7588. {$region '添加组'}
  7589. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7590. begin
  7591. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7592. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  7593. Continue;
  7594. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  7595. Branch.BranchID := BranchInfo.ID;
  7596. Branch.ParentID := BranchInfo.ParentID;
  7597. Branch.IsGetUserList := False;
  7598. OnlineEmployee := 0;
  7599. EmployeeCount := 0;
  7600. GetBranchEmpOnlineAndSum(RealICQClient.AddrBookGroups, BranchInfo, OnlineEmployee, EmployeeCount);
  7601. Branch.EmployeeCount := EmployeeCount;
  7602. Branch.OnlineEmployee := 0;
  7603. RealICQContacterTreeView.AddBranch(Branch);
  7604. if ExpandGroupId = '0' then
  7605. begin
  7606. BranchId := Branch.ParentID;
  7607. end
  7608. else
  7609. BranchId := Branch.BranchID;
  7610. if BranchId = ExpandGroupId then
  7611. begin
  7612. TmpBranch := Branch;
  7613. end;
  7614. end;
  7615. RealICQContacterTreeView.ReAlignBranchs;
  7616. {$endregion}
  7617. if TmpBranch <> nil then
  7618. begin
  7619. ParentNode := TmpBranch.Node;
  7620. while ParentNode <> nil do
  7621. begin
  7622. ParentNode.Expanded := True;
  7623. ParentNode := ParentNode.Parent;
  7624. end;
  7625. TmpBranch.Node.Selected := True;
  7626. end;
  7627. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  7628. RealICQContacterTreeView.MoveScrollBarToTop;
  7629. RealICQContacterTreeView.EndUpdate;
  7630. ScrollBoxAddrBook.Visible := True;
  7631. end;
  7632. //----------------------------------------------
  7633. procedure TMainForm.NodeGroupClick(Sender: TObject; Group: TRealICQBranch);
  7634. var
  7635. RealICQContacterTreeView: TRealICQContacterTreeView;
  7636. ItemIndex: Integer;
  7637. Employee: TRealICQEmployee;
  7638. BranchInfo: TRealICQBranchInfo;
  7639. begin
  7640. //-------获取指定部门下的用户------------------------------------------------
  7641. if (not Group.IsGetUserList) and (Group.Node.Parent <> nil) then
  7642. begin
  7643. MainForm.RealICQClient.OnGettedAddrBookUsers := GettedAddrBookUsers;
  7644. ItemIndex := FContacterTreeViews.IndexOf(LVAddrBook);
  7645. if ItemIndex < 0 then
  7646. exit;
  7647. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7648. if RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载联系人') < 0 then
  7649. begin
  7650. RealICQContacterTreeView.ReCalculateEmployeeCount(Group);
  7651. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[MainForm.RealICQClient.AddrBookGroups.IndexOf(Group.BranchID)] as TRealICQBranchInfo;
  7652. Employee := TRealICQEmployee.Create('正在下载联系人');
  7653. Employee.BranchID := Group.BranchID;
  7654. RealICQContacterTreeView.AddEmployee(Employee);
  7655. if (BranchInfo.IsGetUserList) then
  7656. begin
  7657. GettedAddrBookUsers(nil);
  7658. end
  7659. else
  7660. begin
  7661. MainForm.RealICQClient.SendGetAddrbookUser(Group.BranchID);
  7662. end;
  7663. end;
  7664. Group.Node.Expanded := True;
  7665. end;
  7666. end;
  7667. //---------------------------------------------------------------------------
  7668. function TMainForm.GetGroupUsers(GroupId: string): Integer;
  7669. var
  7670. iLoop: Integer;
  7671. RealICQUser: TRealICQUser;
  7672. begin
  7673. Result := -1;
  7674. for iLoop := 0 to MainForm.RealICQClient.AddrBookUsers.Count - 1 do
  7675. begin
  7676. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7677. if RealICQUser.BranchID = GroupId then
  7678. begin
  7679. Result := iLoop;
  7680. end;
  7681. end;
  7682. end;
  7683. {通讯录}
  7684. procedure TMainForm.tsCustomerServiceContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
  7685. begin
  7686. end;
  7687. //------------
  7688. procedure TMainForm.tsNetWorkDiskShow(Sender: TObject);
  7689. begin
  7690. if RealICQClient.NetWorkDiskServerPort <= 0 then
  7691. begin
  7692. lblNDState.Caption := '没有服务器';
  7693. end
  7694. else
  7695. begin
  7696. if (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) then
  7697. begin
  7698. spbNDConnectClick(spbNDConnect);
  7699. end
  7700. else if not AnsiSameText(RealICQNetWorkDiskClient.LoginName, RealICQClient.LoginName) then
  7701. begin
  7702. RealICQNetWorkDiskClient.Logout;
  7703. spbNDConnectClick(spbNDConnect);
  7704. end;
  7705. end;
  7706. end;
  7707. //------------------------------------------------------------------------------
  7708. procedure TMainForm.WebBrowserAddrBookBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7709. begin
  7710. //
  7711. end;
  7712. procedure TMainForm.WebBrowserAddrBookDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  7713. begin
  7714. //
  7715. end;
  7716. procedure TMainForm.WebBrowserForAdvertisementBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7717. begin
  7718. if not AnsiSameText(URL, MainForm.RealICQClient.MainFormAdversement.URL) then
  7719. begin
  7720. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar('"' + string(URL) + '"'), '', SW_SHOWNORMAL);
  7721. Cancel := True;
  7722. end;
  7723. end;
  7724. //------------------------------------------------------------------------------
  7725. procedure TMainForm.WebBrowserForAdvertisementDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  7726. begin
  7727. try
  7728. WebBrowserForAdvertisement.OnDocumentComplete := nil;
  7729. WebBrowserForAdvertisement.OnBeforeNavigate2 := WebBrowserForAdvertisementBeforeNavigate2;
  7730. SetDomStyle(WebBrowserForAdvertisement.Document as IHtmlDocument2);
  7731. except
  7732. end;
  7733. pnlForHideWebBrowser.Visible := False;
  7734. pnlAdvertisement.Top := pnlWebSearch.Top - 1;
  7735. pnlAdvertisement.Height := RealICQClient.MainFormAdversement.Height + 2;
  7736. pnlWebSearch.Top := pnlAdvertisement.Top + pnlAdvertisement.Height + 1;
  7737. ClearMemory;
  7738. end;
  7739. //------------------------------------------------------------------------------
  7740. procedure TMainForm.WebBrowserForContactersBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7741. var
  7742. NewUrl: string;
  7743. Args: string;
  7744. ArgList: TStringList;
  7745. AForm: TForm;
  7746. index: Integer;
  7747. begin
  7748. NewUrl := URL;
  7749. if AnsiSameText(Copy(NewUrl, 1, 18), 'OpenTalkingForm://') then
  7750. begin
  7751. Cancel := True;
  7752. Args := Copy(NewUrl, 19, Length(NewUrl) - 19);
  7753. if AnsiSameText(Args, RealICQClient.Me.LoginName) then
  7754. begin
  7755. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  7756. Exit;
  7757. end;
  7758. OpenTalkingForm(Args, True);
  7759. Exit;
  7760. end;
  7761. if AnsiSameText(Copy(NewUrl, 1, 12), 'AddFriend://') then
  7762. begin
  7763. Cancel := True;
  7764. Args := Copy(NewUrl, 13, Length(NewUrl) - 13);
  7765. if AnsiSameText(Args, RealICQClient.Me.LoginName) then
  7766. begin
  7767. MessageBox(Handle, '对不起,不可以加自己为好友!', '提示', MB_ICONINFORMATION);
  7768. Exit;
  7769. end;
  7770. if TUsersService.GetUsersService.IsWorkmateOrFriend(Args) then
  7771. begin
  7772. MessageBox(Handle, PChar('用户 ' + Args + ' 已在您的好友列表中!'), '提示', MB_ICONINFORMATION);
  7773. Exit;
  7774. end;
  7775. ShowAddFriendWindow(Self, Args, '');
  7776. Exit;
  7777. end;
  7778. end;
  7779. //------------------------------------------------------------------------------
  7780. procedure TMainForm.ppLanguagesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  7781. begin
  7782. ChangePPMenuColorMap(ppLanguages.PopupMenu);
  7783. end;
  7784. //------------------------------------------------------------------------------
  7785. procedure TMainForm.miLanguageClick(Sender: TObject);
  7786. var
  7787. MenuItem: TMenuItem;
  7788. begin
  7789. MenuItem := Sender as TMenuItem;
  7790. ChangeLanguage(ExtractFilePath(Application.ExeName) + 'Languages\' + AnsiReplaceStr(MenuItem.Caption, '&', '') + '.ini');
  7791. end;
  7792. procedure TMainForm.miLeaveClick(Sender: TObject);
  7793. begin
  7794. FLoginState := stLeave;
  7795. FLeaveMessage := '离开';
  7796. SetLoginStateControlState;
  7797. end;
  7798. //------------------------------------------------------------------------------
  7799. procedure TMainForm.ppLanguagesPopup(Sender: TObject);
  7800. var
  7801. MenuItem: TMenuItem;
  7802. procedure FindLanguages(APath: string);
  7803. var
  7804. DSearchRec: TSearchRec;
  7805. FindResult: Integer;
  7806. begin
  7807. ppLanguages.Items.Clear;
  7808. FindResult := FindFirst(APath + '*.ini', faAnyFile, DSearchRec);
  7809. while FindResult = 0 do
  7810. begin
  7811. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  7812. if (DSearchRec.Attr and faDirectory) <> faDirectory then
  7813. begin
  7814. MenuItem := TMenuItem.Create(ppLanguages);
  7815. MenuItem.AutoHotkeys := maManual;
  7816. MenuItem.AutoLineReduction := maManual;
  7817. MenuItem.Caption := AnsiReplaceText(DSearchRec.Name, '.ini', '') + '&';
  7818. MenuItem.OnClick := miLanguageClick;
  7819. MenuItem.RadioItem := True;
  7820. MenuItem.AutoCheck := True;
  7821. MenuItem.Enabled := Language <> AnsiReplaceText(DSearchRec.Name, '.ini', '');
  7822. MenuItem.Checked := Language = AnsiReplaceText(DSearchRec.Name, '.ini', '');
  7823. ppLanguages.Items.Insert(0, MenuItem);
  7824. end;
  7825. FindResult := FindNext(DSearchRec);
  7826. end;
  7827. end;
  7828. begin
  7829. FindLanguages(ExtractFilePath(Application.ExeName) + 'Languages\');
  7830. end;
  7831. //------------------------------------------------------------------------------
  7832. procedure TMainForm.Post(stURL, stPostData: string; var wbWebBrowser: TWebBrowser);
  7833. var
  7834. vWebAddr, vPostData, vFlags, vFrame, vHeaders: OleVariant;
  7835. iLoop: Integer;
  7836. begin
  7837. {Are we posting data to this Url?}
  7838. if Length(stPostData) > 0 then
  7839. begin
  7840. {头信息当PostData使.}
  7841. vHeaders := 'Content-Type: application/x-www-form-urlencoded' + #10#13#0;
  7842. vPostData := VarArrayCreate([0, Length(stPostData)], varByte);
  7843. for iLoop := 0 to Length(stPostData) - 1 do
  7844. begin
  7845. vPostData[iLoop] := Ord(stPostData[iLoop + 1]);
  7846. end;
  7847. {结束字符}
  7848. vPostData[Length(stPostData)] := 0;
  7849. {Set the type of Variant, cast}
  7850. TVarData(vPostData).vType := varArray;
  7851. end;
  7852. vWebAddr := stURL;
  7853. wbWebBrowser.Navigate2(vWebAddr, vFlags, vFrame, vPostData, vHeaders);
  7854. end;
  7855. //------------------------------------------------------------------------------
  7856. procedure TMainForm.ChangeLanguage(ALanguageIniFile: string);
  7857. var
  7858. IniFile: TIniFile;
  7859. iLoop: Integer;
  7860. OldLVAddrbook, OldLVSystemMessage, OldLVMyContacters, OldLVMoreUsers, OldLVFriends, OldLVStrangers, OldLVBlacklists, OldLVLatests, OldLVTeams, OldLVSearch: string;
  7861. begin
  7862. inherited ChangeLanguage(ALanguageIniFile);
  7863. RealICQClient.ChangeLanguage(ALanguageIniFile);
  7864. IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Languages\' + Language + '.ini');
  7865. try
  7866. {$region}
  7867. with IniFile do
  7868. begin
  7869. OldLVSystemMessage := LVSystemMessage;
  7870. OldLVMyContacters := LVMyContacters;
  7871. OldLVFriends := LVFriends;
  7872. OldLVStrangers := LVStrangers;
  7873. OldLVBlacklists := LVBlacklists;
  7874. OldLVLatests := LVLatests;
  7875. OldLVTeams := LVTeams;
  7876. OldLVSearch := LVSearch;
  7877. OldLVMoreUsers := LVMoreUsers;
  7878. OldLVAddrbook := LvAddrbook;
  7879. LVSystemMessage := FilterStr(ReadString(string(Self.ClassName), 'LVSystemMessage', ''));
  7880. LVMyContacters := FilterStr(ReadString(string(Self.ClassName), 'LVMyContacters', ''));
  7881. LVMoreUsers := FilterStr(ReadString(string(Self.ClassName), 'LVMoreUser', ''));
  7882. LVFriends := FilterStr(ReadString(string(Self.ClassName), 'LVFriends', ''));
  7883. LVStrangers := FilterStr(ReadString(string(Self.ClassName), 'LVStrangers', ''));
  7884. LVBlacklists := FilterStr(ReadString(string(Self.ClassName), 'LVBlacklists', ''));
  7885. LVLatests := FilterStr(ReadString(string(Self.ClassName), 'LVLatests', ''));
  7886. LVTeams := FilterStr(ReadString(string(Self.ClassName), 'LVTeams', ''));
  7887. LVSearch := FilterStr(ReadString(string(Self.ClassName), 'LVSearch', ''));
  7888. LVAddrbook := FilterStr(ReadString(string(Self.ClassName), 'LVAddrbook', ''));
  7889. end;
  7890. {$endregion}
  7891. finally
  7892. FreeAndNil(IniFile);
  7893. end;
  7894. edWebSearchKeyWordExit(nil);
  7895. for iLoop := 0 to FContacterListViews.Count - 1 do
  7896. begin
  7897. if AnsiSameStr(OldLVSystemMessage, FContacterListViews.Strings[iLoop]) then
  7898. FContacterListViews.Strings[iLoop] := LVSystemMessage;
  7899. if AnsiSameStr(OldLVMyContacters, FContacterListViews.Strings[iLoop]) then
  7900. FContacterListViews.Strings[iLoop] := LVMyContacters;
  7901. if AnsiSameStr(OldLVFriends, FContacterListViews.Strings[iLoop]) then
  7902. FContacterListViews.Strings[iLoop] := LVFriends;
  7903. if AnsiSameStr(OldLVStrangers, FContacterListViews.Strings[iLoop]) then
  7904. FContacterListViews.Strings[iLoop] := LVStrangers;
  7905. if AnsiSameStr(OldLVAddrbook, FContacterListViews.Strings[iLoop]) then
  7906. FContacterListViews.Strings[iLoop] := LVAddrbook;
  7907. //if AnsiSameStr(OldLVBlacklists, FContacterListViews.Strings[iLoop]) then
  7908. // FContacterListViews.Strings[iLoop] := LVBlacklists;
  7909. if AnsiSameStr(OldLVLatests, FContacterListViews.Strings[iLoop]) then
  7910. FContacterListViews.Strings[iLoop] := LVLatests;
  7911. if AnsiSameStr(OldLVTeams, FContacterListViews.Strings[iLoop]) then
  7912. FContacterListViews.Strings[iLoop] := LVTeams;
  7913. if AnsiSameStr(OldLVSearch, FContacterListViews.Strings[iLoop]) then
  7914. FContacterListViews.Strings[iLoop] := LVSearch;
  7915. end;
  7916. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  7917. begin
  7918. if AnsiSameStr(OldLVMyContacters, FContacterTreeViews.Strings[iLoop]) then
  7919. FContacterTreeViews.Strings[iLoop] := LVMyContacters;
  7920. if AnsiSameStr(OldLVFriends, FContacterTreeViews.Strings[iLoop]) then
  7921. FContacterTreeViews.Strings[iLoop] := LVFriends;
  7922. if AnsiSameStr(OldLVMoreUsers, FContacterTreeViews.Strings[iLoop]) then
  7923. FContacterTreeViews.Strings[iLoop] := LVMoreUsers;
  7924. if AnsiSameStr(OldLVAddrbook, FContacterTreeViews.Strings[iLoop]) then
  7925. FContacterTreeViews.Strings[iLoop] := LVAddrbook;
  7926. end;
  7927. if (RealICQClient.Logined and RealICQClient.Connected and pnlWorkArea.Visible) then
  7928. begin
  7929. ShowGroupInterface;
  7930. end;
  7931. edFilterKeyword.Text := '';
  7932. edFilterKeywordExit(edFilterKeyword);
  7933. SetUIState;
  7934. end;
  7935. //------------------------------------------------------------------------------
  7936. procedure TMainForm.SetLoginControlsVisible(Value: Boolean);
  7937. begin
  7938. lblLoginNameTitle.Visible := Value;
  7939. spLoginNameBorder.Visible := Value;
  7940. spbChangeLoginName.Visible := Value;
  7941. edLoginName.Visible := Value;
  7942. lblPasswordTitle.Visible := Value;
  7943. spPasswordBorder.Visible := Value;
  7944. edPassword.Visible := Value;
  7945. lblLoginStateTitle.Visible := Value;
  7946. spbLoginState.Visible := Value;
  7947. spbSavePassword.Visible := Value;
  7948. spbAutoLogin.Visible := Value;
  7949. btnCALogin.Visible := GetCaConfig.GetEnable and Value;
  7950. btLogin.Visible := Value;
  7951. lblRemoveMyLoginInfo.Visible := Value and RealICQClient.SavedPassword;
  7952. lblPasswordTitle.Enabled := not lblRemoveMyLoginInfo.Visible;
  7953. edPassword.Enabled := not lblRemoveMyLoginInfo.Visible;
  7954. //lblForgotPassword.Visible := Value;
  7955. lblNetworkConfig.Visible := Value;
  7956. //lblHelper.Visible := Value;
  7957. //lblNetworkConfig.Top:=Height-100;
  7958. //lblHelper.Top:=Height-80;
  7959. //lblRegister.Visible := Value;
  7960. end;
  7961. //------------------------------------------------------------------------------
  7962. procedure TMainForm.RealICQClientDisconnected(Sender: TObject);
  7963. begin
  7964. ScrollBoxMoreUser.Tag := 0;
  7965. try
  7966. if FSearchListViewInVisible then
  7967. spbCancelFilterClick(nil);
  7968. //ToDo
  7969. if pnlMiddleRight.Visible then
  7970. ShowOrHideMuiltiWeb;
  7971. if Assigned(AGuideViewForm) then
  7972. FreeAndNil(AGuideViewForm);
  7973. finally
  7974. lblLoginState.Caption := '正在注销...';
  7975. SetLoginControlsVisible(False);
  7976. pnlWorkArea.Visible := False;
  7977. pnlLogout.Visible := True;
  7978. //WebBrowserForEMail.Navigate('http://mail.lishui.gov.cn/web_email/modules/i_logout.phtml');
  7979. TimerForCheckLogoutTimeout.Enabled := True;
  7980. TimerForGetBranchOnlineStates.Enabled := False;
  7981. pnlForTopMessage.Visible := False;
  7982. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  7983. { TODO -olqq -c : 退出时,重置Log的登录名 2014/12/14 10:59:28 }
  7984. LoggerImport.LoginName := '';
  7985. TTeamsAdapter.Stop;
  7986. TMessagesHander.GetHander.Uninstall;
  7987. TMainFormController.GetController.LogoutFromAppCentre;
  7988. FDBHistory.DBFileName := '';
  7989. end;
  7990. end;
  7991. //------------------------------------------------------------------------------
  7992. procedure TMainForm.SetUIState;
  7993. var
  7994. iLoop: Integer;
  7995. RealICQContacterListView: TRealICQContacterListView;
  7996. RealICQContacterTreeView: TRealICQContacterTreeView;
  7997. RealICQFriendTreeView: TRealICQContacterTreeView;
  7998. GroupMembers: TStringList;
  7999. TabSheet: TTabSheet;
  8000. SystemMessage: TRealICQSystemMessage;
  8001. NotReadMessageObject: TObject;
  8002. MessageList: TList;
  8003. Employee: TRealICQEmployee;
  8004. RealICQUser: TRealICQUser;
  8005. VisibleValue: Boolean;
  8006. iIndex: Integer;
  8007. GroupName, MessageID: string;
  8008. SysMsgInterface: TSysMsgInterface;
  8009. begin
  8010. if OptionsForm <> nil then
  8011. OptionsForm.GetSets;
  8012. {$region '根据状态显示登录界面上的按钮等界面元素的内容和行为'}
  8013. TimerForLogining.Enabled := RealICQClient.Logining;
  8014. if True then
  8015. edLoginName.Text := RealICQClient.InputLoginName;
  8016. if RealICQClient.Logining then
  8017. begin
  8018. actLoginAs.Enabled := False;
  8019. lblLoginState.Caption := '正在登录...';
  8020. lblLoginState.Refresh;
  8021. SetLoginControlsVisible(False);
  8022. btLogin.Enabled := True;
  8023. btLogin.Visible := True;
  8024. btLogin.Caption := '取消(&C)';
  8025. btLogin.Refresh;
  8026. Application.ProcessMessages;
  8027. end
  8028. else if RealICQClient.SavedPassword and (not RealICQClient.Logined) then
  8029. begin
  8030. edPassword.Text := '保存的密码';
  8031. lblPasswordTitle.Enabled := False;
  8032. edPassword.Enabled := False;
  8033. FLoginAsSavePassword := True;
  8034. actLoginAs.Enabled := (not RealICQClient.Logined or not RealICQClient.Connected) and (not RealICQClient.Logining);
  8035. actLoginAs.Caption := '作为 ' + RealICQClient.LoginName + ' 登录(&S)';
  8036. btLogin.Enabled := True;
  8037. btLogin.Visible := True;
  8038. btLogin.Caption := '登录(&S)';
  8039. btLogin.Refresh;
  8040. lblLoginState.Caption := '';
  8041. SetLoginControlsVisible(True);
  8042. end
  8043. else if (not RealICQClient.Logined) then
  8044. begin
  8045. edPassword.Text := '';
  8046. lblPasswordTitle.Enabled := True;
  8047. edPassword.Enabled := True;
  8048. FLoginAsSavePassword := False;
  8049. actLoginAs.Enabled := False;
  8050. actLoginAs.Caption := '作为 ... 登录(&S)';
  8051. btLogin.Enabled := True;
  8052. btLogin.Visible := True;
  8053. btLogin.Caption := '登录(&S)';
  8054. btLogin.Refresh;
  8055. lblLoginState.Caption := '';
  8056. SetLoginControlsVisible(True);
  8057. end;
  8058. {$endregion}
  8059. {$region '设置控件的Enabled属性'}
  8060. actReg.Enabled := (not RealICQClient.Logining) and (not RealICQClient.Reging);
  8061. actOptions.Enabled := (not RealICQClient.Logining) and (not RealICQClient.Reging);
  8062. actConnectSet.Enabled := actOptions.Enabled;
  8063. actLogout.Enabled := (not (not RealICQClient.Logined or not RealICQClient.Connected) and (not RealICQClient.Logining) and (not RealICQClient.Reging)) and RealICQClient.Connected;
  8064. actOpenRecvFileDir.Enabled := actLogout.Enabled;
  8065. btLogin.Default := not actLogout.Enabled;
  8066. actOnline.Enabled := actLogout.Enabled;
  8067. actHidden.Enabled := actLogout.Enabled;
  8068. actOffline.Enabled := actLogout.Enabled;
  8069. actBusy.Enabled := actLogout.Enabled;
  8070. actMute.Enabled := actLogout.Enabled;
  8071. actLeave.Enabled := actLogout.Enabled;
  8072. actPhone.Enabled := actLogout.Enabled;
  8073. actRepast.Enabled := actLogout.Enabled;
  8074. actMeeting.Enabled := actLogout.Enabled;
  8075. actOtherState.Enabled := actLogout.Enabled;
  8076. actOfflieAutoResponse.Enabled := actLogout.Enabled;
  8077. actPersonalSet.Enabled := actLogout.Enabled;
  8078. actChangePass.Enabled := actLogout.Enabled;
  8079. actFindUsers.Enabled := actLogout.Enabled;
  8080. actShowLoginName.Enabled := actLogout.Enabled;
  8081. actShowDisplayName.Enabled := actLogout.Enabled;
  8082. actShowAllName.Enabled := actLogout.Enabled;
  8083. actShowRemark.Enabled := actLogout.Enabled;
  8084. actShowBigHeadImage.Enabled := actLogout.Enabled;
  8085. actShowMiddleHeadImage.Enabled := actLogout.Enabled;
  8086. actShowSmallHeadImage.Enabled := actLogout.Enabled;
  8087. actShowNormalHeadImage.Enabled := actLogout.Enabled;
  8088. actShowGroup.Enabled := actLogout.Enabled;
  8089. actGroupManager.Enabled := actLogout.Enabled;
  8090. actShowStrangers.Enabled := actLogout.Enabled;
  8091. actShowBlacklists.Enabled := actLogout.Enabled;
  8092. actShowTeams.Enabled := actLogout.Enabled;
  8093. actShowLatests.Enabled := actLogout.Enabled;
  8094. actShowGIFInMailForm.Enabled := actLogout.Enabled;
  8095. actShowGIFInTalkingForm.Enabled := actLogout.Enabled;
  8096. actCustomFacesManager.Enabled := actLogout.Enabled;
  8097. actMsgManager.Enabled := actLogout.Enabled;
  8098. actAVSet.Enabled := actLogout.Enabled;
  8099. RealICQNetWorkDiskClientConnectStateChanged(Self.RealICQNetWorkDiskClient);
  8100. SetLoginStateMenuChecked;
  8101. SetStyleMenuChecked;
  8102. {$endregion}
  8103. {$region '设置控件的Visible属性'}
  8104. lblReConnect.Visible := False;
  8105. actLoginAs.Visible := actLoginAs.Enabled;
  8106. if (RealICQClient.WorkingMode = wmCorporation) then
  8107. begin
  8108. actShowBigHeadImage.Visible := False;
  8109. actShowMiddleHeadImage.Visible := False;
  8110. actShowStrangers.Visible := False;
  8111. actShowBlacklists.Visible := False;
  8112. actReg.Visible := False;
  8113. //actFindUsers.Visible := False;
  8114. actShowTree.Visible := False;
  8115. end
  8116. else
  8117. begin
  8118. actShowBigHeadImage.Visible := not actShowTree.Checked;
  8119. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  8120. actShowStrangers.Visible := True;
  8121. actShowBlacklists.Visible := True;
  8122. actReg.Visible := True;
  8123. //actFindUsers.Visible := True;
  8124. actShowTree.Visible := True;
  8125. end;
  8126. VisibleValue := RealICQClient.Logined and RealICQClient.Connected;
  8127. ActionManager.ActionBars.ActionBars[1].Items[1].Visible := VisibleValue;
  8128. ActionManager.ActionBars.ActionBars[1].Items[2].Visible := VisibleValue;
  8129. //spbShowHideRight.Visible := VisibleValue;
  8130. {$endregion}
  8131. {$region '根据登录/连接状态,显示登录界面或联系人界面'}
  8132. if RealICQClient.Logined and RealICQClient.Connected then
  8133. begin
  8134. pnlWorkArea.Visible := True;
  8135. pnlLogout.Visible := False;
  8136. SetAllTakingFormEnabledState(True);
  8137. SetAllSMSFormEnabledState(True);
  8138. if not TLimitCondition.UserInfoCheck(MainForm.RealICQClient.Me) then
  8139. MainForm.actPersonalSetExecute(nil)
  8140. else if TLimitCondition.FirstLoginComfirm then
  8141. begin
  8142. ShowMessage('请确认或修改您的用户信息,确保您的信息正确');
  8143. MainForm.actPersonalSetExecute(nil);
  8144. end;
  8145. end
  8146. else
  8147. begin
  8148. pnlWorkArea.Visible := False;
  8149. pnlLogout.Visible := True;
  8150. tsCustomerService.PageControl := nil;
  8151. tsCustomers.PageControl := pgcMainWorkArea;
  8152. RealICQNetWorkDiskClient.Logout;
  8153. if VideoForm <> nil then
  8154. FreeAndNil(VideoForm);
  8155. if CreateTeamForm <> nil then
  8156. FreeAndNil(CreateTeamForm);
  8157. if SearchForm <> nil then
  8158. FreeAndNil(SearchForm);
  8159. if SearchTeamForm <> nil then
  8160. FreeAndNil(SearchTeamForm);
  8161. if SelFaceForm <> nil then
  8162. FreeAndNil(SelFaceForm);
  8163. if CustomFacesManagerForm <> nil then
  8164. FreeAndNil(CustomFacesManagerForm);
  8165. if MessagesManagerForm <> nil then
  8166. FreeAndNil(MessagesManagerForm);
  8167. if AddFaceForm <> nil then
  8168. FreeAndNil(AddFaceForm);
  8169. try
  8170. CloseAllTeamOptionsForms;
  8171. except
  8172. end;
  8173. try
  8174. WebBrowserForAdvertisement.OnDocumentComplete := nil;
  8175. WebBrowserForAdvertisement.OnBeforeNavigate2 := nil;
  8176. pnlAdvertisement.Height := 0;
  8177. if WebBrowserForAdvertisement.Busy then
  8178. WebBrowserForAdvertisement.Stop;
  8179. WebBrowserForAdvertisement.Navigate('about:blank');
  8180. except
  8181. end;
  8182. try
  8183. // CloseAllSeeUserInformationForms;
  8184. except
  8185. end;
  8186. try
  8187. CloseAllChangeSystemMessageForms;
  8188. except
  8189. end;
  8190. try
  8191. SetAllTakingFormEnabledState(False);
  8192. SetAllSMSFormEnabledState(False);
  8193. except
  8194. end;
  8195. TimerForFlashTrayIcon.Enabled := False;
  8196. if Assigned(NotReadMessageBoxForm) then
  8197. NotReadMessageBoxForm.Visible := False;
  8198. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  8199. TrayIcon.SetDefaultIcon;
  8200. TrayIcon.Hint := Application.Title + ' - 未登录';
  8201. {$region '删除WEB标签'}
  8202. try
  8203. for iLoop := 0 to FWebTabs.Count - 1 do
  8204. begin
  8205. TabSheet := FWebTabs[iLoop];
  8206. TabSheet.PageControl := nil;
  8207. FreeAndNil(TabSheet);
  8208. end;
  8209. except
  8210. end;
  8211. FWebTabs.Clear;
  8212. {$endregion}
  8213. {$region '删除未处理的系统消息'}
  8214. try
  8215. for iLoop := 0 to FSystemMessages.Count - 1 do
  8216. begin
  8217. SystemMessage := FSystemMessages[iLoop];
  8218. FreeAndNil(SystemMessage);
  8219. end;
  8220. except
  8221. end;
  8222. FSystemMessages.Clear;
  8223. {$endregion}
  8224. {$region '清除还未读的消息'}
  8225. for iLoop := 0 to FNotReadMessages.Count - 1 do
  8226. begin
  8227. MessageID := FNotReadMessages[iLoop];
  8228. if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  8229. begin
  8230. try
  8231. NotReadMessageObject := FNotReadMessages.Objects[iLoop];
  8232. FreeAndNil(NotReadMessageObject);
  8233. except
  8234. end;
  8235. end
  8236. else
  8237. begin
  8238. MessageList := FNotReadMessages.Objects[iLoop] as TList;
  8239. while MessageList.Count > 0 do
  8240. begin
  8241. try
  8242. NotReadMessageObject := TObject(MessageList[0]);
  8243. FreeAndNil(NotReadMessageObject);
  8244. except
  8245. end;
  8246. MessageList.Delete(0);
  8247. end;
  8248. FreeAndNil(MessageList);
  8249. end;
  8250. end;
  8251. FNotReadMessages.Clear;
  8252. {$endregion}
  8253. {try
  8254. for iLoop :=FNotAddedEmployeeList.Count-1 Downto 0 do
  8255. begin
  8256. try
  8257. RealICQUser:= FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  8258. if Assigned(RealICQUser) then FreeAndNil(RealICQUser);
  8259. except
  8260. end;
  8261. end;
  8262. finally
  8263. FNotAddedEmployeeList.Clear;
  8264. end; }
  8265. if FNotAddedEmployeeList.Count > 0 then
  8266. FNotAddedEmployeeList.Clear;
  8267. if Assigned(FLVSystemMessage) then
  8268. FLVSystemMessage.Items.Clear;
  8269. if Assigned(FLVTeams) then
  8270. FLVTeams.Items.Clear;
  8271. if Assigned(FLVCustomers) then
  8272. FLVCustomers.Items.Clear;
  8273. {$region '删除用于显示用户列表对象'}
  8274. for iLoop := FContacterListViews.Count - 1 downto 0 do
  8275. begin
  8276. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  8277. try
  8278. RealICQContacterListView.Items.Clear;
  8279. except
  8280. end;
  8281. GroupName := FContacterListViews[iLoop];
  8282. if AnsiSameText(GroupName, LVFriends) or AnsiSameText(GroupName, LVStrangers) or
  8283. {AnsiSameText(GroupName, LVBlacklists) or}
  8284. (FGroups.IndexOf(GroupName) >= 0) then
  8285. begin
  8286. try
  8287. FreeAndNil(RealICQContacterListView);
  8288. except
  8289. end;
  8290. FContacterListViews.Delete(iLoop);
  8291. end;
  8292. end;
  8293. for iLoop := FContacterTreeViews.Count - 1 downto 0 do
  8294. begin
  8295. try
  8296. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  8297. try
  8298. RealICQContacterTreeView.Clear;
  8299. except
  8300. end;
  8301. finally
  8302. try
  8303. FreeAndNil(RealICQContacterTreeView);
  8304. except
  8305. end;
  8306. FContacterTreeViews.Delete(iLoop);
  8307. end;
  8308. end;
  8309. for iLoop := FContacterTreeViews.Count - 1 downto 0 do
  8310. begin
  8311. try
  8312. RealICQFriendTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  8313. try
  8314. RealICQFriendTreeView.Clear;
  8315. except
  8316. end;
  8317. finally
  8318. try
  8319. FreeAndNil(RealICQFriendTreeView);
  8320. except
  8321. end;
  8322. FContacterTreeViews.Delete(iLoop);
  8323. end;
  8324. end;
  8325. {$endregion}
  8326. for iLoop := 0 to RealICQClient.SysMsgInterfaces.Count - 1 do
  8327. begin
  8328. SysMsgInterface := RealICQClient.SysMsgInterfaces.Objects[iLoop] as TSysMsgInterface;
  8329. FreeAndNil(SysMsgInterface);
  8330. end;
  8331. RealICQClient.SysMsgInterfaces.Clear;
  8332. for iLoop := 0 to FGroups.Count - 1 do
  8333. begin
  8334. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  8335. GroupMembers.Clear;
  8336. GroupMembers.Free;
  8337. end;
  8338. FGroups.Clear;
  8339. end;
  8340. {$endregion}
  8341. PostMessage(Handle, WM_SIZE, 0, 0);
  8342. Application.ProcessMessages;
  8343. if not TrayIcon.Visible then
  8344. begin
  8345. TrayIcon.Visible := True;
  8346. end;
  8347. end;
  8348. //------------------------------------------------------------------------------
  8349. procedure TMainForm.AddMessageHistory(ASystemMessageType: TSystemMessageType; ASimpleMessage: string; ASystemMessage: TRealICQSystemMessage);
  8350. var
  8351. ItemIndex: Integer;
  8352. ListItem: TRealICQContacterListItem;
  8353. ID: string;
  8354. begin
  8355. ID := '';
  8356. case ASystemMessageType of
  8357. smSimple:
  8358. begin
  8359. ID := IntToStr(GetTickCount);
  8360. while FLVSystemMessage.Items.IndexOf(ID) >= 0 do
  8361. begin
  8362. ID := IntToStr(GetTickCount);
  8363. Sleep(10);
  8364. Application.ProcessMessages;
  8365. end;
  8366. end;
  8367. smSystemMessage:
  8368. ID := IntToStr(ASystemMessage.MessageID);
  8369. end;
  8370. FLVSystemMessage.ShowHeadImageButton := False;
  8371. ItemIndex := FLVSystemMessage.Items.Add(ID);
  8372. ListItem := FLVSystemMessage.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  8373. with ListItem do
  8374. begin
  8375. DisplayName := TimeToStr(Now);
  8376. LoginState := stOnline;
  8377. case ASystemMessageType of
  8378. smSimple:
  8379. begin
  8380. Watchword := ASimpleMessage;
  8381. try
  8382. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + SimpleMessagePicture);
  8383. except
  8384. end;
  8385. end;
  8386. smSystemMessage:
  8387. begin
  8388. Watchword := ASystemMessage.Title;
  8389. try
  8390. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  8391. except
  8392. end;
  8393. end;
  8394. end;
  8395. ReDrawItem;
  8396. end;
  8397. FLVSystemMessage.TopIndex := ItemIndex;
  8398. end;
  8399. //------------------------------------------------------------------------------
  8400. constructor TMainForm.Create(AOwner: TComponent);
  8401. begin
  8402. MainForm := Self;
  8403. inherited Create(AOwner);
  8404. end;
  8405. //------------------------------------------------------------------------------
  8406. procedure TMainForm.FormCreate(Sender: TObject);
  8407. function URLDecode(const S: string): string;
  8408. var
  8409. Idx: Integer; // loops thru chars in string
  8410. Hex: string; // string of hex characters
  8411. Code: Integer; // hex character code (-1 on error)
  8412. begin
  8413. // Intialise result and string index
  8414. Result := '';
  8415. Idx := 1;
  8416. // Loop thru string decoding each character
  8417. while Idx <= Length(S) do
  8418. begin
  8419. case S[Idx] of
  8420. '%':
  8421. begin
  8422. // % should be followed by two hex digits - exception otherwise
  8423. if Idx <= Length(S) - 2 then
  8424. begin
  8425. // there are sufficient digits - try to decode hex digits
  8426. Hex := S[Idx + 1] + S[Idx + 2];
  8427. Code := SysUtils.StrToIntDef('$' + Hex, -1);
  8428. Inc(Idx, 2);
  8429. end
  8430. else
  8431. // insufficient digits - error
  8432. Code := -1;
  8433. // check for error and raise exception if found
  8434. if Code = -1 then
  8435. raise SysUtils.EConvertError.Create('Invalid hex digit in URL');
  8436. // decoded OK - add character to result
  8437. Result := Result + Chr(Code);
  8438. end;
  8439. '+':
  8440. // + is decoded as a space
  8441. Result := Result + ' ' else
  8442. // All other characters pass thru unchanged
  8443. Result := Result + S[Idx];
  8444. end;
  8445. Inc(Idx);
  8446. end;
  8447. end;
  8448. function UserIsLogined(user: string): Boolean;
  8449. var
  8450. hWndStart, hwndLike: HWND;
  8451. WndCaption: array[0..254] of char;
  8452. WndClassName: array[0..254] of char;
  8453. ActiveTimes: Integer;
  8454. begin
  8455. Result := False;
  8456. try
  8457. ActiveTimes := 0;
  8458. hWndStart := GetDesktopWindow;
  8459. hwndLike := GetWindow(hWndStart, GW_CHILD);
  8460. while hwndLike <> 0 do
  8461. begin
  8462. GetWindowText(hwndLike, @WndCaption, 254);
  8463. GetClassName(hwndLike, @WndClassName, 254);
  8464. if (pos(user, StrPas(WndCaption)) <> 0) and (pos('TrueHiddenMainForm', StrPas(WndClassName)) <> 0) then
  8465. begin
  8466. Result := True;
  8467. ShowWindow(hwndLike, SW_SHOW);
  8468. ForceForeGroundWindow(hwndLike);
  8469. Inc(ActiveTimes);
  8470. if ActiveTimes >= 2 then
  8471. Break;
  8472. end;
  8473. hwndLike := GetWindow(hwndLike, GW_HWNDNEXT);
  8474. end;
  8475. except
  8476. on E: Exception do
  8477. begin
  8478. Error(E.Message, 'TMainForm.UserIsLogined(' + user + ')');
  8479. end;
  8480. end;
  8481. end;
  8482. var
  8483. iIndex, i: Integer;
  8484. gif: TGIFImage;
  8485. ca: string;
  8486. IdHttp: TIdHTTP;
  8487. ResponeStr: string;
  8488. Sends: TStrings;
  8489. jo, ja: ISuperObject;
  8490. CALoginName, CAPassWord: string;
  8491. icon: TIcon; //cmg
  8492. begin
  8493. try
  8494. TAuthority.SetDropFileAuthority;
  8495. TrayIcon.Visible := False;
  8496. if FileExists(ExtractFilePath(paramstr(0)) + LoginingGif) then
  8497. begin
  8498. gif := TGIFImage.Create;
  8499. try
  8500. gif.LoadFromFile(ExtractFilePath(paramstr(0)) + LoginingGif);
  8501. gif.Animate := True;
  8502. ImgLoadingMoreBranchs.Picture.Assign(gif);
  8503. finally
  8504. gif.Free;
  8505. end;
  8506. end;
  8507. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\0.ico', $ff00ff);
  8508. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\1.ico', $ff00ff);
  8509. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\2.ico', $ff00ff);
  8510. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\3.ico', $ff00ff);
  8511. //cmg
  8512. begin
  8513. Icon := Ticon.create;
  8514. try
  8515. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\3.ico');
  8516. i := ImgLstForLogining.addicon(Icon);
  8517. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\2.ico');
  8518. i := ImgLstForLogining.addicon(Icon);
  8519. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\1.ico');
  8520. i := ImgLstForLogining.addicon(Icon);
  8521. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\0.ico');
  8522. i := ImgLstForLogining.addicon(Icon);
  8523. finally
  8524. Icon.Free;
  8525. end;
  8526. end;
  8527. //注册自定义消息
  8528. CLOSEWINDOWS := RegisterWindowMessage('关闭窗口');
  8529. if FileExists(ExtractFilePath(Application.ExeName) + 'Images\Logo.gif') then
  8530. ImgLogo.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Logo.gif');
  8531. if FileExists(ExtractFilePath(Application.ExeName) + 'Images\AppCode.png') then
  8532. Image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\AppCode.png');
  8533. LoadMainTabImage;
  8534. LoadGroupConfig;
  8535. FDownFile := TDownFile.Create;
  8536. FDownFile.OnComplete := DownFileComplete;
  8537. //调用自动更新程序
  8538. FCheckedUpdate := True;
  8539. try
  8540. RegisterOleFile(ExtractFilePath(Application.ExeName) + IEContext_DLL_PACH, 1);
  8541. except
  8542. on E: Exception do
  8543. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(IEContext.dll)');
  8544. end;
  8545. try
  8546. RegisterOleFile(ExtractFilePath(Application.ExeName) + ImageX2_DLL_PACH, 1);
  8547. except
  8548. on E: Exception do
  8549. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(ImageX2.dll)');
  8550. end;
  8551. try
  8552. RegisterOleFile(ExtractFilePath(Application.ExeName) + AppCentreCom_DLL_PACH, 1);
  8553. except
  8554. on E: Exception do
  8555. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(AppCentreCom.dll)');
  8556. end;
  8557. if HookID <> 0 then
  8558. UnHookWindowsHookEx(HookID);
  8559. HookID := SetWindowsHookEx(WH_MOUSE, MouseProc, 0, GetCurrentThreadId());
  8560. MinButtonForClose := True;
  8561. FGettedTrayIconRect := False;
  8562. FMainFormHidden := False;
  8563. FHidePosition := hpNone;
  8564. SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
  8565. Caption := Application.Title;
  8566. actOpenMainForm.Caption := '打开 ' + Application.Title + ' 主界面(&O)';
  8567. FIsLogout := False;
  8568. DoubleBuffered := True;
  8569. pnlTop.DoubleBuffered := True;
  8570. pnlClient.DoubleBuffered := True;
  8571. pnlWorkArea.DoubleBuffered := True;
  8572. pnlLogout.DoubleBuffered := True;
  8573. edFilterKeyword.DoubleBuffered := True;
  8574. pnlWebSearch.DoubleBuffered := True;
  8575. pnlWebSearchSplit.DoubleBuffered := True;
  8576. pnlTeams.DoubleBuffered := True;
  8577. pnlAll.DoubleBuffered := True;
  8578. edLoginName.DoubleBuffered := True;
  8579. edPassword.DoubleBuffered := True;
  8580. pnlNDToolBar.DoubleBuffered := True;
  8581. pnlNDStateBar.DoubleBuffered := True;
  8582. pnlNetWorkFiles.DoubleBuffered := True;
  8583. pnlMiddleClient.DoubleBuffered := True;
  8584. pgcMultiWeb.DoubleBuffered := True;
  8585. pnlToolBar.DoubleBuffered := True;
  8586. FHintWindow := TSingleBorderHintWindow.Create(Self);
  8587. FHintWindow.Visible := False;
  8588. FGetUsersTask := TStringList.Create;
  8589. //默认值
  8590. ActiveButtonTag := 1;
  8591. HotKeyID_ReadMessage := 0;
  8592. HotKeyID_CopyScreen := 0;
  8593. FShowGroup := False;
  8594. FFlashCaptionOnOnline := True;
  8595. FLVSelectedItemBorderColor := $00E9CAAD;
  8596. FLVSelectedItemBorderInnerColor := $00F7F7F7;
  8597. FLVSelectedItemBackColor := $00FEE9CE;
  8598. FLVHeadImageBorderColor := $00E9CAAD;
  8599. FLVHeadImageBackColor := clWhite;
  8600. FLVStyle := lsMiddleHeadImage;
  8601. FLVCaptionStyle := csDisplayName;
  8602. FShowTree := False;
  8603. LoadDefaultConfigs;
  8604. FFlashTrayIconIndex := 0;
  8605. FFlashTrayIconIndexAtLogining := 0;
  8606. FNotReadMessages := TStringList.Create;
  8607. FGroups := TStringList.Create;
  8608. FWebTabs := TList.Create;
  8609. FFaceList := TStringList.Create;
  8610. FTempFaceList := TStringList.Create;
  8611. FFaceCategory := TStringList.Create;
  8612. FInputFont := TFont.Create;
  8613. FContacterListViews := TStringList.Create;
  8614. FContacterTreeViews := TStringList.Create;
  8615. FContacterTreeViews := TStringList.Create;
  8616. FSystemMessages := TList.Create;
  8617. TMainFormController.GetController.ChangeStyle;
  8618. try
  8619. FDBHistory := TRealICQDBHistory.Create;
  8620. except
  8621. //ShowMessage('数据库创建失败');
  8622. on E: Exception do
  8623. begin
  8624. ShowMessage('异常类名称:' + E.ClassName + #13#10 + '异常信息:' + E.Message);
  8625. end;
  8626. end;
  8627. FWebPanels := TStringList.Create;
  8628. FOfflineAutoResponseTexts := TStringList.Create;
  8629. FNotAddedEmployeeList := TStringList.Create;
  8630. FSystemNotices := TList.Create;
  8631. FToolBarButtonList := TStringList.Create;
  8632. FToolBarButtonIconList := TStringList.Create;
  8633. FManageGroupMsgList := TStringList.Create;
  8634. FManageGroupMemberMsgList := TStringList.Create;
  8635. FFriendInfo := TStringList.Create;
  8636. FLoginAsSavePassword := False;
  8637. FSavePassword := False;
  8638. FAutoLogin := False;
  8639. FLoginState := stOnline;
  8640. FLeaveMessage := '';
  8641. FServerInfoList := TStringList.Create;
  8642. pnlMiddleClient.Align := alClient;
  8643. pnlMiddleRight.Align := alRight;
  8644. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  8645. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  8646. ChangeLanguage(ExtractFilePath(Application.ExeName) + 'Languages\简体中文.ini');
  8647. {$region '生成显示系统消息的ListView'}
  8648. AddContacterListView(pnlTemp, LVSystemMessage);
  8649. FLVSystemMessage := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8650. FContacterListViews.Delete(0);
  8651. FLVSystemMessage.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  8652. FLVSystemMessage.Style := lsSmallHeadImage;
  8653. FLVSystemMessage.CaptionStyle := csDisplayName;
  8654. FLVSystemMessage.PopupMenu := nil;
  8655. FLVSystemMessage.OnItemOnline := nil;
  8656. FLVSystemMessage.OnItemOffline := nil;
  8657. FLVSystemMessage.OnItemMouseEnter := nil;
  8658. FLVSystemMessage.OnItemMouseLeave := nil;
  8659. FLVSystemMessage.OnItemIconButtonClick := nil;
  8660. FLVSystemMessage.OnItemIconButtonDblClick := nil;
  8661. FLVSystemMessage.ShowMobileButton := False;
  8662. FLVSystemMessage.ShowTelButton := False;
  8663. FLVSystemMessage.ShowEmailButton := False;
  8664. FLVSystemMessage.ShowSMSButton := False;
  8665. FLVSystemMessage.ShowCameraButton := False;
  8666. FLVSystemMessage.ShowHeadImageButton := False;
  8667. FLVSystemMessage.ShowHint := False;
  8668. FLVSystemMessage.SelectedItemBackgroud.Graphic := nil;
  8669. FLVSystemMessage.HeadImageBorderColor := clWhite;
  8670. FLVSystemMessage.SelectedItemBorderInnerColor := clWhite;
  8671. FLVSystemMessage.SelectedItemBackColor := clWhite;
  8672. {$endregion}
  8673. {$region '生成显示群组列表的ListView'}
  8674. AddContacterListView(ScrollBoxTeam, LVTeams);
  8675. // navForContacters.Groups[3] := LVTeams;
  8676. FLVTeams := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8677. FContacterListViews.Delete(0);
  8678. FLVTeams.AdjustPosition := False;
  8679. FLVTeams.LeavePicture := nil;
  8680. FLVTeams.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  8681. FLVTeams.Style := lsSmallHeadImage;
  8682. FLVTeams.CaptionStyle := csDisplayName;
  8683. FLVTeams.PopupMenu := ppTeamListView;
  8684. FLVTeams.OnItemOnline := nil;
  8685. FLVTeams.OnItemOffline := nil;
  8686. FLVTeams.OnItemMouseEnter := nil;
  8687. FLVTeams.OnItemMouseLeave := nil;
  8688. FLVTeams.OnItemIconButtonClick := nil;
  8689. FLVTeams.OnItemIconButtonDblClick := nil;
  8690. FLVTeams.ShowMobileButton := False;
  8691. FLVTeams.ShowTelButton := False;
  8692. FLVTeams.ShowEmailButton := False;
  8693. FLVTeams.ShowSMSButton := False;
  8694. FLVTeams.ShowCameraButton := False;
  8695. FLVTeams.ShowHeadImageButton := False;
  8696. pnlTeams.Parent := ScrollBoxTeam;
  8697. pnlTeams.Align := alTop;
  8698. pnlTeams.ShowHint := False;
  8699. {$endregion}
  8700. {$region '生成显示网络硬盘文件的ListView'}
  8701. AddContacterListView(pnlNDFiles, '网络硬盘');
  8702. FLVNetWorkDisk := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8703. FLVNetWorkDisk.Align := alClient;
  8704. FContacterListViews.Delete(0);
  8705. FLVNetWorkDisk.LeavePicture := nil;
  8706. FLVNetWorkDisk.SelectedItemBackgroud.Graphic := nil;
  8707. FLVNetWorkDisk.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8708. FLVNetWorkDisk.Style := lsSmallHeadImage;
  8709. FLVNetWorkDisk.CaptionStyle := csDisplayName;
  8710. FLVNetWorkDisk.PopupMenu := ppNetWorkFile;
  8711. FLVNetWorkDisk.HeadImageBorderColor := clWhite;
  8712. FLVNetWorkDisk.SelectedItemBorderInnerColor := clWhite;
  8713. FLVNetWorkDisk.SelectedItemBackColor := clWhite;
  8714. FLVNetWorkDisk.OnItemOnline := nil;
  8715. FLVNetWorkDisk.OnItemOffline := nil;
  8716. FLVNetWorkDisk.OnItemMouseEnter := nil;
  8717. FLVNetWorkDisk.OnItemMouseLeave := nil;
  8718. FLVNetWorkDisk.OnItemIconButtonClick := nil;
  8719. FLVNetWorkDisk.OnItemIconButtonDblClick := nil;
  8720. FLVNetWorkDisk.ShowMobileButton := False;
  8721. FLVNetWorkDisk.ShowTelButton := False;
  8722. FLVNetWorkDisk.ShowEmailButton := False;
  8723. FLVNetWorkDisk.ShowSMSButton := False;
  8724. FLVNetWorkDisk.ShowCameraButton := False;
  8725. FLVNetWorkDisk.ShowHeadImageButton := False;
  8726. FLVNetWorkDisk.AdjustPosition := True;
  8727. FLVNetWorkDisk.OnItemShowHint := ItemShowHint;
  8728. FLVNetWorkDisk.OnItemDoubleClick := NDItemDoubleClick;
  8729. FLVNetWorkDisk.OnSelectItemChanged := NDSelectItemChanged;
  8730. FLVNetWorkDisk.OnItemClick := NDSelectItemChanged;
  8731. FLVNetWorkDisk.OnItemMouseEnter := NDSelectItemChanged;
  8732. FLVNetWorkDisk.OnDropFiles := NDMissionDropFiles;
  8733. FLVNetWorkDisk.OnItemMouseDown := NDItemMouseDown;
  8734. DragAcceptFiles(FLVNetWorkDisk.Handle, True);
  8735. {$endregion}
  8736. {$region '生成显示网络硬盘上传文件任务列表的ListView'}
  8737. AddContacterListView(tsUploadingFiles, '硬盘上传文件');
  8738. FLVNetWorkDiskUploadingFiles := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8739. FLVNetWorkDiskUploadingFiles.Align := alClient;
  8740. FContacterListViews.Delete(0);
  8741. FLVNetWorkDiskUploadingFiles.LeavePicture := nil;
  8742. FLVNetWorkDiskUploadingFiles.SelectedItemBackgroud.Graphic := nil;
  8743. FLVNetWorkDiskUploadingFiles.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8744. FLVNetWorkDiskUploadingFiles.Style := lsSmallHeadImage;
  8745. FLVNetWorkDiskUploadingFiles.CaptionStyle := csDisplayName;
  8746. FLVNetWorkDiskUploadingFiles.PopupMenu := ppNetWorkMisson;
  8747. FLVNetWorkDiskUploadingFiles.HeadImageBorderColor := clWhite;
  8748. FLVNetWorkDiskUploadingFiles.SelectedItemBorderInnerColor := clWhite;
  8749. FLVNetWorkDiskUploadingFiles.SelectedItemBackColor := clWhite;
  8750. FLVNetWorkDiskUploadingFiles.OnItemOnline := nil;
  8751. FLVNetWorkDiskUploadingFiles.OnItemOffline := nil;
  8752. FLVNetWorkDiskUploadingFiles.OnItemMouseEnter := nil;
  8753. FLVNetWorkDiskUploadingFiles.OnItemMouseLeave := nil;
  8754. FLVNetWorkDiskUploadingFiles.OnItemIconButtonClick := NDMissionItemIconButtonClick;
  8755. FLVNetWorkDiskUploadingFiles.OnItemIconButtonDblClick := nil;
  8756. FLVNetWorkDiskUploadingFiles.ShowMobileButton := False;
  8757. FLVNetWorkDiskUploadingFiles.ShowTelButton := False;
  8758. FLVNetWorkDiskUploadingFiles.ShowEmailButton := False;
  8759. FLVNetWorkDiskUploadingFiles.ShowSMSButton := False;
  8760. FLVNetWorkDiskUploadingFiles.ShowCameraButton := False;
  8761. FLVNetWorkDiskUploadingFiles.ShowHeadImageButton := False;
  8762. FLVNetWorkDiskUploadingFiles.AdjustPosition := False;
  8763. FLVNetWorkDiskUploadingFiles.OnItemShowHint := ItemShowHint;
  8764. FLVNetWorkDiskUploadingFiles.OnItemDoubleClick := nil;
  8765. FLVNetWorkDiskUploadingFiles.OnSelectItemChanged := nil;
  8766. FLVNetWorkDiskUploadingFiles.OnItemClick := nil;
  8767. FLVNetWorkDiskUploadingFiles.OnItemMouseEnter := nil;
  8768. FLVNetWorkDiskUploadingFiles.ShowSMSButton := True;
  8769. FLVNetWorkDiskUploadingFiles.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CancelIcon);
  8770. {$endregion}
  8771. {$region '生成显示网络硬盘下载文件任务列表的ListView'}
  8772. AddContacterListView(tsDownloadingFiles, '硬盘下载文件');
  8773. FLVNetWorkDiskDownloadingFiles := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8774. FLVNetWorkDiskDownloadingFiles.Align := alClient;
  8775. FContacterListViews.Delete(0);
  8776. FLVNetWorkDiskDownloadingFiles.LeavePicture := nil;
  8777. FLVNetWorkDiskDownloadingFiles.SelectedItemBackgroud.Graphic := nil;
  8778. FLVNetWorkDiskDownloadingFiles.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8779. FLVNetWorkDiskDownloadingFiles.Style := lsSmallHeadImage;
  8780. FLVNetWorkDiskDownloadingFiles.CaptionStyle := csDisplayName;
  8781. FLVNetWorkDiskDownloadingFiles.PopupMenu := ppNetWorkMisson;
  8782. FLVNetWorkDiskDownloadingFiles.HeadImageBorderColor := clWhite;
  8783. FLVNetWorkDiskDownloadingFiles.SelectedItemBorderInnerColor := clWhite;
  8784. FLVNetWorkDiskDownloadingFiles.SelectedItemBackColor := clWhite;
  8785. FLVNetWorkDiskDownloadingFiles.OnItemOnline := nil;
  8786. FLVNetWorkDiskDownloadingFiles.OnItemOffline := nil;
  8787. FLVNetWorkDiskDownloadingFiles.OnItemMouseEnter := nil;
  8788. FLVNetWorkDiskDownloadingFiles.OnItemMouseLeave := nil;
  8789. FLVNetWorkDiskDownloadingFiles.OnItemIconButtonClick := NDMissionItemIconButtonClick;
  8790. FLVNetWorkDiskDownloadingFiles.OnItemIconButtonDblClick := nil;
  8791. FLVNetWorkDiskDownloadingFiles.ShowMobileButton := False;
  8792. FLVNetWorkDiskDownloadingFiles.ShowTelButton := False;
  8793. FLVNetWorkDiskDownloadingFiles.ShowEmailButton := False;
  8794. FLVNetWorkDiskDownloadingFiles.ShowSMSButton := False;
  8795. FLVNetWorkDiskDownloadingFiles.ShowCameraButton := False;
  8796. FLVNetWorkDiskDownloadingFiles.ShowHeadImageButton := False;
  8797. FLVNetWorkDiskDownloadingFiles.AdjustPosition := False;
  8798. FLVNetWorkDiskDownloadingFiles.OnItemShowHint := ItemShowHint;
  8799. FLVNetWorkDiskDownloadingFiles.OnItemDoubleClick := nil;
  8800. FLVNetWorkDiskDownloadingFiles.OnSelectItemChanged := nil;
  8801. FLVNetWorkDiskDownloadingFiles.OnItemClick := nil;
  8802. FLVNetWorkDiskDownloadingFiles.OnItemMouseEnter := nil;
  8803. FLVNetWorkDiskDownloadingFiles.ShowSMSButton := True;
  8804. FLVNetWorkDiskDownloadingFiles.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CancelIcon);
  8805. {$endregion}
  8806. iIndex := AddContacterListView(tsCustomers, '客服人员');
  8807. FLVCustomers := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8808. FContacterListViews.Delete(iIndex);
  8809. FLVCustomers.AdjustPosition := False;
  8810. FLVCustomers.OnItemOnline := nil;
  8811. FLVCustomers.OnItemOffline := nil;
  8812. FLVCustomers.Style := lsSmallHeadImage;
  8813. FLVCustomers.Parent := tsCustomers;
  8814. FLVCustomers.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8815. FLVCustomers.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8816. iIndex := AddContacterListView(ScrollBoxLatests, LVLatests);
  8817. FLVLatests := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8818. FLVLatests.AdjustPosition := False;
  8819. FLVLatests.OnItemOnline := nil;
  8820. FLVLatests.OnItemOffline := nil;
  8821. FLVLatests.Parent := ScrollBoxLatests;
  8822. FLVLatests.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8823. FLVLatests.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8824. iIndex := AddContacterListView(ScrollBoxSearchMoreUser, LVMoreUsers);
  8825. FSearchListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8826. FSearchListView.OnItemOnline := nil;
  8827. FSearchListView.OnItemOffline := nil;
  8828. FSearchListView.OnItemIconButtonClick := nil;
  8829. FSearchListView.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8830. FSearchListView.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8831. FSearchListView.ShowTelButton := False;
  8832. FSearchListView.ShowCameraButton := False;
  8833. FSearchListView.ShowEmailButton := False;
  8834. FSearchListView.AdjustPosition := False;
  8835. iIndex := AddContacterListView(ScrollBoxSearchUser, LVSearch);
  8836. FSearchListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8837. FSearchListView.OnItemOnline := nil;
  8838. FSearchListView.OnItemOffline := nil;
  8839. ChangeUIColor(UIMainColor);
  8840. PostMessage(Handle, WM_SIZE, 0, 0);
  8841. Application.ProcessMessages;
  8842. Sleep(200);
  8843. SetUIState;
  8844. AddWebBrowserToPageControl('about:blank', -2);
  8845. lblWeatherCity.Transparent := True;
  8846. lblWeather.Transparent := True;
  8847. lblWeatheren.Transparent := True;
  8848. FToolBarButtonList.AddObject(LVMyContacters, MyContacters);
  8849. FToolBarButtonList.AddObject(LVMoreUsers, SysMsg);
  8850. FToolBarButtonList.AddObject(LVFriends, MyFriend);
  8851. FToolBarButtonList.AddObject(LvTeams, MyTeam);
  8852. FToolBarButtonList.AddObject(LvLatests, Latests);
  8853. FToolBarButtonIconList.AddObject(LVMyContacters, MyContactersIcon);
  8854. FToolBarButtonIconList.AddObject(LVMoreUsers, SysMsgIcon);
  8855. FToolBarButtonIconList.AddObject(LVFriends, MyFriendIcon);
  8856. FToolBarButtonIconList.AddObject(LvTeams, MyTeamIcon);
  8857. FToolBarButtonIconList.AddObject(LvLatests, LatestsIcon);
  8858. NotReadMessageBoxForm := TNotReadMessageBoxForm.Create(Self);
  8859. NotReadMessageBoxForm.Left := -1000;
  8860. NotReadMessageBoxForm.Top := -1000;
  8861. NotReadMessageBoxForm.Show;
  8862. NotReadMessageBoxForm.Hide;
  8863. tsContactersShow(tsContacters);
  8864. if ParamStr(1) = 'wscc://sso' then
  8865. begin
  8866. ca := DecodeString(ParamStr(2));
  8867. ca := URLDecode(ca);
  8868. //ca := copy(ca,pos('ca=',ca)+3,length(ca));
  8869. Sends := TStringList.Create;
  8870. IdHttp := TIdHTTP.Create(nil);
  8871. try
  8872. ResponeStr := Idhttp.post('http://' + RealICQClient.CaServerAddress + ':' + inttostr(RealICQClient.CaPort) + '/api/Structure/LoginByCA?ca=' + ca, Sends);
  8873. ResponeStr := UTF8Decode(ResponeStr);
  8874. try
  8875. jo := SO(ResponeStr);
  8876. CALoginName := jo['data.loginName'].AsString;
  8877. CAPassWord := jo['data.password'].AsString;
  8878. except
  8879. end;
  8880. finally
  8881. Freeandnil(IdHttp);
  8882. Sends.Free;
  8883. end;
  8884. if not UserIsLogined(CALoginName) then
  8885. RealICQClient.Login(CALoginName, CAPassWord, FLoginState, FLeaveMessage, FSavePassword, False, True)
  8886. else
  8887. begin
  8888. try
  8889. Application.Terminate;
  8890. except
  8891. end;
  8892. end;
  8893. end
  8894. else
  8895. begin
  8896. FAutoLogin := RealICQClient.AutoLogin;
  8897. FSavePassword := RealICQClient.SavedPassword;
  8898. SetLoginStateControlState;
  8899. if RealICQClient.AutoLogin and (RealICQClient.SavedPassword or RealICQClient.CALogin) then
  8900. RealICQClient.LoginAsSaved;
  8901. end;
  8902. tsCustomerService.PageControl := nil;
  8903. RealICQClient.OnGettedSysMsgInterfaces := RealICQClientGettedSysMsgInterfaces;
  8904. Application.ProcessMessages;
  8905. except
  8906. on E: Exception do
  8907. Error(E.Message, 'TMainForm.FormCreate');
  8908. end;
  8909. end;
  8910. //------------------------------------------------------------------------------
  8911. procedure TMainForm.FormDeactivate(Sender: TObject);
  8912. begin
  8913. if edWatchword.Visible then
  8914. edWatchwordExit(edWatchword);
  8915. end;
  8916. //------------------------------------------------------------------------------
  8917. procedure TMainForm.FormDestroy(Sender: TObject);
  8918. begin
  8919. try
  8920. if RealICQClient.Connected then
  8921. RealICQClient.Logout;
  8922. if AThreadPool <> nil then
  8923. AThreadPool.TerminateAllYarns;
  8924. FreeAndNil(FDownFile);
  8925. FHintWindow.ReleaseHandle;
  8926. FHintWindow.Free;
  8927. FGetUsersTask.Clear;
  8928. FreeAndNil(FGetUsersTask);
  8929. FServerInfoList.Clear;
  8930. FreeAndNil(FServerInfoList);
  8931. // FreeAndNil(FPCAMessage);
  8932. FreeAndNil(FOfflineAutoResponseTexts);
  8933. FNotAddedEmployeeList.Clear;
  8934. FreeAndNil(FNotAddedEmployeeList);
  8935. FSystemMessages.Clear;
  8936. FreeAndNil(FSystemMessages);
  8937. FToolBarButtonList.Clear;
  8938. FreeAndNil(FToolBarButtonList);
  8939. FToolBarButtonIconList.Clear;
  8940. FreeAndNil(FToolBarButtonIconList);
  8941. FNotReadMessages.Clear;
  8942. FreeAndNil(FNotReadMessages);
  8943. FContacterListViews.Clear;
  8944. FreeAndNil(FContacterListViews);
  8945. FContacterTreeViews.Clear;
  8946. FreeAndNil(FContacterTreeViews);
  8947. FWebTabs.Clear;
  8948. FreeAndNil(FWebTabs);
  8949. FGroups.Clear;
  8950. FreeAndNil(FGroups);
  8951. FFriendInfo.Clear;
  8952. FreeAndNil(FFriendInfo);
  8953. FManageGroupMsgList.Clear;
  8954. FreeAndNil(FManageGroupMsgList);
  8955. FManageGroupMemberMsgList.Clear;
  8956. FreeAndNil(FManageGroupMemberMsgList);
  8957. while FWebPanels.Count > 0 do
  8958. begin
  8959. try
  8960. FWebPanels.Objects[0].Free;
  8961. except
  8962. end;
  8963. FWebPanels.Delete(0);
  8964. end;
  8965. FWebPanels.Clear;
  8966. FreeAndNil(FWebPanels);
  8967. while FSystemNotices.Count > 0 do
  8968. begin
  8969. try
  8970. TSystemNotices(FSystemNotices[0]).Free;
  8971. except
  8972. end;
  8973. FSystemNotices.Delete(0);
  8974. end;
  8975. FSystemNotices.Clear;
  8976. FreeAndNil(FSystemNotices);
  8977. while FFaceList.Count > 0 do
  8978. begin
  8979. try
  8980. FFaceList.Objects[0].Free;
  8981. except
  8982. end;
  8983. FFaceList.Delete(0);
  8984. end;
  8985. FFaceList.Clear;
  8986. FreeAndNil(FFaceList);
  8987. while FTempFaceList.Count > 0 do
  8988. begin
  8989. try
  8990. FTempFaceList.Objects[0].Free;
  8991. except
  8992. end;
  8993. FTempFaceList.Delete(0);
  8994. end;
  8995. FTempFaceList.Clear;
  8996. FreeAndNil(FTempFaceList);
  8997. FFaceCategory.Clear;
  8998. FreeAndNil(FFaceCategory);
  8999. FreeAndNil(FInputFont);
  9000. FreeAndNil(FDBHistory);
  9001. if HookID <> 0 then
  9002. UnHookWindowsHookEx(HookID);
  9003. if HotKeyID_ReadMessage <> 0 then
  9004. begin
  9005. UnregisterHotKey(Handle, HotKeyID_ReadMessage);
  9006. DeleteAtom(HotKeyID_ReadMessage);
  9007. end;
  9008. if HotKeyID_CopyScreen <> 0 then
  9009. begin
  9010. UnregisterHotKey(Handle, HotKeyID_CopyScreen);
  9011. DeleteAtom(HotKeyID_CopyScreen);
  9012. end;
  9013. finally
  9014. GetDataModule.Uninstall;
  9015. end;
  9016. end;
  9017. //------------------------------------------------------------------------------
  9018. procedure TMainForm.FormResize(Sender: TObject);
  9019. var
  9020. iLoop: Integer;
  9021. ContacterTreeView: TRealICQContacterTreeView;
  9022. FriendTreeView: TRealICQContacterTreeView;
  9023. ListView: TRealICQContacterListView;
  9024. begin
  9025. ShowMeInformation;
  9026. if FContacterTreeViews = nil then
  9027. Exit;
  9028. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  9029. begin
  9030. ContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  9031. ContacterTreeView.ReDrawAll;
  9032. end;
  9033. {for iLoop := 0 to FContacterTreeViews.Count - 1 do
  9034. begin
  9035. FriendTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  9036. FriendTreeView.ReDrawAll;
  9037. end; }
  9038. for iLoop := 0 to FContacterListViews.Count - 1 do
  9039. begin
  9040. ListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  9041. ListView.ReDrawAll;
  9042. end;
  9043. if FLVNetWorkDisk <> nil then
  9044. FLVNetWorkDisk.ReDrawAll;
  9045. if FTVCustomerLatests <> nil then
  9046. FTVCustomerLatests.ReDrawAll;
  9047. pnlSearchMoreUser.Width := pnlSelectServer.Width - 5;
  9048. ImgLogining.Left := (pnlSearchMoreUser.Width - ImgLogining.Width) div 2;
  9049. { TODO -olqq -c : 二维码居中 2014/12/14 11:05:27 }
  9050. Image1.Left := (Self.Width - Image1.Width - 26) div 2;
  9051. end;
  9052. //------------------------------------------------------------------------------
  9053. procedure TMainForm.SaveWindowState;
  9054. begin
  9055. if WindowState <> wsMaximized then
  9056. begin
  9057. FMainFormLeft := Left;
  9058. FMainFormTop := Top;
  9059. FMainFormHeight := Height;
  9060. FMainFormWidth := Width - pnlMiddleRight.Width;
  9061. try
  9062. SaveDefaultConfigs;
  9063. except
  9064. end;
  9065. end;
  9066. end;
  9067. //------------------------------------------------------------------------------
  9068. procedure TMainForm.sbpNewWebTabClick(Sender: TObject);
  9069. begin
  9070. AddWebBrowserToPageControl('about:blank', -1);
  9071. end;
  9072. //------------------------------------------------------------------------------
  9073. procedure TMainForm.sbpSMSClick(Sender: TObject);
  9074. begin
  9075. OpenSMSForm('', True);
  9076. end;
  9077. //------------------------------------------------------------------------------
  9078. procedure TMainForm.FormShow(Sender: TObject);
  9079. begin
  9080. try
  9081. //tsCustomers.Parent := nil;
  9082. //tsCustomers.PageControl := nil;
  9083. //pgcMainWorkArea.RemoveControl(tsCustomers);
  9084. //FreeAndNil(tsCustomers);
  9085. except
  9086. end;
  9087. //tsNetWorkDisk.Parent := nil;
  9088. //tsNetWorkDisk.PageControl := nil;
  9089. //pgcMainWorkArea.RemoveControl(tsNetWorkDisk);
  9090. //FreeAndNil(tsNetWorkDisk);
  9091. ClearMemory;
  9092. actOpenMainForm.Execute;
  9093. end;
  9094. procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
  9095. begin
  9096. if FSearchListViewInVisible then
  9097. begin
  9098. edFilterKeyword.Text := '';
  9099. edFilterKeyword.Font.Color := clGray;
  9100. end;
  9101. Action := caNone;
  9102. if pnlMiddleRight.Visible then
  9103. begin
  9104. ShowOrHideMuiltiWeb;
  9105. Exit;
  9106. end;
  9107. ZoomEffect(Self, zaMinimize);
  9108. ShowWindow(Handle, SW_HIDE);
  9109. FHidden := True;
  9110. end;
  9111. //------------------------------------------------------------------------------
  9112. procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  9113. begin
  9114. SaveWindowState;
  9115. end;
  9116. //------------------------------------------------------------------------------
  9117. procedure TMainForm.actLoginExecute(Sender: TObject);
  9118. begin
  9119. end;
  9120. //------------------------------------------------------------------------------
  9121. procedure TMainForm.actRegExecute(Sender: TObject);
  9122. begin
  9123. if RegForm <> nil then
  9124. Exit;
  9125. RegForm := TRegForm.Create(Self);
  9126. try
  9127. if RegForm.ShowModal <> mrOK then
  9128. begin
  9129. RealICQClient.CancelReg;
  9130. end;
  9131. finally
  9132. FreeAndNil(RegForm);
  9133. end;
  9134. end;
  9135. //------------------------------------------------------------------------------
  9136. procedure TMainForm.actDelFriendExecute(Sender: TObject);
  9137. var
  9138. ItemIndex: Integer;
  9139. RealICQFriendTreeView: TRealICQContacterTreeView;
  9140. Friend: TRealICQEmployee;
  9141. begin
  9142. if MessageBox(Handle, '确实要将选中的用户从好友列表中删除吗?', '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  9143. Exit;
  9144. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9145. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9146. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  9147. if (Friend <> nil) then
  9148. begin
  9149. if Friend.BranchID = LVFriends then
  9150. RealICQClient.DelFriend(Friend.LoginName);
  9151. end;
  9152. end;
  9153. //------------------------------------------------------------------------------
  9154. procedure TMainForm.actRemoveUserExecute(Sender: TObject);
  9155. var
  9156. ItemIndex: Integer;
  9157. GroupName: string;
  9158. RealICQFriendTreeView: TRealICQContacterTreeView;
  9159. Friend: TRealICQEmployee;
  9160. MenuItem: TMenuItem;
  9161. begin
  9162. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9163. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9164. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  9165. if Friend = nil then
  9166. Exit;
  9167. GroupName := Friend.BranchID;
  9168. if MessageBox(Handle, PChar('确实要将选中的用户从' + GroupName + '删除吗?'), '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  9169. Exit;
  9170. if FShowGroup and (FGroups.IndexOf(GroupName) <> -1) then
  9171. begin
  9172. MenuItem := miGroup.Find(LVFriends);
  9173. miMoveGroupClick(MenuItem);
  9174. exit;
  9175. end;
  9176. {
  9177. Screen.Cursor := crHourGlass;
  9178. Application.ProcessMessages;
  9179. try
  9180. if GroupName = lvBlacklists then
  9181. begin
  9182. RealICQClient.DelBlacklists(Friend.LoginName);
  9183. ShowAddFriendWindow(Self, Friend.LoginName, Friend.DisplayName);
  9184. Sleep(15);
  9185. end;
  9186. finally
  9187. Screen.Cursor := crDefault;
  9188. end;
  9189. }
  9190. end;
  9191. //------------------------------------------------------------------------------
  9192. procedure TMainForm.actLogoutExecute(Sender: TObject);
  9193. begin
  9194. if GetTalkingFormCount > 0 then
  9195. begin
  9196. if MessageBox(Handle, '确实要注销吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  9197. Exit;
  9198. CloseAllTalkingForm;
  9199. end;
  9200. CloseAllSMSForm;
  9201. RealICQClient.Logout;
  9202. RealICQClient.FriendCount := 0;
  9203. FIsLogout := True;
  9204. end;
  9205. //------------------------------------------------------------------------------
  9206. procedure TMainForm.actLoginAsExecute(Sender: TObject);
  9207. begin
  9208. if RegForm <> nil then
  9209. begin
  9210. MessageBox(RegForm.Handle, '请先关闭新用户注册窗口', '提示', MB_ICONINFORMATION);
  9211. Exit;
  9212. end;
  9213. RealICQClient.LoginAsSaved;
  9214. end;
  9215. //------------------------------------------------------------------------------
  9216. procedure TMainForm.actOfflieAutoResponseExecute(Sender: TObject);
  9217. begin
  9218. if OptionsForm <> nil then
  9219. Exit;
  9220. OptionsForm := TOptionsForm.Create(Self);
  9221. try
  9222. OptionsForm.PageIndex := 11;
  9223. OptionsForm.ShowModal;
  9224. finally
  9225. FreeAndNil(OptionsForm);
  9226. end;
  9227. end;
  9228. procedure TMainForm.actOnlineExecute(Sender: TObject);
  9229. begin
  9230. RealICQClient.ChangeState(TRealICQLoginState((Sender as TAction).Tag), (Sender as TAction).Caption);
  9231. end;
  9232. //------------------------------------------------------------------------------
  9233. procedure TMainForm.actHiddenExecute(Sender: TObject);
  9234. begin
  9235. RealICQClient.ChangeState(stHidden, '');
  9236. end;
  9237. //------------------------------------------------------------------------------
  9238. procedure TMainForm.actLeaveExecute(Sender: TObject);
  9239. begin
  9240. RealICQClient.ChangeState(stLeave, (Sender as TAction).Caption);
  9241. end;
  9242. //------------------------------------------------------------------------------
  9243. procedure TMainForm.actHelpExecute(Sender: TObject);
  9244. begin
  9245. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar('http://www.lxtalk.com'),'',SW_SHOWMAXIMIZED);
  9246. //ShellExecute(handle, 'open',PChar(GetDefaultBrowser), PChar('http://www.lxtalk.com'),'',SW_SHOWMAXIMIZED);
  9247. end;
  9248. //------------------------------------------------------------------------------
  9249. procedure TMainForm.actOtherStateExecute(Sender: TObject);
  9250. var
  9251. LeaveMessage: string;
  9252. begin
  9253. LeaveMessage := Trim(ShowMyInputBox('其它状态', '请输入离开状态说明文字', '', 16));
  9254. if Length(LeaveMessage) > 0 then
  9255. RealICQClient.ChangeState(stLeave, LeaveMessage);
  9256. end;
  9257. //------------------------------------------------------------------------------
  9258. procedure TMainForm.RealICQClientLoginResult(Sender: TObject; LoginResultType: TRealICQLoginResultType; ResultMessage: string);
  9259. var
  9260. DBFileName: string;
  9261. hwnd: THandle;
  9262. begin
  9263. TimerForLogining.Enabled := False;
  9264. if not FCheckedUpdate then
  9265. begin
  9266. if not FileExists(ExtractFilePath(paramstr(0)) + 'Online.exe') then
  9267. DownLoadUpdateConfig
  9268. else
  9269. WinExec(PChar(ExtractFilePath(paramstr(0)) + 'Online.exe /S0 /C /Q'), SW_SHOW);
  9270. end;
  9271. FCheckedUpdate := not FCheckedUpdate;
  9272. case LoginResultType of
  9273. rtLoginOK, rtCanUpdate:
  9274. begin
  9275. Success('成功联上服务器!', 'TMainForm.RealICQClientLoginResult');
  9276. AddMessageHistory(smSimple, '登录至服务器', nil);
  9277. lblLoginState.Caption := '已登录,数据下载中...';
  9278. lblLoginState.Refresh;
  9279. lblNDState.Caption := RealICQClient.NetWorkDiskServerAddress + '(' + IntToStr(RealICQClient.NetWorkDiskServerPort) + ')';
  9280. DBFileName := RealICQClient.GetUserDir + PersonalMessageHistoryDBFile;
  9281. if not FileExists(DBFileName) then
  9282. CopyFile(PChar(ExtractFilePath(paramstr(0)) + MessageHistoryDBFile), PChar(DBFileName), False);
  9283. try
  9284. FDBHistory.LoginName := RealICQClient.LoginName;
  9285. FDBHistory.DBFileName := DBFileName;
  9286. except
  9287. on E: Exception do
  9288. begin
  9289. Error(E.Message, 'LoginResult 加载本地数据库失败');
  9290. end;
  9291. end;
  9292. // btShowMiniPage.Visible := RealICQClient.ShowMiniPage;
  9293. if RealICQClient.WorkingMode = wmPublic then
  9294. begin
  9295. {$region 'wmPublic工作模式'}
  9296. { AddContacterListView(navForContacters.Groups.Objects[0] as TScrollBox, LVFriends);
  9297. navForContacters.Groups[0] := LVFriends;
  9298. AddContacterListView(navForContacters.Groups.Objects[1] as TScrollBox, LVStrangers);
  9299. navForContacters.Groups[1] := LVStrangers;
  9300. AddContacterListView(navForContacters.Groups.Objects[2] as TScrollBox, LVBlacklists);
  9301. navForContacters.Groups[2] := LVBlacklists; }
  9302. {$endregion}
  9303. end
  9304. else if RealICQClient.WorkingMode = wmCorporation then
  9305. begin
  9306. {$region 'wmCorporation'}
  9307. FShowGroup := False;
  9308. AddFriendTreeView(ScrollBoxMyFriend, LVFriends);
  9309. AddContacterTreeView(ScrollBoxContacters, LVMyContacters);
  9310. AddContacterTreeView(ScrollBoxAddrBook, LVAddrBook);
  9311. /// <remarks>
  9312. /// LQQ
  9313. /// 把请求当前用户从RealICQClient移动到BranchService
  9314. /// </remarks>
  9315. TMessagesHander.GetHander.Init;
  9316. {$endregion}
  9317. end;
  9318. TMainFormController.GetController.LoginToAppCentre(RealICQClient.LoginName);
  9319. TTeamsAdapter.Start(RealICQClient.LoginName);
  9320. TGroupShareConfig.GetConfig.URL := RealICQClient.HeadImageURL;
  9321. end;
  9322. rtMustUpdate:
  9323. begin
  9324. //启动升级程序
  9325. hWnd := FindWindow(pchar('TUpdateFrm'), pchar(trim('自动更新')));
  9326. if hWnd = 0 then
  9327. WinExec('Update.exe', SW_SHOW);
  9328. end;
  9329. rtVersionError:
  9330. MessageBox(Handle, '抱歉,您当前使用的客户端版本不受支持', '登录失败', MB_ICONINFORMATION);
  9331. rtLoginErrorByDisplayName:
  9332. MessageBox(Handle, '存在姓名相同的用户,请使用登录名登录!', '登录失败', MB_ICONINFORMATION);
  9333. rtAuthorizationError:
  9334. begin
  9335. MessageBox(Handle, '用户名或密码错误', '登录失败', MB_ICONINFORMATION);
  9336. RealICQClient.ClearSavedPassword;
  9337. actLoginAs.Visible := False;
  9338. SetLoginControlsVisible(True);
  9339. end;
  9340. rtOther:
  9341. MessageBox(Handle, PChar(ResultMessage), '登录失败', MB_ICONINFORMATION);
  9342. end;
  9343. end;
  9344. //------------------------------------------------------------------------------
  9345. procedure TMainForm.RealICQClientLoginStateChanged(Sender: TObject);
  9346. begin
  9347. if not RealICQClient.Logined then
  9348. TimerForCheckLogoutTimeout.Enabled := False;
  9349. SetUIState;
  9350. ClearMemory;
  9351. end;
  9352. //------------------------------------------------------------------------------
  9353. procedure TMainForm.RealICQClientPleaseSendFaceToMe(Sender: TObject; ALoginName, AFaceMD5Code: string);
  9354. var
  9355. iIndex: Integer;
  9356. Face: TFace;
  9357. begin
  9358. iIndex := FFaceList.IndexOf(AFaceMD5Code);
  9359. if iIndex >= 0 then
  9360. begin
  9361. Face := FFaceList.Objects[iIndex] as TFace;
  9362. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, Face.FileName, foFace);
  9363. Exit;
  9364. end;
  9365. iIndex := FTempFaceList.IndexOf(AFaceMD5Code);
  9366. if iIndex >= 0 then
  9367. begin
  9368. Face := FTempFaceList.Objects[iIndex] as TFace;
  9369. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, Face.FileName, foFace);
  9370. Exit;
  9371. end;
  9372. if FileExists(FindRecvedFace(AFaceMD5Code)) then
  9373. begin
  9374. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, FindRecvedFace(AFaceMD5Code), foFace);
  9375. Exit;
  9376. end
  9377. end;
  9378. //------------------------------------------------------------------------------
  9379. procedure TMainForm.RealICQClientPleaseUploadTeamFace(Sender: TObject; MD5String: string; var FileName: string);
  9380. var
  9381. iIndex: Integer;
  9382. Face: TFace;
  9383. begin
  9384. iIndex := FFaceList.IndexOf(MD5String);
  9385. if iIndex >= 0 then
  9386. begin
  9387. Face := FFaceList.Objects[iIndex] as TFace;
  9388. FileName := Face.FileName;
  9389. Exit;
  9390. end;
  9391. iIndex := FTempFaceList.IndexOf(MD5String);
  9392. if iIndex >= 0 then
  9393. begin
  9394. Face := FTempFaceList.Objects[iIndex] as TFace;
  9395. FileName := Face.FileName;
  9396. Exit;
  9397. end;
  9398. if FileExists(FindRecvedFace(MD5String)) then
  9399. begin
  9400. FileName := FindRecvedFace(MD5String);
  9401. Exit;
  9402. end
  9403. end;
  9404. //------------------------------------------------------------------------------
  9405. procedure TMainForm.RealICQClientReConnectExecute(Sender: TObject; ASeconds: Integer);
  9406. begin
  9407. TimerForLogining.Enabled := False;
  9408. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  9409. TrayIcon.SetDefaultIcon;
  9410. lblLoginState.Caption := '连接已中断' + #$D#$A + IntToStr(ASeconds) + ' 秒后重新建立连接。';
  9411. lblLoginState.Visible := True;
  9412. SetLoginControlsVisible(False);
  9413. if not btLogin.Visible then
  9414. begin
  9415. btLogin.Visible := True;
  9416. btLogin.Caption := '取消(&C)';
  9417. btLogin.Refresh;
  9418. end;
  9419. lblReConnect.Visible := True;
  9420. TimerForCheckLogoutTimeout.Enabled := False;
  9421. if not RealICQClient.ReConnectExecuting then
  9422. RealICQClient.CancelReConnectAndLogin;
  9423. end;
  9424. //------------------------------------------------------------------------------
  9425. procedure TMainForm.RealICQClientRemovedUser(Sender: TObject; ALoginName: string);
  9426. var
  9427. itemIndex: Integer;
  9428. RealICQFriendTreeView: TRealICQContacterTreeView;
  9429. // Friend: TRealICQEmployee;
  9430. // Node: TTreeNode;
  9431. begin
  9432. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9433. if ItemIndex >= 0 then
  9434. begin
  9435. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9436. ItemIndex := RealICQFriendTreeView.EmployeeItems.IndexOf(ALoginName);
  9437. if ItemIndex >= 0 then
  9438. RealICQFriendTreeView.EmployeeItems.Delete(ItemIndex);
  9439. end;
  9440. // ShowNavBarNumeric;
  9441. end;
  9442. //------------------------------------------------------------------------------
  9443. procedure TMainForm.TimerForFlashTrayIconTimer(Sender: TObject);
  9444. var
  9445. Icon: TIcon;
  9446. Bitmap: TBitmap;
  9447. MessageID: string;
  9448. RealICQUser: TRealICQUser;
  9449. begin
  9450. if FNotReadMessages.Count = 0 then
  9451. begin
  9452. NotReadMessageBoxForm.Visible := False;
  9453. TimerForFlashTrayIcon.Enabled := False;
  9454. ShowMeInformation;
  9455. Exit;
  9456. end;
  9457. if not (RealICQClient.Logined and RealICQClient.Connected) then
  9458. begin
  9459. TimerForFlashTrayIcon.Enabled := False;
  9460. NotReadMessageBoxForm.Visible := False;
  9461. Exit;
  9462. end;
  9463. Icon := nil;
  9464. Bitmap := nil;
  9465. MessageID := FNotReadMessages.Strings[FNotReadMessages.Count - 1];
  9466. if AnsiSameStr(Copy(MessageID, 1, Length(SMSMessageID)), SMSMessageID) then
  9467. begin
  9468. Icon := TIcon.Create;
  9469. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSMessageIcon);
  9470. end
  9471. else if AnsiSameStr(Copy(MessageID, 1, Length(TeamMessageID)), TeamMessageID) then
  9472. begin
  9473. Icon := TIcon.Create;
  9474. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamIcon);
  9475. end
  9476. else if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  9477. begin
  9478. Icon := TIcon.Create;
  9479. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessageIcon);
  9480. end
  9481. else
  9482. begin
  9483. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(MessageID);
  9484. if FileExists(RealICQUser.HeadImageFile) then
  9485. begin
  9486. try
  9487. Bitmap := GetSamllBitmap(RealICQUser.HeadImageFile, 16, 16, False);
  9488. except
  9489. Icon := TIcon.Create;
  9490. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  9491. end;
  9492. end
  9493. else
  9494. begin
  9495. Icon := TIcon.Create;
  9496. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  9497. end;
  9498. end;
  9499. try
  9500. while ImgLstForFlashTrayIcon.Count > 1 do
  9501. ImgLstForFlashTrayIcon.Delete(1);
  9502. if Icon <> nil then
  9503. ImgLstForFlashTrayIcon.AddIcon(Icon)
  9504. else if Bitmap <> nil then
  9505. ImgLstForFlashTrayIcon.Add(Bitmap, nil);
  9506. finally
  9507. try
  9508. FreeAndNil(Bitmap);
  9509. FreeAndNil(Icon);
  9510. except
  9511. end;
  9512. end;
  9513. ImgLstForFlashTrayIcon.GetIcon(FFlashTrayIconIndex, TrayIcon.Icon);
  9514. TrayIcon.SetDefaultIcon;
  9515. if FFlashTrayIconIndex <> 0 then
  9516. FFlashTrayIconIndex := 0
  9517. else
  9518. FFlashTrayIconIndex := 1;
  9519. end;
  9520. //------------------------------------------------------------------------------
  9521. procedure TMainForm.TimerForLoginingTimer(Sender: TObject);
  9522. begin
  9523. ImgLstForLogining.GetIcon(FFlashTrayIconIndexAtLogining, TrayIcon.Icon);
  9524. TrayIcon.SetDefaultIcon;
  9525. Inc(FFlashTrayIconIndexAtLogining);
  9526. if FFlashTrayIconIndexAtLogining >= ImgLstForLogining.Count then
  9527. FFlashTrayIconIndexAtLogining := 0;
  9528. // TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  9529. // TrayIcon.SetDefaultIcon;
  9530. end;
  9531. procedure TMainForm.TimerForreconnectgroupTimer(Sender: TObject);
  9532. begin
  9533. if (realICQClient.Logined and realICQClient.Connected) then
  9534. begin
  9535. { TODO -olqq -c : 重连的时候,做下异常处理 2014/12/12 15:36:23 }
  9536. try
  9537. TTeamsAdapter.Start(RealICQClient.LoginName);
  9538. { TODO -olqq -c : 在procedure TGroup.OnOpen中有重复 2014/12/12 15:41:02 }
  9539. //WebSocketTeamSubscribe;
  9540. except
  9541. on E: Exception do
  9542. Log(E.Message, 'TMainForm.TimerForreconnectgroupTimer');
  9543. end;
  9544. end;
  9545. end;
  9546. //------------------------------------------------------------------------------
  9547. procedure TMainForm.StopFlashTeam(ATeamID: string);
  9548. var
  9549. ItemIndex: Integer;
  9550. ListItem: TRealICQContacterListItem;
  9551. begin
  9552. ItemIndex := FLVTeams.Items.IndexOf(ATeamID);
  9553. if ItemIndex >= 0 then
  9554. begin
  9555. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9556. ListItem.StopFlash;
  9557. end;
  9558. end;
  9559. procedure TMainForm.SysMsgClick(Sender: TObject);
  9560. begin
  9561. RealICQClient.SendGetMoreServerList;
  9562. end;
  9563. procedure TMainForm.SysMsgIconClick(Sender: TObject);
  9564. begin
  9565. RealICQClient.SendGetMoreServerList;
  9566. end;
  9567. //------------------------------------------------------------------------------
  9568. procedure TMainForm.StopFlash(ALoginName: string);
  9569. var
  9570. ItemIndex: Integer;
  9571. RealICQContacterListView: TRealICQContacterListView;
  9572. RealICQContacterListItem: TRealICQContacterListItem;
  9573. RealICQFriendTreeView: TRealICQContacterTreeView;
  9574. RealICQContacterTreeView: TRealICQContacterTreeView;
  9575. Employee: TRealICQEmployee;
  9576. Friend: TRealICQEmployee;
  9577. begin
  9578. ItemIndex := FSearchListView.Items.IndexOf(ALoginName);
  9579. if ItemIndex >= 0 then
  9580. begin
  9581. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9582. RealICQContacterListItem.StopFlash;
  9583. end;
  9584. if (RealICQClient.WorkingMode = wmCorporation) or (FShowTree and (TFriendsService.GetService.IsFriend(ALoginName)) and (TWorkmatesService.GetService.IsWorkmate(ALoginName))) then
  9585. begin
  9586. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  9587. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9588. if RealICQContacterTreeView <> nil then
  9589. begin
  9590. Employee := RealICQContacterTreeView.GetEmployee(ALoginName);
  9591. if Employee <> nil then
  9592. Employee.StopFlash
  9593. else
  9594. begin
  9595. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9596. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9597. if RealICQFriendTreeView <> nil then
  9598. begin
  9599. Friend := RealICQFriendTreeView.GetEmployee(ALoginName);
  9600. if Friend <> nil then
  9601. Friend.StopFlash;
  9602. end;
  9603. end;
  9604. end;
  9605. end
  9606. else
  9607. begin
  9608. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  9609. if RealICQContacterListView <> nil then
  9610. begin
  9611. ItemIndex := RealICQContacterListView.Items.IndexOf(ALoginName);
  9612. if ItemIndex >= 0 then
  9613. begin
  9614. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9615. RealICQContacterListItem.StopFlash;
  9616. end;
  9617. end;
  9618. end;
  9619. end;
  9620. procedure TMainForm.WMHotKeyHandle(var Msg: TWMHotKey);
  9621. var
  9622. iLoop: Integer;
  9623. AForm: TTalkingForm;
  9624. begin
  9625. msg.Result := 1; //该消息已经处理
  9626. if msg.HotKey = HotKeyID_ReadMessage then
  9627. begin
  9628. TrayIconDblClick(TrayIcon);
  9629. end;
  9630. if msg.HotKey = HotKeyID_CopyScreen then
  9631. begin
  9632. for iLoop := 0 to TalkingForms.Count - 1 do
  9633. begin
  9634. AForm := TalkingForms[iLoop];
  9635. if AForm.Active then
  9636. begin
  9637. ShowCopyScreenForm(AForm);
  9638. Exit;
  9639. end;
  9640. end;
  9641. ShowCopyScreenForm(nil);
  9642. end;
  9643. end;
  9644. //------------------------------------------------------------------------------
  9645. procedure TMainForm.ShowRealICQMessage(RealICQMessage: TRealICQMessage; ShowSendFailed: Boolean; ARealICQClient: TRealICQClient);
  9646. var
  9647. LoginName: string;
  9648. iIndex, ItemIndex: Integer;
  9649. TalkingForm: TTalkingForm;
  9650. MessageList: TList;
  9651. NotReadMessage: TNotReadMessage;
  9652. RealICQContacterListView: TRealICQContacterListView;
  9653. RealICQContacterListItem: TRealICQContacterListItem;
  9654. RealICQContacterTreeView: TRealICQContacterTreeView;
  9655. Employee: TRealICQEmployee;
  9656. RealICQFriendTreeView: TRealICQContacterTreeView;
  9657. Friend: TRealICQEmployee;
  9658. NeedAddToNotReadMessages: Boolean;
  9659. begin
  9660. try
  9661. RealICQMessage.MessageStr := TTextMessageService.GetService.ContentFilter(RealICQMessage);
  9662. FDBHistory.SaveMessage('-1', RealICQMessage.Sender, RealICQMessage.Receiver, RealICQMessage.SendDateTime, RealICQMessage.FontStr, RealICQMessage.MessageStr, RealICQMessage.IsEncryMessage);
  9663. if RealICQMessage.IsEncryMessage then
  9664. RealICQMessage.ID := FDBHistory.GetMaxMessageId;
  9665. except
  9666. end;
  9667. if AnsiSameText(RealICQMessage.Sender, ARealICQClient.LoginName) then
  9668. LoginName := RealICQMessage.Receiver
  9669. else
  9670. LoginName := RealICQMessage.Sender;
  9671. TalkingForm := GetTalkingForm(LoginName, ARealICQClient);
  9672. if TalkingForm = nil then
  9673. NeedAddToNotReadMessages := True
  9674. else
  9675. NeedAddToNotReadMessages := not TalkingForm.CanWriteMessage;
  9676. if NeedAddToNotReadMessages then
  9677. begin
  9678. NotReadMessage := TNotReadMessage.Create;
  9679. NotReadMessage.FRealICQMessage := RealICQMessage;
  9680. NotReadMessage.FShowSendFailed := ShowSendFailed;
  9681. NotReadMessage.FRealICQClient := ARealICQClient;
  9682. iIndex := FNotReadMessages.IndexOf(LoginName);
  9683. if iIndex >= 0 then
  9684. begin
  9685. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  9686. MessageList.Add(NotReadMessage);
  9687. end
  9688. else
  9689. begin
  9690. if MessageBoxForm = nil then
  9691. begin
  9692. {$region '跳动头像'}
  9693. ItemIndex := FSearchListView.Items.IndexOf(LoginName);
  9694. if ItemIndex >= 0 then
  9695. begin
  9696. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9697. if FlashImageOnGetMessage then
  9698. RealICQContacterListItem.Flash(fsJump);
  9699. end;
  9700. if (RealICQClient.WorkingMode = wmCorporation) or (FShowTree and TUsersService.GetUsersService.IsWorkmateOrFriend(LoginName)) then
  9701. begin
  9702. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  9703. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9704. if RealICQContacterTreeView <> nil then
  9705. begin
  9706. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  9707. if Employee <> nil then
  9708. begin
  9709. if FlashImageOnGetMessage then
  9710. Employee.Flash(fsJump);
  9711. end
  9712. else
  9713. begin
  9714. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9715. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9716. if RealICQFriendTreeView <> nil then
  9717. begin
  9718. Friend := RealICQFriendTreeView.GetEmployee(LoginName);
  9719. if Friend <> nil then
  9720. if FlashImageOnGetMessage then
  9721. Friend.Flash(fsJump)
  9722. end;
  9723. end;
  9724. end;
  9725. end
  9726. else
  9727. begin
  9728. RealICQContacterListView := GetListViewByLoginName(LoginName);
  9729. if RealICQContacterListView <> nil then
  9730. begin
  9731. ItemIndex := RealICQContacterListView.Items.IndexOf(LoginName);
  9732. if ItemIndex >= 0 then
  9733. begin
  9734. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9735. if FlashImageOnGetMessage then
  9736. RealICQContacterListItem.Flash(fsJump);
  9737. end;
  9738. end; // if RealICQContacterListView <> nil ...
  9739. end;
  9740. {$endregion}
  9741. end;
  9742. MessageList := TList.Create;
  9743. MessageList.Add(NotReadMessage);
  9744. FNotReadMessages.AddObject(LoginName, MessageList);
  9745. end;
  9746. if MessageBoxForm <> nil then
  9747. begin
  9748. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  9749. FlashWindow(MessageBoxForm.Handle, True);
  9750. MessageBoxForm.ShowMessage(RealICQMessage.Sender, MTUser);
  9751. Exit;
  9752. end
  9753. else if (not TimerForFlashTrayIcon.Enabled) then
  9754. TimerForFlashTrayIcon.Enabled := True;
  9755. if PlaySoundOnGetMessage then
  9756. PlayEventSound(FMessageEventSound);
  9757. NotReadMessageBoxForm.ShowNotReadMessage;
  9758. NotReadMessageBoxForm.Height := 0;
  9759. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  9760. end
  9761. else
  9762. begin
  9763. if (GetForegroundWindow <> TalkingForm.Handle) then
  9764. begin
  9765. FlashWindow(TalkingForm.Handle, True);
  9766. if PlaySoundOnGetMessage then
  9767. PlayEventSound(FMessageEventSound);
  9768. end;
  9769. TalkingForm.ShowMessage(RealICQMessage, ShowSendFailed);
  9770. end;
  9771. end;
  9772. //------------------------------------------------------------------------------
  9773. procedure TMainForm.RealICQClientSendedSendFileRequest(Sender, FileTransmitter: TObject);
  9774. var
  9775. PtoPFileTransmitter: TPtoPFileTransmitter;
  9776. TalkingForm: TTalkingForm;
  9777. ALoginName: string;
  9778. RealICQUser: TRealICQUser;
  9779. ItemIndex: Integer;
  9780. RealICQContacterListItem: TRealICQContacterListItem;
  9781. begin
  9782. PtoPFileTransmitter := FileTransmitter as TPtoPFileTransmitter;
  9783. if PtoPFileTransmitter.Objective = foFace then
  9784. begin
  9785. TalkingForm := GetTalkingForm(PtoPFileTransmitter.LoginName, Sender as TRealICQClient);
  9786. if TalkingForm = nil then
  9787. Exit;
  9788. end
  9789. else
  9790. begin
  9791. TalkingForm := OpenTalkingForm(PtoPFileTransmitter.LoginName, True, Sender as TRealICQClient);
  9792. end;
  9793. if TalkingForm.CanWriteMessage then
  9794. TalkingForm.ShowSendedSendFileRequest(PtoPFileTransmitter);
  9795. {$region '更新“最近联系人列表”中的数据'}
  9796. if Sender = RealICQClient then
  9797. begin
  9798. ALoginName := PtoPFileTransmitter.LoginName;
  9799. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  9800. if RealICQUser <> nil then
  9801. begin
  9802. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  9803. if ItemIndex = -1 then
  9804. ItemIndex := FLVLatests.Items.Add(ALoginName);
  9805. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9806. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  9807. RealICQContacterListItem.MoveToTop;
  9808. end;
  9809. end;
  9810. {$endregion}
  9811. end;
  9812. //------------------------------------------------------------------------------
  9813. procedure TMainForm.RealICQClientSendedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  9814. begin
  9815. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  9816. end;
  9817. procedure TMainForm.RealICQClientCancelControlRemoteControlTransmite(Sender: TObject; ALoginName: string);
  9818. var
  9819. TalkingForm: TTalkingForm;
  9820. begin
  9821. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9822. if TalkingForm = nil then
  9823. Exit;
  9824. if TalkingForm.CanWriteMessage then
  9825. TalkingForm.ShowCancelControlRemoteControlTransmite;
  9826. end;
  9827. procedure TMainForm.RealICQClientCanceledSendFolder(Sender: TObject; AID: Cardinal; ALoginName: string);
  9828. var
  9829. ReceiveFolderRequestForm: TReceiveFolderRequestForm;
  9830. iLoop: Integer;
  9831. begin
  9832. for iLoop := 0 to ReceiveFolderForms.Count - 1 do
  9833. begin
  9834. ReceiveFolderRequestForm := TReceiveFolderRequestForm(ReceiveFolderForms[iLoop]);
  9835. if (ReceiveFolderRequestForm.FID = AID) and AnsiSameText(ALoginName, ReceiveFolderRequestForm.FLoginName) then
  9836. begin
  9837. ReceiveFolderRequestForm.CanceledSendFolder;
  9838. Break;
  9839. end;
  9840. end;
  9841. end;
  9842. procedure TMainForm.RealICQClientCancelSendFile(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  9843. var
  9844. TalkingForm: TTalkingForm;
  9845. iWaitTimes: Integer;
  9846. begin
  9847. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9848. if TalkingForm <> nil then
  9849. begin
  9850. if (GetForegroundWindow <> TalkingForm.Handle) then
  9851. begin
  9852. FlashWindow(TalkingForm.Handle, True);
  9853. if PlaySoundOnGetMessage then
  9854. PlayEventSound(FMessageEventSound);
  9855. end;
  9856. iWaitTimes := 0;
  9857. while not TalkingForm.CanWriteMessage do
  9858. begin
  9859. Application.ProcessMessages;
  9860. Inc(iWaitTimes);
  9861. if iWaitTimes > 1000 then
  9862. break;
  9863. Sleep(10);
  9864. end;
  9865. TalkingForm.ShowCancelSendFile(AOppositeID);
  9866. end;
  9867. end;
  9868. procedure TMainForm.RealICQClientChangePasswordResult(Sender: TObject; APassChanged: Boolean; ANewPassword: string);
  9869. begin
  9870. end;
  9871. //------------------------------------------------------------------------------
  9872. procedure TMainForm.RealICQClientGettedSendFileRequest(Sender: TObject; SendFileRequestInfo: TSendFileRequestInfo);
  9873. var
  9874. AShowActive: Boolean;
  9875. TalkingForm: TTalkingForm;
  9876. iWaitTimes: Integer;
  9877. ALoginName: string;
  9878. RealICQUser: TRealICQUser;
  9879. ItemIndex: Integer;
  9880. RealICQContacterListItem: TRealICQContacterListItem;
  9881. begin
  9882. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  9883. TalkingForm := GetTalkingForm(SendFileRequestInfo.LoginName, Sender as TRealICQClient);
  9884. if TalkingForm = nil then
  9885. begin
  9886. TalkingForm := OpenTalkingForm(SendFileRequestInfo.LoginName, not AShowActive, Sender as TRealICQClient);
  9887. end;
  9888. iWaitTimes := 0;
  9889. while not TalkingForm.CanWriteMessage do
  9890. begin
  9891. Application.ProcessMessages;
  9892. Inc(iWaitTimes);
  9893. if iWaitTimes > 1000 then
  9894. break;
  9895. Sleep(10);
  9896. end;
  9897. if (GetForegroundWindow <> TalkingForm.Handle) and (SendFileRequestInfo.Objective = foFile) then
  9898. begin
  9899. FlashWindow(TalkingForm.Handle, True);
  9900. if PlaySoundOnGetMessage then
  9901. PlayEventSound(FMessageEventSound);
  9902. end;
  9903. TalkingForm.ShowGettedSendFileRequest(SendFileRequestInfo);
  9904. {$region '更新“最近联系人列表”中的数据'}
  9905. if Sender = RealICQClient then
  9906. begin
  9907. ALoginName := SendFileRequestInfo.LoginName;
  9908. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  9909. if RealICQUser <> nil then
  9910. begin
  9911. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  9912. if ItemIndex = -1 then
  9913. ItemIndex := FLVLatests.Items.Add(ALoginName);
  9914. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9915. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  9916. RealICQContacterListItem.MoveToTop;
  9917. end;
  9918. end;
  9919. {$endregion}
  9920. end;
  9921. procedure TMainForm.RealICQClientGettedSendFolderRequest(Sender: TObject; AID, ACount: Cardinal; ALoginName: string; AFilesStream: TStream);
  9922. var
  9923. ReceiveFolderRequestForm: TReceiveFolderRequestForm;
  9924. begin
  9925. ReceiveFolderRequestForm := TReceiveFolderRequestForm.Create(Self);
  9926. ReceiveFolderRequestForm.FCount := ACount;
  9927. ReceiveFolderRequestForm.FID := AID;
  9928. ReceiveFolderRequestForm.FLoginName := ALoginName;
  9929. ReceiveFolderRequestForm.FFilesStream := AFilesStream;
  9930. ReceiveFolderRequestForm.Show;
  9931. ReceiveFolderRequestForm.BringToFront;
  9932. end;
  9933. procedure TMainForm.RealICQClientGettedSendOfflineFileRequest(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  9934. var
  9935. TalkingForm: TTalkingForm;
  9936. iWaitTimes: Integer;
  9937. begin
  9938. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9939. if TalkingForm <> nil then
  9940. begin
  9941. if (GetForegroundWindow <> TalkingForm.Handle) then
  9942. begin
  9943. FlashWindow(TalkingForm.Handle, True);
  9944. if PlaySoundOnGetMessage then
  9945. PlayEventSound(FMessageEventSound);
  9946. end;
  9947. iWaitTimes := 0;
  9948. while not TalkingForm.CanWriteMessage do
  9949. begin
  9950. Application.ProcessMessages;
  9951. Inc(iWaitTimes);
  9952. if iWaitTimes > 1000 then
  9953. break;
  9954. Sleep(10);
  9955. end;
  9956. TalkingForm.ShowSendOfflineFileRequest(AOppositeID);
  9957. end;
  9958. end;
  9959. //------------------------------------------------------------------------------
  9960. procedure TMainForm.RealICQClientSendMessageFailed(Sender: TObject; RealICQMessage: TRealICQMessage);
  9961. begin
  9962. ShowRealICQMessage(RealICQMessage, True, Sender as TRealICQClient);
  9963. end;
  9964. //------------------------------------------------------------------------------
  9965. procedure TMainForm.RealICQClientSendTeamMessageFailed(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  9966. begin
  9967. ShowRealICQTeamMessage(RealICQTeamMessage, True);
  9968. end;
  9969. //------------------------------------------------------------------------------
  9970. procedure TMainForm.RealICQClientShakeWindow(Sender: TObject; ALoginName: string);
  9971. var
  9972. TalkingForm: TTalkingForm;
  9973. iWaitTimes: Integer;
  9974. begin
  9975. if not MainForm.ShowShakeWindow then
  9976. Exit;
  9977. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9978. if TalkingForm = nil then
  9979. begin
  9980. TalkingForm := OpenTalkingForm(ALoginName, True, Sender as TRealICQClient);
  9981. end;
  9982. iWaitTimes := 0;
  9983. while not TalkingForm.CanWriteMessage do
  9984. begin
  9985. Application.ProcessMessages;
  9986. Inc(iWaitTimes);
  9987. if iWaitTimes > 1000 then
  9988. break;
  9989. Sleep(10);
  9990. end;
  9991. if GetTickCount - TalkingForm.LastRecvShakeWindowTicket < 150000 then
  9992. Exit;
  9993. ForceForeGroundWindow(TalkingForm.Handle);
  9994. TalkingForm.ShowShakeWindow(False);
  9995. TalkingForm.LastRecvShakeWindowTicket := GetTickCount;
  9996. end;
  9997. //------------------------------------------------------------------------------
  9998. procedure TMainForm.RealICQClientSMSResult(Sender: TObject; AMessageID: Cardinal; AResult: Integer);
  9999. var
  10000. iIndex: Integer;
  10001. SMSMessage: TSMSMessage;
  10002. begin
  10003. iIndex := SMSMessages.IndexOf(IntToStr(AMessageID));
  10004. if iIndex >= 0 then
  10005. begin
  10006. SMSMessage := SMSMessages.Objects[iIndex] as TSMSMessage;
  10007. SMSMessage.Sended := AResult = 0;
  10008. SMSMessage.SMSForm.ShowSMSMessageResult(AMessageID, AResult);
  10009. end;
  10010. end;
  10011. //------------------------------------------------------------------------------
  10012. procedure TMainForm.RealICQClientTeamInfoReady(Sender: TObject; ARealICQTeam: TRealICQTeam);
  10013. var
  10014. iLoop, iIndex: Integer;
  10015. ListItem: TRealICQContacterListItem;
  10016. MemberList: TStringList;
  10017. begin
  10018. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  10019. if iIndex = -1 then
  10020. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  10021. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  10022. if ARealICQTeam.IsTempTeam then
  10023. ListItem.Watchword := ''
  10024. else
  10025. ListItem.Watchword := ARealICQTeam.TeamIntro;
  10026. ListItem.LoginState := stLeave;
  10027. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  10028. try
  10029. for iLoop := MemberList.Count - 1 downto 0 do
  10030. begin
  10031. if Length(Trim(MemberList[iLoop])) = 0 then
  10032. MemberList.Delete(iLoop);
  10033. end;
  10034. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  10035. finally
  10036. MemberList.Free;
  10037. end;
  10038. {try
  10039. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  10040. except
  10041. ListItem.HeadImagePicture.Graphic := nil;
  10042. end; }
  10043. if ARealICQTeam.IsTempTeam then
  10044. ListItem.DisplayName := '多人对话'
  10045. else
  10046. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  10047. ListItem.Data := ARealICQTeam;
  10048. ListItem.ReDrawItem;
  10049. ShowNavBarNumeric;
  10050. // UpdateTeamOptionsForm(ARealICQTeam);
  10051. UpdateTeamTalkingForm(ARealICQTeam);
  10052. end;
  10053. //------------------------------------------------------------------------------
  10054. procedure TMainForm.RealICQClientReceivedAdversement(Sender: TObject);
  10055. begin
  10056. if (not RealICQClient.MainFormAdversement.Visible) then
  10057. begin
  10058. if pnlAdvertisement.Height > 0 then
  10059. pnlAdvertisement.Height := 0;
  10060. end
  10061. else
  10062. begin
  10063. WebBrowserForAdvertisement.OnBeforeNavigate2 := nil;
  10064. pnlForHideWebBrowser.Visible := True;
  10065. pnlForHideWebBrowser.BringToFront;
  10066. WebBrowserForAdvertisement.OnDocumentComplete := WebBrowserForAdvertisementDocumentComplete;
  10067. WebBrowserForAdvertisement.Navigate(AnsiReplaceText(AnsiReplaceText(RealICQClient.MainFormAdversement.URL, '[%LoginName%]', RealICQClient.LoginName), '[%BranchID%]', RealICQClient.Me.BranchID));
  10068. pnlWebSearch.Top := pnlAdvertisement.Top + pnlAdvertisement.Height + 1;
  10069. end;
  10070. UpdateTalkingFormAdversement;
  10071. end;
  10072. //------------------------------------------------------------------------------
  10073. procedure TMainForm.RealICQClientReceivedCustomMessage(Sender: TObject; AContent: string);
  10074. var
  10075. Contents: TStringList;
  10076. LoginName: string;
  10077. SystemMessage: TRealICQSystemMessage;
  10078. jo: ISuperObject;
  10079. reg: TPerlRegEx;
  10080. begin
  10081. if AnsiSameText('ReGetCountByReceiver', AContent) then
  10082. begin
  10083. RealICQClient.SendGetNewInformation(0);
  10084. Exit;
  10085. end;
  10086. if AnsiSameText('ReGetAnnouncement', AContent) then
  10087. begin
  10088. RealICQClient.SendGetNewInformation(1);
  10089. Exit;
  10090. end;
  10091. AContent := AnsiReplaceStr(AContent, Chr(13), '');
  10092. Contents := RealICQUtils.SplitString(AContent, Chr(10));
  10093. try
  10094. //TODO: lqq 新消息通知接口
  10095. if (Contents.Count > 1) and (CompareText(Contents[0], 'SendNotify') = 0) then
  10096. begin
  10097. jo := SO(Contents[1]);
  10098. SystemMessage := TRealICQSystemMessage.Create;
  10099. SystemMessage.MessageID := GetTickCount;
  10100. Sleep(100);
  10101. SystemMessage.MessageType := mtBroadcast;
  10102. SystemMessage.AutoOpenWindow := True;
  10103. SystemMessage.Position := mpRightBottom;
  10104. SystemMessage.Left := 0;
  10105. SystemMessage.Top := 0;
  10106. SystemMessage.Width := 258;
  10107. SystemMessage.Height := 168;
  10108. SystemMessage.Delay := 0;
  10109. SystemMessage.MaxShowTimes := 0;
  10110. SystemMessage.Title := jo.S['title'];
  10111. SystemMessage.URL := jo.S['url'];
  10112. if jo.S['appkey'] = '' then
  10113. SystemMessage.Content := Format('<a target="_blank" href="%s" style="text-decoration: none;line-height:18px;">%s</a>', [SystemMessage.URL, jo.S['content']])
  10114. else
  10115. 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']]);
  10116. SystemMessage.AutoCloseTime := 0;
  10117. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10118. Exit;
  10119. end;
  10120. if Contents.Count >= 3 then
  10121. begin
  10122. { if AnsiSameText(Contents.Strings[0], 'CONFIRMDLG') then
  10123. begin
  10124. SystemMessage := TRealICQSystemMessage.Create;
  10125. SystemMessage.MessageID :=StrToInt(Contents.Strings[5]);// GetTickCount;
  10126. Sleep(100);
  10127. SystemMessage.MessageType := mtConfirmMsg;
  10128. SystemMessage.AutoOpenWindow := True;
  10129. SystemMessage.Position := mpCenter;
  10130. SystemMessage.Width := 278;
  10131. SystemMessage.Height := 178;
  10132. SystemMessage.Delay := 0;
  10133. SystemMessage.MaxShowTimes := 0;
  10134. SystemMessage.Content := Contents.Strings[2];
  10135. SystemMessage.Title := Contents.Strings[3];
  10136. SystemMessage.URL := Contents.Strings[4]+Chr(10)+Contents.Strings[6]+Chr(10)+Contents.Strings[7];
  10137. SystemMessage.AutoCloseTime :=120;
  10138. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10139. end; }
  10140. if AnsiSameText(Contents.Strings[0], 'RJOA') or AnsiSameText(Contents.Strings[0], 'RDOA') or AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10141. begin
  10142. SystemMessage := TRealICQSystemMessage.Create;
  10143. SystemMessage.MessageID := GetTickCount;
  10144. Sleep(100);
  10145. SystemMessage.MessageType := mtBroadcast;
  10146. if AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10147. SystemMessage.MessageType := mtAdvertisement;
  10148. SystemMessage.AutoOpenWindow := True;
  10149. SystemMessage.Position := mpRightBottom;
  10150. SystemMessage.Left := 0;
  10151. SystemMessage.Top := 0;
  10152. SystemMessage.Width := 258;
  10153. SystemMessage.Height := 168;
  10154. SystemMessage.Delay := 0;
  10155. SystemMessage.MaxShowTimes := 0;
  10156. SystemMessage.Title := '系统提醒';
  10157. reg := TPerlRegEx.Create;
  10158. try
  10159. reg.Subject := Contents.Strings[2];
  10160. reg.RegEx := '<[^>]+>';
  10161. reg.Replacement := '';
  10162. reg.ReplaceAll;
  10163. SystemMessage.Content := '<p style="line-height:18px; text-indent:2em;">' + reg.Subject + '</p>';
  10164. finally
  10165. reg.Free;
  10166. end;
  10167. SystemMessage.URL := '';
  10168. SystemMessage.AutoCloseTime := 0;
  10169. if AnsiSameText(Contents.Strings[0], 'RDOA') or AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10170. begin
  10171. SystemMessage.URL := Contents.Strings[4];
  10172. if Contents.Strings[6] = '1' then
  10173. begin
  10174. LoginName := RealICQClient.LoginName;
  10175. if Pos('-', RealICQClient.LoginName) > 0 then
  10176. LoginName := Copy(RealICQClient.LoginName, Pos('-', RealICQClient.LoginName) + 1, Length(RealICQClient.LoginName));
  10177. SystemMessage.URL := SystemMessage.URL + Contents.Strings[5];
  10178. end;
  10179. SystemMessage.Title := Contents.Strings[7];
  10180. end
  10181. else
  10182. begin
  10183. if Contents.Count >= 7 then
  10184. SystemMessage.URL := Contents.Strings[3];
  10185. try
  10186. if Contents.Count >= 5 then
  10187. SystemMessage.Width := StrToInt(Contents.Strings[4]);
  10188. if Contents.Count >= 6 then
  10189. SystemMessage.Height := StrToInt(Contents.Strings[5]);
  10190. if Contents.Count >= 7 then
  10191. begin
  10192. if Contents.Strings[6] = '1' then
  10193. begin
  10194. TimerForShowSystemNotices.Enabled := False;
  10195. RealICQClient.SendGetNewInformation(1);
  10196. end
  10197. else
  10198. begin
  10199. RealICQClient.SendGetNewInformation(0);
  10200. end;
  10201. end
  10202. else
  10203. begin
  10204. RealICQClient.SendGetNewInformation(0);
  10205. end;
  10206. if Contents.Count >= 8 then
  10207. SystemMessage.Title := Contents.Strings[7];
  10208. except
  10209. end;
  10210. end;
  10211. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10212. end;
  10213. if AnsiSameText(Contents.Strings[0], 'LXUMC') then
  10214. begin
  10215. // if not MainForm.ShowFileTransCompleted then Exit;
  10216. SystemMessage := TRealICQSystemMessage.Create;
  10217. SystemMessage.MessageID := GetTickCount;
  10218. SystemMessage.MessageType := mtBroadcast;
  10219. SystemMessage.AutoOpenWindow := True;
  10220. SystemMessage.Position := mpRightBottom;
  10221. SystemMessage.Left := 0;
  10222. SystemMessage.Top := 0;
  10223. SystemMessage.Width := 258;
  10224. SystemMessage.Height := 148;
  10225. SystemMessage.Delay := 0;
  10226. SystemMessage.MaxShowTimes := 0;
  10227. SystemMessage.Title := '系统提醒';
  10228. SystemMessage.Content := Contents.Strings[2];
  10229. SystemMessage.URL := '';
  10230. SystemMessage.AutoCloseTime := 0;
  10231. if Contents.Count > 3 then
  10232. SystemMessage.Title := Contents.Strings[3];
  10233. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10234. end;
  10235. if AnsiSameText(Contents.Strings[0], 'EMAIL') then
  10236. begin
  10237. if AnsiSameText(Contents.Strings[1], '0') then
  10238. begin
  10239. spbEmail.Caption := '(' + Contents.Strings[2] + ')';
  10240. end
  10241. else if AnsiSameText(Contents.Strings[1], '1') then
  10242. begin
  10243. spbEmail.Caption := '(' + IntToStr(StrToInt(ReplaceStr(ReplaceStr(spbEmail.Caption, '(', ''), ')', '')) + 1) + ')';
  10244. SystemMessage := TRealICQSystemMessage.Create;
  10245. SystemMessage.MessageID := GetTickCount;
  10246. SystemMessage.MessageType := mtBroadcast;
  10247. SystemMessage.AutoOpenWindow := True;
  10248. SystemMessage.Position := mpRightBottom;
  10249. SystemMessage.Left := 0;
  10250. SystemMessage.Top := 0;
  10251. SystemMessage.Width := 258;
  10252. SystemMessage.Height := 148;
  10253. SystemMessage.Delay := 0;
  10254. SystemMessage.MaxShowTimes := 0;
  10255. SystemMessage.Title := '系统提醒';
  10256. if AnsiSameText(Copy(Contents.Strings[3], 1, 7), 'http://') then
  10257. begin
  10258. SystemMessage.Content := '您从 <a herf="' + Contents.Strings[3] + '">' + Contents.Strings[2] + '</a> 处收到一封新邮件!';
  10259. SystemMessage.URL := Contents.Strings[3];
  10260. end
  10261. else
  10262. begin
  10263. SystemMessage.Content := '您从 ' + Contents.Strings[3] + ' 处收到一封新邮件!';
  10264. SystemMessage.URL := '';
  10265. end;
  10266. SystemMessage.AutoCloseTime := 15;
  10267. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10268. end;
  10269. end;
  10270. end;
  10271. finally
  10272. FreeAndNil(Contents);
  10273. end;
  10274. end;
  10275. //------------------------------------------------------------------------------
  10276. procedure TMainForm.RealICQClientReceivedMessage(Sender: TObject; RealICQMessage: TRealICQMessage);
  10277. var
  10278. ItemIndex: Integer;
  10279. RealICQContacterListItem: TRealICQContacterListItem;
  10280. RealICQUser: TRealICQUser;
  10281. ALoginName: string;
  10282. begin
  10283. ShowRealICQMessage(RealICQMessage, False, Sender as TRealICQClient);
  10284. {$region '更新“最近联系人列表”中的数据'}
  10285. if Sender = RealICQClient then
  10286. begin
  10287. if not AnsiSameText(RealICQMessage.Sender, RealICQClient.LoginName) then
  10288. ALoginName := RealICQMessage.Sender
  10289. else
  10290. ALoginName := RealICQMessage.Receiver;
  10291. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10292. if RealICQUser <> nil then
  10293. begin
  10294. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10295. if ItemIndex = -1 then
  10296. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10297. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10298. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10299. RealICQContacterListItem.MoveToTop;
  10300. end;
  10301. end;
  10302. {$endregion}
  10303. end;
  10304. //------------------------------------------------------------------------------
  10305. procedure TMainForm.RealICQClientReceivedOfflineAutoResponseSet(Sender: TObject; AEnabled: Boolean; AText: string);
  10306. begin
  10307. actOfflieAutoResponse.Checked := AEnabled;
  10308. if OptionsForm <> nil then
  10309. begin
  10310. OptionsForm.GetSets;
  10311. end;
  10312. end;
  10313. //------------------------------------------------------------------------------
  10314. procedure TMainForm.RealICQClientReceivedOfflineFile(Sender: TObject; ASender, AFileName: string; AFileSize: Int64; ASendDateTime: TDateTime);
  10315. var
  10316. AShowActive: Boolean;
  10317. TalkingForm: TTalkingForm;
  10318. iWaitTimes: Integer;
  10319. ALoginName: string;
  10320. RealICQUser: TRealICQUser;
  10321. ItemIndex: Integer;
  10322. RealICQContacterListItem: TRealICQContacterListItem;
  10323. begin
  10324. if AnsiSameText(ASender, RealICQClient.Me.LoginName) then
  10325. Exit;
  10326. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  10327. TalkingForm := GetTalkingForm(ASender, RealICQClient);
  10328. if TalkingForm = nil then
  10329. begin
  10330. TalkingForm := OpenTalkingForm(ASender, not AShowActive, RealICQClient);
  10331. end;
  10332. iWaitTimes := 0;
  10333. while not TalkingForm.CanWriteMessage do
  10334. begin
  10335. Application.ProcessMessages;
  10336. Inc(iWaitTimes);
  10337. if iWaitTimes > 1000 then
  10338. break;
  10339. Sleep(10);
  10340. end;
  10341. if (GetForegroundWindow <> TalkingForm.Handle) then
  10342. begin
  10343. FlashWindow(TalkingForm.Handle, True);
  10344. if PlaySoundOnGetMessage then
  10345. PlayEventSound(FMessageEventSound);
  10346. end;
  10347. TFileTransmitAdapter.Receive(TalkingForm, AFileName, 0, ASender, '', ASendDateTime, Self.RealICQClient, AFileSize);
  10348. {$region '更新“最近联系人列表”中的数据'}
  10349. if Sender = RealICQClient then
  10350. begin
  10351. ALoginName := ASender;
  10352. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10353. if RealICQUser <> nil then
  10354. begin
  10355. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10356. if ItemIndex = -1 then
  10357. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10358. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10359. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10360. RealICQContacterListItem.MoveToTop;
  10361. end;
  10362. end;
  10363. {$endregion}
  10364. end;
  10365. //------------------------------------------------------------------------------
  10366. procedure TMainForm.RealICQClientReceivedServerList(Sender: TObject; AServerList: string);
  10367. var
  10368. ServerList: TStringList;
  10369. iLoop, chrPos: Integer;
  10370. MenuItem: TMenuItem;
  10371. ServerInfo: TServerInfo;
  10372. config: TConditionConfig;
  10373. begin
  10374. config := TConditionConfig.GetConfig;
  10375. while ppServerList.Items.Count > 0 do
  10376. ppServerList.Items.Delete(0);
  10377. ServerList := SplitString(AServerList, Chr(10));
  10378. try
  10379. iLoop := 0;
  10380. while iLoop < ServerList.Count - 1 do
  10381. begin
  10382. ServerInfo := TServerInfo.Create;
  10383. ServerInfo.ServerId := ServerList[iLoop];
  10384. Inc(iLoop);
  10385. ServerInfo.ServerName := ServerList[iLoop];
  10386. Inc(iLoop);
  10387. if config.OtherServersDisable and not (UpperCase(ServerInfo.ServerId) = UpperCase(RealICQClient.ServerID)) then
  10388. begin
  10389. Continue;
  10390. end;
  10391. MenuItem := TMenuItem.Create(ppServerList);
  10392. MenuItem.AutoHotkeys := maManual;
  10393. MenuItem.AutoLineReduction := maManual;
  10394. MenuItem.Caption := '&' + ServerInfo.ServerName;
  10395. MenuItem.Hint := ServerInfo.ServerId;
  10396. MenuItem.OnClick := miChangeServerClick;
  10397. MenuItem.Tag := iLoop;
  10398. if UpperCase(ServerInfo.ServerId) = UpperCase(RealICQClient.ServerID) then
  10399. begin
  10400. edServerList.Text := ServerInfo.ServerName;
  10401. ImgLoadingMoreBranchs.Visible := True;
  10402. ScrollBoxMoreUser.Visible := False;
  10403. //RealICQClient.SendGetMoreBranch(ServerInfo.ServerId);
  10404. RealICQClient.SendGetBranchs(ServerInfo.ServerId, 0);
  10405. FCurrentServerID := ServerInfo.ServerId;
  10406. //Todo: 调用Online.exe
  10407. if FileExists(ExtractFilePath(Application.ExeName) + 'Online.exe') then
  10408. TCheckRunProcessThread.Create('Online', ExtractFilePath(Application.ExeName) + 'Online.exe')
  10409. else
  10410. Self.PostUpdateLog;
  10411. end;
  10412. FServerInfoList.AddObject(ServerInfo.ServerId, ServerInfo);
  10413. ppServerList.Items.Add(MenuItem);
  10414. end;
  10415. finally
  10416. FreeAndNil(ServerList);
  10417. end;
  10418. end;
  10419. //------------------------------------------------------------------------------
  10420. procedure TMainForm.ShowRealICQTeamMessage(RealICQTeamMessage: TRealICQTeamMessage; ShowSendFailed: Boolean);
  10421. var
  10422. nTeamID: string;
  10423. iIndex, ItemIndex: Integer;
  10424. MessageList: TList;
  10425. TalkingForm: TTalkingForm;
  10426. NotReadTeamMessage: TNotReadTeamMessage;
  10427. NeedAddToNotReadMessages: Boolean;
  10428. ListItem: TRealICQContacterListItem;
  10429. ASave: Boolean;
  10430. begin
  10431. try
  10432. ASave := AutoSaveMessage;
  10433. if Copy(RealICQTeamMessage.MessageStr, 1, 11) = '<TeamShare>' then
  10434. begin
  10435. if Copy(RealICQTeamMessage.MessageStr, Length(RealICQTeamMessage.MessageStr) - 11, 12) = '</TeamShare>' then
  10436. begin
  10437. ASave := False;
  10438. end;
  10439. end;
  10440. if ASave then
  10441. begin
  10442. FDBHistory.SaveMessage(RealICQTeamMessage.TeamID, RealICQTeamMessage.Sender, RealICQClient.LoginName, RealICQTeamMessage.SendDateTime, RealICQTeamMessage.FontStr, RealICQTeamMessage.MessageStr, RealICQTeamMessage.IsEncryMessage);
  10443. if RealICQTeamMessage.IsEncryMessage then
  10444. RealICQTeamMessage.ID := FDBHistory.GetMaxMessageId;
  10445. end;
  10446. except
  10447. end;
  10448. nTeamID := RealICQTeamMessage.TeamID;
  10449. TalkingForm := GetTeamTalkingForm(nTeamID);
  10450. if TalkingForm = nil then
  10451. NeedAddToNotReadMessages := True
  10452. else
  10453. NeedAddToNotReadMessages := not TalkingForm.CanWriteMessage;
  10454. if NeedAddToNotReadMessages then
  10455. begin
  10456. NotReadTeamMessage := TNotReadTeamMessage.Create;
  10457. NotReadTeamMessage.FRealICQTeamMessage := RealICQTeamMessage;
  10458. NotReadTeamMessage.FShowSendFailed := ShowSendFailed;
  10459. iIndex := FNotReadMessages.IndexOf(TeamMessageID + nTeamID);
  10460. if iIndex >= 0 then
  10461. begin
  10462. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  10463. MessageList.Add(NotReadTeamMessage);
  10464. end
  10465. else
  10466. begin
  10467. {$region '跳动头像'}
  10468. ItemIndex := FLVTeams.Items.IndexOf(nTeamID);
  10469. if ItemIndex >= 0 then
  10470. begin
  10471. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10472. if FlashImageOnGetMessage then
  10473. ListItem.Flash(fsJump);
  10474. end;
  10475. {$endregion}
  10476. MessageList := TList.Create;
  10477. MessageList.Add(NotReadTeamMessage);
  10478. FNotReadMessages.AddObject(TeamMessageID + nTeamID, MessageList);
  10479. TimerForFlashTrayIcon.Enabled := True;
  10480. if PlaySoundOnGetMessage then
  10481. PlayEventSound(FMessageEventSound);
  10482. end;
  10483. if MessageBoxForm <> nil then
  10484. begin
  10485. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  10486. FlashWindow(MessageBoxForm.Handle, True);
  10487. MessageBoxForm.ShowMessage(RealICQTeamMessage.Sender, MTTeam);
  10488. Exit;
  10489. end
  10490. else if (not TimerForFlashTrayIcon.Enabled) then
  10491. TimerForFlashTrayIcon.Enabled := True;
  10492. NotReadMessageBoxForm.ShowNotReadMessage;
  10493. NotReadMessageBoxForm.Height := 0;
  10494. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10495. end
  10496. else
  10497. begin
  10498. if (GetForegroundWindow <> TalkingForm.Handle) then
  10499. begin
  10500. FlashWindow(TalkingForm.Handle, True);
  10501. if PlaySoundOnGetMessage then
  10502. PlayEventSound(FMessageEventSound);
  10503. end;
  10504. TalkingForm.ShowTeamMessage(RealICQTeamMessage, ShowSendFailed);
  10505. end;
  10506. end;
  10507. procedure TMainForm.RealICQClientReceivedSMS(Sender: TObject; ASMSSender, ASMSContent: string; ASMSDateTime: TDateTime);
  10508. var
  10509. NotReadSMSMessage: TNotReadSMSMessage;
  10510. SMSForm: TSMSForm;
  10511. ASender: string;
  10512. iLoop: Integer;
  10513. ARealICQUser: TRealICQUser;
  10514. NeedAddToNotReadMessages: Boolean;
  10515. MessageList: TList;
  10516. iIndex: Integer;
  10517. AUsers: TStringList;
  10518. begin
  10519. ASender := '';
  10520. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  10521. try
  10522. for iLoop := 0 to AUsers.Count - 1 do
  10523. begin
  10524. ARealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  10525. if Length(Trim(ARealICQUser.Mobile)) < 11 then
  10526. continue;
  10527. if Pos(ARealICQUser.Mobile, ASMSSender) > 0 then
  10528. begin
  10529. ASender := ARealICQUser.LoginName;
  10530. Break;
  10531. end;
  10532. if Length(ARealICQUser.Mobile) < 10 then
  10533. begin
  10534. if AnsiSameStr('1060578' + ARealICQUser.Mobile, ASMSSender) then
  10535. begin
  10536. ASender := ARealICQUser.LoginName;
  10537. Break;
  10538. end;
  10539. end;
  10540. end;
  10541. // if ASender = '' then
  10542. // ASender := ASMSSender;
  10543. finally
  10544. FreeAndNil(AUsers);
  10545. end;
  10546. SMSForm := GetSMSForm(ASender);
  10547. NotReadSMSMessage := TNotReadSMSMessage.Create;
  10548. NotReadSMSMessage.FSMSSender := ASMSSender;
  10549. NotReadSMSMessage.FSMSContent := ASMSContent;
  10550. NotReadSMSMessage.FSMSDateTime := ASMSDateTime;
  10551. iIndex := FNotReadMessages.IndexOf(SMSMessageID + ASender);
  10552. if iIndex >= 0 then
  10553. begin
  10554. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  10555. MessageList.Add(NotReadSMSMessage);
  10556. end
  10557. else
  10558. begin
  10559. MessageList := TList.Create;
  10560. MessageList.Add(NotReadSMSMessage);
  10561. FNotReadMessages.AddObject(SMSMessageID + ASender, MessageList);
  10562. TimerForFlashTrayIcon.Enabled := True;
  10563. if PlaySoundOnGetMessage then
  10564. PlayEventSound(FMessageEventSound);
  10565. end;
  10566. if SMSForm = nil then
  10567. NeedAddToNotReadMessages := True
  10568. else
  10569. NeedAddToNotReadMessages := not SMSForm.CanWriteMessage;
  10570. if NeedAddToNotReadMessages then
  10571. begin
  10572. TimerForFlashTrayIcon.Enabled := True;
  10573. if PlaySoundOnGetMessage then
  10574. PlayEventSound(FMessageEventSound);
  10575. if MessageBoxForm <> nil then
  10576. begin
  10577. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  10578. FlashWindow(MessageBoxForm.Handle, True);
  10579. MessageBoxForm.ShowMessage(ASender, MTSMS);
  10580. Exit;
  10581. end
  10582. else if (not TimerForFlashTrayIcon.Enabled) then
  10583. TimerForFlashTrayIcon.Enabled := True;
  10584. NotReadMessageBoxForm.ShowNotReadMessage;
  10585. NotReadMessageBoxForm.Height := 0;
  10586. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10587. end
  10588. else
  10589. begin
  10590. if (GetForegroundWindow <> SMSForm.Handle) then
  10591. begin
  10592. FlashWindow(SMSForm.Handle, True);
  10593. if PlaySoundOnGetMessage then
  10594. PlayEventSound(FMessageEventSound);
  10595. end;
  10596. //显示收到的短消息
  10597. SMSForm.LoadNotReadSMSMessages;
  10598. end;
  10599. end;
  10600. //------------------------------------------------------------------------------
  10601. procedure TMainForm.RealICQClientReceivedSystemMessage(Sender: TObject; ASystemMessage: TRealICQSystemMessage);
  10602. begin
  10603. if (ASystemMessage.MaxShowTimes = 0) or ((GetSystemMessageCounter(ASystemMessage.MessageID) < ASystemMessage.MaxShowTimes) and (ASystemMessage.MaxShowTimes > 0)) then
  10604. begin
  10605. try
  10606. FDBHistory.SaveSystemMessage(ASystemMessage.MessageID, ASystemMessage.MessageType, ASystemMessage.Position, ASystemMessage.Left, ASystemMessage.Top, ASystemMessage.Width, ASystemMessage.Height, ASystemMessage.Title, ASystemMessage.Content, ASystemMessage.URL, ASystemMessage.AutoCloseTime);
  10607. except
  10608. end;
  10609. FSystemMessages.Insert(0, ASystemMessage);
  10610. if TimerForShowSystemMessage.Enabled = False then
  10611. TimerForShowSystemMessage.Enabled := True;
  10612. end;
  10613. end;
  10614. //------------------------------------------------------------------------------
  10615. procedure TMainForm.ShowSystemMessage(ASystemMessage: TRealICQSystemMessage);
  10616. begin
  10617. try
  10618. OpenSystemMessageForm(IntToStr(ASystemMessage.MessageID), ASystemMessage.MessageType, ASystemMessage.Position, ASystemMessage.Left, ASystemMessage.Top, ASystemMessage.Width, ASystemMessage.Height, ASystemMessage.Title, ASystemMessage.Content, ASystemMessage.URL, ASystemMessage.AutoCloseTime);
  10619. IncSystemMessageCounter(ASystemMessage.MessageID);
  10620. finally
  10621. FreeAndNil(ASystemMessage);
  10622. end;
  10623. end;
  10624. //------------------------------------------------------------------------------
  10625. procedure TMainForm.TimerForShowSystemMessageTimer(Sender: TObject);
  10626. var
  10627. iLoop: Integer;
  10628. ASystemMessage: TRealICQSystemMessage;
  10629. begin
  10630. if FSystemMessages.Count = 0 then
  10631. TimerForShowSystemMessage.Enabled := False
  10632. else
  10633. begin
  10634. for iLoop := FSystemMessages.Count - 1 downto 0 do
  10635. begin
  10636. ASystemMessage := FSystemMessages[iLoop];
  10637. ASystemMessage.Delay := ASystemMessage.Delay - 0.2;
  10638. if ASystemMessage.Delay <= 0 then
  10639. begin
  10640. FSystemMessages.Delete(iLoop);
  10641. if ASystemMessage.AutoOpenWindow then
  10642. begin
  10643. ShowSystemMessage(ASystemMessage);
  10644. end
  10645. else
  10646. begin
  10647. FNotReadMessages.AddObject(SystemMessageID + IntToStr(ASystemMessage.MessageID), ASystemMessage);
  10648. TimerForFlashTrayIcon.Enabled := True;
  10649. if PlaySoundOnGetSystemMessage then
  10650. PlayEventSound(FSystemMessageEventSound);
  10651. NotReadMessageBoxForm.ShowNotReadMessage;
  10652. NotReadMessageBoxForm.Height := 0;
  10653. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10654. end;
  10655. end;
  10656. end;
  10657. if (self.MessageBoxForm <> nil) then
  10658. MessageBoxForm.ShowSystemMessages(FSystemMessages);
  10659. end;
  10660. end;
  10661. //------------------------------------------------------------------------------
  10662. procedure TMainForm.RealICQClientReceivedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  10663. begin
  10664. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  10665. end;
  10666. procedure TMainForm.RealICQClientReceivedVideoImage(Sender: TObject; ALoginName: string; ABitmap: TBitmap);
  10667. begin
  10668. end;
  10669. //------------------------------------------------------------------------------
  10670. procedure TMainForm.UpdateFriendNode(Friend: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  10671. var
  10672. GIFImage: TGIFImage;
  10673. jo: IsuperObject;
  10674. ARemarkTel, ARemarkMobile, ARemark: string;
  10675. begin
  10676. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10677. if jo <> nil then
  10678. begin
  10679. ARemark := jo.S['Remark'];
  10680. ARemarkTel := jo.S['Phone'];
  10681. ARemarkMobile := jo.S['Mobile'];
  10682. end;
  10683. Friend.HasCamera := RealICQUser.InstalledCamera;
  10684. Friend.Watchword := RealICQUser.Watchword;
  10685. Friend.LeaveMessage := RealICQUser.LeaveMessage;
  10686. Friend.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10687. Friend.TelephoneHint := '';
  10688. if Length(Trim(ARemarkTel)) > 0 then
  10689. begin
  10690. Friend.TelephoneHint := Friend.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10691. end;
  10692. if Length(Trim(RealICQUser.Tel)) > 0 then
  10693. begin
  10694. if Length(Trim(Friend.TelephoneHint)) > 0 then
  10695. Friend.TelephoneHint := Friend.TelephoneHint + ' ';
  10696. Friend.TelephoneHint := Friend.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10697. end;
  10698. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10699. begin
  10700. if Length(Trim(Friend.TelephoneHint)) > 0 then
  10701. Friend.TelephoneHint := Friend.TelephoneHint + ' ';
  10702. Friend.TelephoneHint := Friend.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10703. end;
  10704. Friend.HasMobilePhone := False;
  10705. Friend.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10706. Friend.HasSMS := (Length(Trim(RealICQUser.Mobile)) > 0);
  10707. if not Friend.HasTelephone then
  10708. Friend.HasTelephone := Friend.HasSMS;
  10709. Friend.Mobile := Trim(RealICQUser.Mobile);
  10710. Friend.Tel := Trim(RealICQUser.Tel);
  10711. if Length(Trim(ARemarkMobile)) > 0 then
  10712. Friend.MobilePhoneHint := Trim(ARemarkMobile)
  10713. else
  10714. Friend.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10715. Friend.HeadImageHint := '单击显示联系人卡片';
  10716. Friend.TelephoneHint := Friend.TelephoneHint;
  10717. Friend.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10718. Friend.SMSHint := Trim(Friend.MobilePhoneHint) + '(双击发送手机短信息)';
  10719. Friend.CameraHint := '双击发送视频对话邀请';
  10720. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slAllCannotSee) then
  10721. begin
  10722. Friend.TelephoneHint := '*';
  10723. Friend.MobilePhoneHint := '*';
  10724. Friend.SMSHint := '*';
  10725. end;
  10726. if FileExists(RealICQUser.HeadImageFile) then
  10727. begin
  10728. try
  10729. if (RealICQUser.HeadImageFileType = htGIF) then
  10730. begin
  10731. GIFImage := TGIFImage.Create;
  10732. GIFImage.Animate := False;
  10733. try
  10734. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10735. Friend.HeadImagePicture.Bitmap.Assign(GIFImage);
  10736. finally
  10737. GIFImage.Free;
  10738. end;
  10739. end
  10740. else
  10741. Friend.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10742. except
  10743. Friend.HeadImagePicture.Graphic := nil;
  10744. end;
  10745. end
  10746. else
  10747. Friend.HeadImagePicture.Graphic := nil;
  10748. Friend.DisplayName := RealICQUser.DisplayName;
  10749. Friend.LoginState := RealICQUser.LoginState;
  10750. Friend.Data := RealICQUser;
  10751. if AShowNavBarNumeric then
  10752. Friend.Update;
  10753. if AShowNavBarNumeric then
  10754. ShowNavBarNumeric;
  10755. end;
  10756. //------------------------------------------------------------------------------
  10757. procedure TMainForm.UpdateEmployeeNode(Employee: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  10758. var
  10759. GIFImage: TGIFImage;
  10760. jo: ISuperObject;
  10761. ARemarkTel, ARemarkMobile, ARemark: string;
  10762. begin
  10763. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10764. if jo <> nil then
  10765. begin
  10766. ARemark := jo.S['Remark'];
  10767. ARemarkTel := jo.S['Phone'];
  10768. ARemarkMobile := jo.S['Mobile'];
  10769. end;
  10770. Employee.HasCamera := RealICQUser.InstalledCamera;
  10771. Employee.Watchword := RealICQUser.Watchword;
  10772. Employee.LeaveMessage := RealICQUser.LeaveMessage;
  10773. Employee.HasNewSNS := ShowSNS and RealICQUser.HasNewSNSUpdate;
  10774. Employee.NewSNSHint := '个人空间最近有更新,点击查看';
  10775. Employee.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10776. Employee.TelephoneHint := '';
  10777. if Length(Trim(ARemarkTel)) > 0 then
  10778. begin
  10779. Employee.TelephoneHint := Employee.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10780. end;
  10781. if Length(Trim(RealICQUser.Tel)) > 0 then
  10782. begin
  10783. if Length(Trim(Employee.TelephoneHint)) > 0 then
  10784. Employee.TelephoneHint := Employee.TelephoneHint + ' ';
  10785. Employee.TelephoneHint := Employee.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10786. end;
  10787. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10788. begin
  10789. if Length(Trim(Employee.TelephoneHint)) > 0 then
  10790. Employee.TelephoneHint := Employee.TelephoneHint + ' ';
  10791. Employee.TelephoneHint := Employee.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10792. end;
  10793. Employee.HasMobilePhone := False;
  10794. Employee.HasSMS := (Length(Trim(RealICQUser.Mobile)) > 0);
  10795. Employee.Tel := Trim(RealICQUser.Tel);
  10796. Employee.Mobile := Trim(RealICQUser.Mobile);
  10797. if Length(Trim(ARemarkMobile)) > 0 then
  10798. Employee.MobilePhoneHint := Trim(ARemarkMobile)
  10799. else
  10800. Employee.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10801. Employee.HeadImageHint := '单击显示联系人卡片';
  10802. Employee.TelephoneHint := Trim(Employee.TelephoneHint);
  10803. Employee.AddFriendHint := '双击添加好友';
  10804. Employee.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10805. Employee.SMSHint := Employee.MobilePhoneHint + '(双击发送手机短信息)';
  10806. Employee.CameraHint := '双击发送视频对话邀请';
  10807. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slAllCannotSee) and (Employee.LoginName <> MainForm.RealICQClient.Me.LoginName) then
  10808. begin
  10809. Employee.TelephoneHint := '*';
  10810. Employee.MobilePhoneHint := '*';
  10811. Employee.SMSHint := '*';
  10812. end;
  10813. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slOnlyFriendCanSee) and not (TUsersService.GetUsersService.IsWorkmateOrFriend(Employee.LoginName)) then
  10814. begin
  10815. Employee.TelephoneHint := '*';
  10816. Employee.MobilePhoneHint := '*';
  10817. Employee.SMSHint := '*';
  10818. end;
  10819. if FileExists(RealICQUser.HeadImageFile) then
  10820. begin
  10821. try
  10822. if (RealICQUser.HeadImageFileType = htGIF) then
  10823. begin
  10824. GIFImage := TGIFImage.Create;
  10825. GIFImage.Animate := False;
  10826. try
  10827. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10828. Employee.HeadImagePicture.Bitmap.Assign(GIFImage);
  10829. finally
  10830. GIFImage.Free;
  10831. end;
  10832. end
  10833. else
  10834. Employee.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10835. except
  10836. Employee.HeadImagePicture.Graphic := nil;
  10837. end;
  10838. end
  10839. else
  10840. Employee.HeadImagePicture.Graphic := nil;
  10841. Employee.DisplayName := RealICQUser.DisplayName;
  10842. Employee.LoginState := RealICQUser.LoginState;
  10843. Employee.Data := RealICQUser;
  10844. if AShowNavBarNumeric then
  10845. Employee.Update;
  10846. if AShowNavBarNumeric then
  10847. ShowNavBarNumeric;
  10848. end;
  10849. //------------------------------------------------------------------------------
  10850. procedure TMainForm.BindUserDataToItem(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean = True);
  10851. var
  10852. GIFImage: TGIFImage;
  10853. jo: ISuperObject;
  10854. ARemarkTel, ARemarkMobile, ARemark: string;
  10855. begin
  10856. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10857. if jo <> nil then
  10858. begin
  10859. ARemark := jo.S['Remark'];
  10860. ARemarkTel := jo.S['Phone'];
  10861. ARemarkMobile := jo.S['Mobile'];
  10862. end;
  10863. RealICQContacterListItem.HasCamera := RealICQUser.InstalledCamera;
  10864. RealICQContacterListItem.Watchword := RealICQUser.Watchword;
  10865. RealICQContacterListItem.LeaveMessage := RealICQUser.LeaveMessage;
  10866. RealICQContacterListItem.Branch := RealICQUser.Branch;
  10867. RealICQContacterListItem.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10868. RealICQContacterListItem.TelephoneHint := '';
  10869. if Length(Trim(ARemarkTel)) > 0 then
  10870. begin
  10871. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10872. end;
  10873. if Length(Trim(RealICQUser.Tel)) > 0 then
  10874. begin
  10875. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10876. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10877. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10878. end;
  10879. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10880. begin
  10881. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10882. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10883. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10884. end;
  10885. RealICQContacterListItem.HasMobilePhone := (Length(Trim(RealICQUser.Mobile)) > 0) or (Length(Trim(ARemarkMobile)) > 0);
  10886. RealICQContacterListItem.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10887. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasMobilePhone;
  10888. RealICQContacterListItem.HeadImageHint := '单击显示联系人卡片';
  10889. if Length(Trim(ARemarkMobile)) > 0 then
  10890. RealICQContacterListItem.MobilePhoneHint := Trim(ARemarkMobile)
  10891. else
  10892. RealICQContacterListItem.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10893. RealICQContacterListItem.Mobile := Trim(RealICQUser.Mobile);
  10894. RealICQContacterListItem.Tel := Trim(RealICQUser.Tel);
  10895. RealICQContacterListItem.HasMobilePhone := False;
  10896. RealICQContacterListItem.MobilePhoneHint := RealICQContacterListItem.MobilePhoneHint + '(双击发送手机短信息)';
  10897. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint;
  10898. RealICQContacterListItem.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10899. RealICQContacterListItem.SMSHint := RealICQContacterListItem.MobilePhoneHint;
  10900. RealICQContacterListItem.CameraHint := '双击发送视频对话邀请';
  10901. RealICQContacterListItem.HasTelephone := RealICQContacterListItem.HasTelephone and RealICQContacterListItem.ListView.ShowTelButton;
  10902. RealICQContacterListItem.HasMobilePhone := RealICQContacterListItem.HasMobilePhone and RealICQContacterListItem.ListView.ShowMobileButton;
  10903. RealICQContacterListItem.HasEmail := RealICQContacterListItem.HasEmail and RealICQContacterListItem.ListView.ShowEmailButton;
  10904. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasSMS and RealICQContacterListItem.ListView.ShowSMSButton;
  10905. if FileExists(RealICQUser.HeadImageFile) then
  10906. begin
  10907. try
  10908. if (RealICQUser.HeadImageFileType = htGIF) then
  10909. begin
  10910. GIFImage := TGIFImage.Create;
  10911. GIFImage.Animate := False;
  10912. try
  10913. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10914. RealICQContacterListItem.HeadImagePicture.Bitmap.Assign(GIFImage);
  10915. finally
  10916. GIFImage.Free;
  10917. end;
  10918. end
  10919. else
  10920. RealICQContacterListItem.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10921. except
  10922. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  10923. end;
  10924. end
  10925. else
  10926. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  10927. RealICQContacterListItem.DisplayName := RealICQUser.DisplayName;
  10928. RealICQContacterListItem.LoginState := RealICQUser.LoginState;
  10929. RealICQContacterListItem.Data := RealICQUser;
  10930. if AShowNavBarNumeric then
  10931. RealICQContacterListItem.ReDrawItem;
  10932. if AShowNavBarNumeric then
  10933. ShowNavBarNumeric;
  10934. end;
  10935. procedure TMainForm.BindUserDataToItemForGroup(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AGroupAlias: string; AShowNavBarNumeric: Boolean);
  10936. var
  10937. GIFImage: TGIFImage;
  10938. jo: IsuperObject;
  10939. ARemarkTel, ARemarkMobile, ARemark: string;
  10940. begin
  10941. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10942. if jo <> nil then
  10943. begin
  10944. ARemark := jo.S['Remark'];
  10945. ARemarkTel := jo.S['Phone'];
  10946. ARemarkMobile := jo.S['Mobile'];
  10947. end;
  10948. RealICQContacterListItem.HasCamera := RealICQUser.InstalledCamera;
  10949. RealICQContacterListItem.Watchword := RealICQUser.Watchword;
  10950. RealICQContacterListItem.LeaveMessage := RealICQUser.LeaveMessage;
  10951. RealICQContacterListItem.Branch := RealICQUser.Branch;
  10952. RealICQContacterListItem.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10953. RealICQContacterListItem.TelephoneHint := '';
  10954. if Length(Trim(ARemarkTel)) > 0 then
  10955. begin
  10956. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10957. end;
  10958. if Length(Trim(RealICQUser.Tel)) > 0 then
  10959. begin
  10960. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10961. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10962. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10963. end;
  10964. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10965. begin
  10966. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10967. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10968. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10969. end;
  10970. RealICQContacterListItem.HasMobilePhone := (Length(Trim(RealICQUser.Mobile)) > 0) or (Length(Trim(ARemarkMobile)) > 0);
  10971. RealICQContacterListItem.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10972. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasMobilePhone;
  10973. RealICQContacterListItem.HeadImageHint := '单击显示联系人卡片';
  10974. if Length(Trim(ARemarkMobile)) > 0 then
  10975. RealICQContacterListItem.MobilePhoneHint := Trim(ARemarkMobile)
  10976. else
  10977. RealICQContacterListItem.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10978. RealICQContacterListItem.Mobile := Trim(RealICQUser.Mobile);
  10979. RealICQContacterListItem.Tel := Trim(RealICQUser.Tel);
  10980. RealICQContacterListItem.HasMobilePhone := False;
  10981. RealICQContacterListItem.MobilePhoneHint := RealICQContacterListItem.MobilePhoneHint + '(双击发送手机短信息)';
  10982. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint;
  10983. RealICQContacterListItem.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10984. RealICQContacterListItem.SMSHint := RealICQContacterListItem.MobilePhoneHint;
  10985. RealICQContacterListItem.CameraHint := '双击发送视频对话邀请';
  10986. RealICQContacterListItem.HasTelephone := RealICQContacterListItem.HasTelephone and RealICQContacterListItem.ListView.ShowTelButton;
  10987. RealICQContacterListItem.HasMobilePhone := RealICQContacterListItem.HasMobilePhone and RealICQContacterListItem.ListView.ShowMobileButton;
  10988. RealICQContacterListItem.HasEmail := RealICQContacterListItem.HasEmail and RealICQContacterListItem.ListView.ShowEmailButton;
  10989. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasSMS and RealICQContacterListItem.ListView.ShowSMSButton;
  10990. if FileExists(RealICQUser.HeadImageFile) then
  10991. begin
  10992. try
  10993. if (RealICQUser.HeadImageFileType = htGIF) then
  10994. begin
  10995. GIFImage := TGIFImage.Create;
  10996. GIFImage.Animate := False;
  10997. try
  10998. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10999. RealICQContacterListItem.HeadImagePicture.Bitmap.Assign(GIFImage);
  11000. finally
  11001. GIFImage.Free;
  11002. end;
  11003. end
  11004. else
  11005. RealICQContacterListItem.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  11006. except
  11007. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11008. end;
  11009. end
  11010. else
  11011. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11012. RealICQContacterListItem.DisplayName := AGroupAlias; //RealICQUser.DisplayName;
  11013. RealICQContacterListItem.LoginState := RealICQUser.LoginState;
  11014. RealICQContacterListItem.Data := RealICQUser;
  11015. if AShowNavBarNumeric then
  11016. RealICQContacterListItem.ReDrawItem;
  11017. if AShowNavBarNumeric then
  11018. ShowNavBarNumeric;
  11019. end;
  11020. //------------------------------------------------------------------------------
  11021. procedure TMainForm.btCloseTopMessageClick(Sender: TObject);
  11022. begin
  11023. pnlForTopMessage.Visible := False;
  11024. FTopSystemMessage := nil;
  11025. end;
  11026. procedure TMainForm.btCustomerDisplayNameClick(Sender: TObject);
  11027. var
  11028. Point: TPoint;
  11029. begin
  11030. Point.X := 0;
  11031. Point.Y := btCustomerDisplayName.Height + 1;
  11032. Point := btCustomerDisplayName.ClientToScreen(Point);
  11033. ppChangeCustomerState.Popup(Point.X, Point.Y);
  11034. end;
  11035. procedure TMainForm.btCustomerLogoutClick(Sender: TObject);
  11036. begin
  11037. //
  11038. end;
  11039. procedure TMainForm.btLoginClick(Sender: TObject);
  11040. var
  11041. ca: ICAClient;
  11042. b: Boolean;
  11043. begin
  11044. if RealICQClient.Logining then
  11045. RealICQClient.CancelLogin
  11046. else if RealICQClient.ReConnectExecuting then
  11047. RealICQClient.CancelReConnectAndLogin
  11048. else if actLoginAs.Visible and actLoginAs.Enabled and FLoginAsSavePassword then
  11049. begin
  11050. actLoginAs.Execute
  11051. end
  11052. else if RealICQClient.Logined then
  11053. begin
  11054. RealICQClient.Logout;
  11055. end
  11056. else
  11057. begin
  11058. if GetCaConfig.GetEnable and RealICQClient.CALogin then
  11059. begin
  11060. b := actLoginAs.Enabled;
  11061. actLoginAs.Enabled := true;
  11062. actLoginAs.Execute;
  11063. actLoginAs.Enabled := b;
  11064. Exit;
  11065. end;
  11066. if Length(Trim(edLoginName.Text)) = 0 then
  11067. begin
  11068. MessageBox(Handle, '请输入用户名!', '提示', MB_ICONINFORMATION);
  11069. Exit;
  11070. end;
  11071. if Length(edPassword.Text) = 0 then
  11072. begin
  11073. MessageBox(Handle, '请输入密码!', '提示', MB_ICONINFORMATION);
  11074. Exit;
  11075. end;
  11076. RealICQClient.AutoLogin := FAutoLogin;
  11077. RealICQClient.Login(Trim(edLoginName.Text), edPassword.Text, FLoginState, FLeaveMessage, FSavePassword, False, False);
  11078. end;
  11079. end;
  11080. procedure TMainForm.btMainMenuClick(Sender: TObject);
  11081. var
  11082. Point: TPoint;
  11083. begin
  11084. edtSearchMoreUser.Text := '';
  11085. Point.X := 0;
  11086. Point.Y := btMainMenu.top;
  11087. Point := btMainMenu.ClientToScreen(Point);
  11088. ppMainMenu.Popup(Point.X, Point.Y - GetSystemMetrics(SM_CYMENU) * 10 - 8);
  11089. end;
  11090. procedure TMainForm.btnCALoginClick(Sender: TObject);
  11091. begin
  11092. RealICQClient.CALogin := not RealICQClient.CALogin;
  11093. // if RealICQClient.CALogin then
  11094. // begin
  11095. // ImgLstCheckStates.GetIcon(1, btnCaLogin.Icon);
  11096. //// edLoginName.Text := CA_TEXT;
  11097. // edLoginName.Enabled := False;
  11098. // edPassword.Enabled := False;
  11099. // spbChangeLoginName.Enabled := False;
  11100. // end
  11101. // else
  11102. // begin
  11103. // ImgLstCheckStates.GetIcon(0, btnCaLogin.Icon);
  11104. //// edLoginName.Text := '';
  11105. // edLoginName.Enabled := True;
  11106. // edPassword.Enabled := True;
  11107. // spbChangeLoginName.Enabled := True;
  11108. // end;
  11109. SetLoginStateControlState;
  11110. end;
  11111. //------------------------------------------------------------------------------
  11112. procedure TMainForm.cbxURLInputerDropDown(Sender: TObject);
  11113. var
  11114. iLoop: Integer;
  11115. Items: TStringList;
  11116. begin
  11117. Items := TStringList.Create;
  11118. try
  11119. GetIEHistory(Items);
  11120. cbxURLInputer.ItemsEx.Clear;
  11121. for iLoop := 0 to Items.Count - 1 do
  11122. begin
  11123. with cbxURLInputer.ItemsEx.Add do
  11124. begin
  11125. Caption := Items.Strings[iLoop];
  11126. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  11127. ImageIndex := 2
  11128. else if Copy(Caption, 1, 4) = 'ftp:' then
  11129. ImageIndex := 1
  11130. else
  11131. ImageIndex := 0;
  11132. end;
  11133. end;
  11134. finally
  11135. Items.Free;
  11136. end;
  11137. end;
  11138. //------------------------------------------------------------------------------
  11139. procedure TMainForm.cbxURLInputerKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  11140. begin
  11141. if Key = 13 then
  11142. spbGoClick(spbGo);
  11143. end;
  11144. //------------------------------------------------------------------------------
  11145. procedure TMainForm.cbxURLInputerSelect(Sender: TObject);
  11146. begin
  11147. spbGoClick(spbGo);
  11148. end;
  11149. //------------------------------------------------------------------------------
  11150. procedure TMainForm.SetStyleMenuChecked;
  11151. begin
  11152. case FLVStyle of
  11153. lsBigHeadImage:
  11154. actShowBigHeadImage.Checked := True;
  11155. lsMiddleHeadImage:
  11156. actShowMiddleHeadImage.Checked := True;
  11157. lsSmallHeadImage:
  11158. actShowSmallHeadImage.Checked := True;
  11159. lsNoHeadImage:
  11160. actShowNormalHeadImage.Checked := True;
  11161. end;
  11162. case FLVCaptionStyle of
  11163. csDisplayName:
  11164. actShowDisplayName.Checked := True;
  11165. csLoginName:
  11166. actShowLoginName.Checked := True;
  11167. csDisplayNameAndLoginName:
  11168. actShowAllName.Checked := True;
  11169. end;
  11170. actShowRemark.Checked := RealICQClient.ShowRemark;
  11171. end;
  11172. //------------------------------------------------------------------------------
  11173. procedure TMainForm.SetLoginStateMenuChecked;
  11174. var
  11175. LeaveMsg: string;
  11176. begin
  11177. actOnline.Checked := False;
  11178. actHidden.Checked := False;
  11179. actOffline.Checked := False;
  11180. actBusy.Checked := False;
  11181. actMute.Checked := False;
  11182. actLeave.Checked := False;
  11183. actRepast.Checked := False;
  11184. actPhone.Checked := False;
  11185. actMeeting.Checked := False;
  11186. actOtherState.Checked := False;
  11187. if RealICQClient.Me = nil then
  11188. begin
  11189. actOffline.Checked := True;
  11190. Exit;
  11191. end;
  11192. LeaveMsg := RealICQClient.Me.LeaveMessage;
  11193. if RealICQClient.Me.LoginState = stOnline then
  11194. actOnline.Checked := True
  11195. else if RealICQClient.Me.LoginState = stHidden then
  11196. actHidden.Checked := True
  11197. else if RealICQClient.Me.LoginState = stLeave then
  11198. begin
  11199. if AnsiSameText(actLeave.Caption, LeaveMsg) then
  11200. actLeave.Checked := True
  11201. else if AnsiSameText(actRepast.Caption, LeaveMsg) then
  11202. actRepast.Checked := True
  11203. else if AnsiSameText(actMeeting.Caption, LeaveMsg) then
  11204. actMeeting.Checked := True
  11205. else
  11206. actOtherState.Checked := True;
  11207. end
  11208. else if RealICQClient.Me.LoginState = stBusy then
  11209. begin
  11210. if AnsiSameText(actBusy.Caption, LeaveMsg) then
  11211. actBusy.Checked := True
  11212. else if AnsiSameText(actPhone.Caption, LeaveMsg) then
  11213. actPhone.Checked := True
  11214. else
  11215. actOtherState.Checked := True;
  11216. end
  11217. else if RealICQClient.Me.LoginState = stMute then
  11218. actMute.Checked := True
  11219. else
  11220. actOtherState.Checked := True;
  11221. end;
  11222. //------------------------------------------------------------------------------
  11223. procedure TMainForm.ShowMeInformation;
  11224. var
  11225. ADisplayName, ATrueDisplayName, AWatchword, AStateMsg: WideString;
  11226. HeadPic: TPicture;
  11227. GIFImage: TGIFImage;
  11228. begin
  11229. if RealICQClient.Me = nil then
  11230. Exit;
  11231. if FNotReadMessages.Count = 0 then
  11232. begin
  11233. case RealICQClient.Me.LoginState of
  11234. stOffline:
  11235. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  11236. stOnline:
  11237. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Online.ico');
  11238. stLeave:
  11239. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\leave.ico');
  11240. stBusy:
  11241. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Busy.ico');
  11242. stMute:
  11243. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Mute.ico');
  11244. stHidden:
  11245. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\invisible.ico');
  11246. end;
  11247. TrayIcon.SetDefaultIcon;
  11248. end;
  11249. if FileExists(RealICQClient.Me.HeadImageFile) then
  11250. begin
  11251. try
  11252. if (RealICQClient.Me.HeadImageFileType = htGIF) then
  11253. begin
  11254. GIFImage := TGIFImage.Create;
  11255. GIFImage.Animate := FShowGIFInMailForm and (RealICQClient.Me.LoginState <> stHidden);
  11256. try
  11257. GIFImage.LoadFromFile(RealICQClient.Me.HeadImageFile);
  11258. if GIFImage.Animate then
  11259. imgHead.Picture.Assign(GIFImage)
  11260. else
  11261. imgHead.Picture.Bitmap.Assign(GIFImage);
  11262. finally
  11263. GIFImage.Free;
  11264. end;
  11265. end
  11266. else
  11267. imgHead.Picture.LoadFromFile(RealICQClient.Me.HeadImageFile);
  11268. except
  11269. imgHead.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  11270. end;
  11271. end
  11272. else
  11273. begin
  11274. imgHead.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  11275. end;
  11276. {if RealICQClient.Me.LoginState = stHidden then
  11277. begin
  11278. HeadPic := TPicture.Create;
  11279. try
  11280. HeadPic.Bitmap.Assign(imgHead.Picture.Graphic);
  11281. Grayscale(HeadPic.Bitmap);
  11282. imgHead.Picture.Bitmap.Assign(HeadPic.Bitmap);
  11283. finally
  11284. HeadPic.Free;
  11285. end;
  11286. end;
  11287. imgLeave.Visible := False;}
  11288. case RealICQClient.Me.LoginState of
  11289. stOffline:
  11290. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Offline.ico');
  11291. stOnline:
  11292. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Online.ico');
  11293. stLeave:
  11294. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  11295. stBusy:
  11296. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Busy.ico');
  11297. stMute:
  11298. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Mute.ico');
  11299. stHidden:
  11300. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\invisible.ico');
  11301. end;
  11302. if (RealICQClient.Me.LoginState = stLeave) or (RealICQClient.Me.LoginState = stBusy) then
  11303. AStateMsg := RealICQClient.Me.LeaveMessage
  11304. else
  11305. AStateMsg := StateValues[Integer(RealICQClient.Me.LoginState)];
  11306. ATrueDisplayName := RealICQClient.Me.Nickname;
  11307. ADisplayName := ATrueDisplayName + '(' + AStateMsg + ')';
  11308. spbDisplayName.Hint := ADisplayName;
  11309. spbDisplayName.ShowHint := False;
  11310. TrayIcon.Hint := Application.Title + ' - ' + ADisplayName;
  11311. AWatchword := RealICQClient.Me.Watchword;
  11312. if Length(Trim(AWatchword)) = 0 then
  11313. AWatchword := '在此键入您的个性签名';
  11314. spbWatchword.Hint := AWatchword;
  11315. spbWatchword.ShowHint := False;
  11316. btn_lock_DisplayName.Caption := ADisplayName; // + Format('(%s)', [StateValues[Integer(RealICQClient.Me.LoginState)]]);
  11317. btn_lock_DisplayName.AutoSize := False;
  11318. btn_lock_DisplayName.AutoSize := True;
  11319. btn_lock_DisplayName.Update;
  11320. img_lock_HeadPrev.Picture := imgHead.Picture;
  11321. //字符串长度过长时,截短字符串并在后面显示“...”
  11322. while spbDisplayName.Canvas.TextWidth(ADisplayName) > pnlTop.Width - 86 do
  11323. begin
  11324. if Length(ATrueDisplayName) > 3 then
  11325. begin
  11326. if Copy(ATrueDisplayName, Length(ATrueDisplayName) - 2, Length(ATrueDisplayName)) = '...' then
  11327. ATrueDisplayName := Copy(ATrueDisplayName, 1, Length(ATrueDisplayName) - 3);
  11328. ATrueDisplayName := Copy(ATrueDisplayName, 1, Length(ATrueDisplayName) - 1) + '...';
  11329. end
  11330. else if Length(AStateMsg) > 3 then
  11331. begin
  11332. if Copy(AStateMsg, Length(AStateMsg) - 2, Length(AStateMsg)) = '...' then
  11333. AStateMsg := Copy(AStateMsg, 1, Length(AStateMsg) - 3);
  11334. AStateMsg := Copy(AStateMsg, 1, Length(AStateMsg) - 1) + '...';
  11335. end
  11336. else
  11337. break;
  11338. ADisplayName := ATrueDisplayName + '(' + AStateMsg + ')';
  11339. spbDisplayName.ShowHint := True;
  11340. end;
  11341. //字符串长度过长时,截短字符串并在后面显示“...”
  11342. while spbWatchword.Canvas.TextWidth(AWatchword) > pnlTop.Width - 86 do
  11343. begin
  11344. if Length(AWatchword) > 3 then
  11345. begin
  11346. if Copy(AWatchword, Length(AWatchword) - 2, Length(AWatchword)) = '...' then
  11347. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 3);
  11348. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 1) + '...';
  11349. end
  11350. else
  11351. break;
  11352. spbWatchword.ShowHint := True;
  11353. end;
  11354. spbDisplayName.Caption := ADisplayName;
  11355. spbWatchword.Caption := AWatchword;
  11356. edWatchword.Text := RealICQClient.Me.Watchword;
  11357. if OptionsForm <> nil then
  11358. begin
  11359. OptionsForm.ShowHeadImage;
  11360. OptionsForm.GetSets;
  11361. end;
  11362. SetLoginStateMenuChecked;
  11363. end;
  11364. //------------------------------------------------------------------------------
  11365. procedure TMainForm.RealICQClientGetDBProcedureResult(Sender: TObject; DBProcedureName, ArgIn, ArgOut: string);
  11366. var
  11367. WebPanel: TWebPanel;
  11368. WebTabAcount: TWebTabAcount;
  11369. StrList1, StrList2: TStringList;
  11370. iLoop, iIndex: Integer;
  11371. begin
  11372. if AnsiSameText(DBProcedureName, 'YJ_AddTempRemark') then
  11373. begin
  11374. 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);
  11375. end;
  11376. if AnsiSameText(DBProcedureName, 'GetWebTabAcounts') then
  11377. begin
  11378. StrList1 := SplitString(ArgOut, Chr(13));
  11379. for iLoop := 0 to StrList1.Count - 1 do
  11380. begin
  11381. if StrList1.Strings[iLoop] = '' then
  11382. Continue;
  11383. StrList2 := SplitString(StrList1.Strings[iLoop], Chr(10));
  11384. WebTabAcount := TWebTabAcount.Create;
  11385. try
  11386. WebTabAcount.FWebTabID := StrToInt(StrList2.Strings[0]);
  11387. WebTabAcount.FTitle := StrList2.Strings[1];
  11388. WebTabAcount.LoginName := StrList2.Strings[2];
  11389. WebTabAcount.FPassword := StrList2.Strings[3];
  11390. WebTabAcount.FExplain := StrList2.Strings[4];
  11391. iIndex := FWebPanels.IndexOf(IntToStr(WebTabAcount.FWebTabID));
  11392. if iIndex >= 0 then
  11393. begin
  11394. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  11395. WebPanel.FAcounts.Add(WebTabAcount);
  11396. end;
  11397. except
  11398. FreeAndNil(WebTabAcount);
  11399. end;
  11400. end;
  11401. end;
  11402. end;
  11403. procedure TMainForm.RealICQClientGetNotReadMessageCount(Sender: TObject; iCount: Integer);
  11404. begin
  11405. spbShowNotReadMessage.Caption := Format('(%d)', [iCount]);
  11406. end;
  11407. procedure TMainForm.RealICQClientGetSystemNoticesCount(Sender: TObject; iCount: Integer; NoticesRecords: array of TSystemNotices);
  11408. var
  11409. iLoop: Integer;
  11410. ANoticesRecord: TSystemNotices;
  11411. begin
  11412. FLastGetSystemNoticesTicket := GetTickCount;
  11413. while FSystemNotices.Count > 0 do
  11414. begin
  11415. ANoticesRecord := FSystemNotices[0];
  11416. FSystemNotices.Delete(0);
  11417. try
  11418. FreeAndNil(ANoticesRecord);
  11419. except
  11420. end;
  11421. end;
  11422. for iLoop := Low(NoticesRecords) to High(NoticesRecords) do
  11423. begin
  11424. ANoticesRecord := NoticesRecords[iLoop];
  11425. FSystemNotices.Add(ANoticesRecord);
  11426. end;
  11427. pnlForTopMessage.Visible := iCount > 0;
  11428. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  11429. FSystemNoticeIndex := 0;
  11430. if pnlForTopMessage.Visible then
  11431. begin
  11432. ShowSystemNotices;
  11433. end;
  11434. end;
  11435. procedure TMainForm.TimerForShowSystemNoticesTimer(Sender: TObject);
  11436. begin
  11437. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  11438. btNextLogClick(nil);
  11439. if GetTickCount - FLastGetSystemNoticesTicket > 60000 * 30 then
  11440. begin
  11441. TimerForShowSystemNotices.Enabled := False;
  11442. RealICQClient.SendGetNewInformation(1);
  11443. end;
  11444. end;
  11445. procedure TMainForm.TimerForShowUserCardTimer(Sender: TObject);
  11446. begin
  11447. TimerForShowUserCard.Enabled := False;
  11448. TimerForHideUserCard.Enabled := False;
  11449. if not Assigned(UserCardViewForm) then
  11450. UserCardViewForm := TUserCardViewForm.Create(Self);
  11451. // UserCardViewForm.LoginName := FNeedShowUserCardLoginName;
  11452. UserCardViewForm.TargetTop := FShowUserCardTargetTop;
  11453. UserCardViewForm.Update(FNeedShowUserCardLoginName);
  11454. // if not Assigned(UserCardForm) then UserCardForm := TUserCardForm.Create(Self);
  11455. // TUsersService.GetUsersService.GetOrRequestUser(FNeedShowUserCardLoginName, RealICQClient);
  11456. // UserCardForm.LoginName := FNeedShowUserCardLoginName;
  11457. // UserCardForm.TargetTop := FShowUserCardTargetTop;
  11458. end;
  11459. procedure TMainForm.ShowSystemNotices;
  11460. var
  11461. ANoticesRecord: TSystemNotices;
  11462. begin
  11463. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  11464. while ANoticesRecord.EndDate < Now do
  11465. begin
  11466. FSystemNotices.Delete(FSystemNoticeIndex);
  11467. FreeAndNil(ANoticesRecord);
  11468. if FSystemNotices.Count > 0 then
  11469. begin
  11470. if FSystemNoticeIndex >= FSystemNotices.Count then
  11471. FSystemNoticeIndex := FSystemNotices.Count - 1;
  11472. if FSystemNoticeIndex < 0 then
  11473. FSystemNoticeIndex := 0;
  11474. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  11475. end
  11476. else
  11477. begin
  11478. pnlForTopMessage.Visible := False;
  11479. TimerForShowSystemNotices.Enabled := False;
  11480. Exit;
  11481. end;
  11482. end;
  11483. lblLogsTitle.Caption := Format('系统公告(%d/%d)', [FSystemNoticeIndex + 1, FSystemNotices.Count]);
  11484. lblLogs.Caption := ANoticesRecord.Title;
  11485. lblLogs.Hint := ANoticesRecord.Title + '(有效期:' + DateTimeToStr(ANoticesRecord.EndDate) + ')';
  11486. TimerForShowSystemNotices.Enabled := False;
  11487. TimerForShowSystemNotices.Enabled := FSystemNotices.Count > 0;
  11488. end;
  11489. procedure TMainForm.btNextLogClick(Sender: TObject);
  11490. begin
  11491. Inc(FSystemNoticeIndex, 1);
  11492. if FSystemNoticeIndex >= FSystemNotices.Count then
  11493. FSystemNoticeIndex := 0;
  11494. ShowSystemNotices;
  11495. end;
  11496. procedure TMainForm.btn_lockClick(Sender: TObject);
  11497. var
  11498. iLoop: Integer;
  11499. AForm: TSMSForm;
  11500. begin
  11501. if Assigned(MessageBoxForm) then
  11502. MessageBoxForm.Hide;
  11503. if Assigned(MessagesManagerForm) then
  11504. MessagesManagerForm.Visible := False;
  11505. if Assigned(SearchForm) then
  11506. SearchForm.Visible := False;
  11507. for iLoop := SMSForms.Count - 1 downto 0 do
  11508. begin
  11509. AForm := SMSForms[iLoop];
  11510. AForm.Visible := False;
  11511. end;
  11512. pnlLocked.Visible := True;
  11513. pnlLocked.BringToFront;
  11514. ChangeTalkingFormVisible(False);
  11515. end;
  11516. procedure TMainForm.btn_unlockClick(Sender: TObject);
  11517. var
  11518. APassword: string;
  11519. iLoop: Integer;
  11520. AForm: TSMSForm;
  11521. begin
  11522. actOpenMainForm.Execute;
  11523. APassword := ShowMyInputBox(PChar('解锁'), PChar('请输入您的登录密码以解除锁定状态! '), '', 32);
  11524. if Trim(APassword) = '' then
  11525. Exit;
  11526. if AnsiSameText(APassword, MainForm.RealICQClient.Password) then
  11527. begin
  11528. ChangeTalkingFormVisible(True);
  11529. pnlLocked.Visible := False;
  11530. pnlMiddleClient.Visible := RealICQClient.Logined and RealICQClient.Connected;
  11531. if Assigned(MessagesManagerForm) then
  11532. MessagesManagerForm.Visible := True;
  11533. if Assigned(SearchForm) then
  11534. SearchForm.Visible := True;
  11535. for iLoop := SMSForms.Count - 1 downto 0 do
  11536. begin
  11537. AForm := SMSForms[iLoop];
  11538. AForm.Visible := True;
  11539. end;
  11540. end
  11541. else
  11542. begin
  11543. showmessage('您输入的密码有误! ');
  11544. end;
  11545. end;
  11546. procedure TMainForm.btPrevLogClick(Sender: TObject);
  11547. begin
  11548. Dec(FSystemNoticeIndex, 1);
  11549. if FSystemNoticeIndex < 0 then
  11550. FSystemNoticeIndex := FSystemNotices.Count - 1;
  11551. ShowSystemNotices;
  11552. end;
  11553. procedure TMainForm.spbShowNotReadMessageClick(Sender: TObject);
  11554. begin
  11555. { if MessageBoxForm=nil then
  11556. begin
  11557. MessageBoxForm:=TMessageBoxForm.Create(self);
  11558. end;
  11559. MessageBoxForm.Show; }
  11560. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(InBoxURL)])), '', SW_SHOWDEFAULT);
  11561. end;
  11562. //----------------------------------------------
  11563. procedure TMainForm.OpenNewWorkDisk(Path: string);
  11564. var
  11565. UserInfo: string;
  11566. C: TCopyDataStruct;
  11567. hwnd: THandle;
  11568. begin
  11569. WinExec(PChar(ExtractFilePath(Application.ExeName) + Path), sw_show);
  11570. UserInfo := RealICQClient.LoginName + #10 + RealICQClient.Password;
  11571. with c do
  11572. begin
  11573. dwData := WM_COPYDATA;
  11574. lpData := PChar(UserInfo + #0);
  11575. cbData := Length(UserInfo) + 2;
  11576. end;
  11577. hWnd := FindWindow(pchar('TMainForm'), pchar('网络存储'));
  11578. if hWnd <> 0 then
  11579. SendMessage(hwnd, WM_COPYDATA, 0, integer(@c));
  11580. end;
  11581. //---------------------------------------------------
  11582. procedure TMainForm.SaveBranchUserDataToXML(FileName: string);
  11583. var
  11584. iLoop: Integer;
  11585. XMLDocument: TXMLDocument;
  11586. Nodes, BranchsNode, BranchNode, UsersNode, UserNode: IXMLNode;
  11587. BranchInfo: TRealICQBranchInfo;
  11588. RealICQUser: TRealICQUser;
  11589. LoginName: string;
  11590. AUsers: TStringList;
  11591. begin
  11592. XMLDocument := TXMLDocument.Create(Self);
  11593. try
  11594. try
  11595. XMLDocument.Active := True;
  11596. if not FileExists(FileName) then
  11597. begin
  11598. XMLDocument.XML.Text := '<?xml version="1.0"?><Data>' + '<Branchs>' + '</Branchs>' + '<Users>' + '</Users></Data>';
  11599. XMLDocument.Active := True;
  11600. end
  11601. else
  11602. begin
  11603. XMLDocument.LoadFromFile(FileName);
  11604. end;
  11605. Nodes := XMLDocument.DocumentElement;
  11606. BranchsNode := Nodes.ChildNodes.Get(0);
  11607. UsersNode := Nodes.ChildNodes.Get(1);
  11608. BranchsNode.ChildNodes.Clear;
  11609. UsersNode.ChildNodes.Clear;
  11610. for iLoop := 0 to self.RealICQClient.Branchs.Count - 1 do
  11611. begin
  11612. BranchInfo := RealICQClient.Branchs.Objects[iLoop] as TRealICQBranchInfo;
  11613. BranchNode := BranchsNode.AddChild('Branch');
  11614. BranchNode.Attributes['ID'] := BranchInfo.ID;
  11615. BranchNode.Attributes['Name'] := BranchInfo.BranchName;
  11616. BranchNode.Attributes['ParentID'] := BranchInfo.ParentID;
  11617. end;
  11618. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  11619. try
  11620. for iLoop := 0 to AUsers.Count - 1 do
  11621. begin
  11622. RealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  11623. LoginName := RealICQUser.LoginName;
  11624. if AnsiPos('+', LoginName) > 0 then
  11625. LoginName := Copy(LoginName, AnsiPos('+', LoginName) + 1, Length(LoginName) - AnsiPos('+', LoginName));
  11626. UserNode := UsersNode.AddChild('User');
  11627. UserNode.Attributes['LoginName'] := LoginName;
  11628. UserNode.Attributes['DisplayName'] := RealICQUser.DisplayName;
  11629. UserNode.Attributes['BranchID'] := RealICQUser.BranchID;
  11630. end;
  11631. finally
  11632. FreeAndNil(AUsers);
  11633. end;
  11634. XMLDocument.SaveToFile(FileName);
  11635. except
  11636. on E: Exception do
  11637. showmessage(e.Message);
  11638. end;
  11639. finally
  11640. XMLDocument.Free;
  11641. end;
  11642. end;
  11643. //------网络存储-------------------------------------
  11644. procedure TMainForm.spbNetworkBackupClick(Sender: TObject);
  11645. var
  11646. UserInfo, LoginName: string;
  11647. C: TCopyDataStruct;
  11648. hwnd: THandle;
  11649. FilePath: string;
  11650. begin
  11651. FilePath := ExtractFilePath(paramstr(0)) + 'NetworkBackup\';
  11652. SaveBranchUserDataToXml(FilePath + 'BranchUsers.XML');
  11653. LoginName := RealICQClient.LoginName;
  11654. if AnsiPos('+', LoginName) > 0 then
  11655. LoginName := Copy(LoginName, AnsiPos('+', LoginName) + 1, Length(LoginName) - AnsiPos('+', LoginName));
  11656. WinExec(PChar(FilePath + 'NetworkBackup.exe ' + LoginName + ' ' + RealICQClient.Password), sw_show);
  11657. end;
  11658. procedure TMainForm.RealICQClientGettedAudioTransmiteConnectted(Sender: TObject; ALoginName: string);
  11659. var
  11660. TalkingForm: TTalkingForm;
  11661. begin
  11662. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11663. if TalkingForm = nil then
  11664. Exit;
  11665. if TalkingForm.CanWriteMessage then
  11666. TalkingForm.ShowGettedAudioTransmiteConnectted;
  11667. end;
  11668. //------------------------------------------------------------------------------
  11669. procedure TMainForm.RealICQClientGettedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  11670. var
  11671. AShowActive: Boolean;
  11672. TalkingForm: TTalkingForm;
  11673. iWaitTimes: Integer;
  11674. begin
  11675. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  11676. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11677. if TalkingForm = nil then
  11678. begin
  11679. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  11680. end;
  11681. iWaitTimes := 0;
  11682. while not TalkingForm.CanWriteMessage do
  11683. begin
  11684. Application.ProcessMessages;
  11685. Inc(iWaitTimes);
  11686. if iWaitTimes > 1000 then
  11687. break;
  11688. Sleep(10);
  11689. end;
  11690. if (GetForegroundWindow <> TalkingForm.Handle) then
  11691. begin
  11692. FlashWindow(TalkingForm.Handle, True);
  11693. if PlaySoundOnGetMessage then
  11694. PlayEventSound(FMessageEventSound);
  11695. end;
  11696. TalkingForm.ShowGettedAudioTransmiteRequest;
  11697. end;
  11698. //------------------------------------------------------------------------------
  11699. procedure TMainForm.RealICQClientGettedAudioTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  11700. var
  11701. TalkingForm: TTalkingForm;
  11702. begin
  11703. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11704. if TalkingForm = nil then
  11705. Exit;
  11706. if TalkingForm.CanWriteMessage then
  11707. TalkingForm.ShowGettedAudioTransmiteResponse(AAcceptted);
  11708. end;
  11709. //------显示全市页面查询结果------------------------------------------------------------------------
  11710. procedure TMainForm.RealICQClientSearchUserResult(Sender: TObject);
  11711. var
  11712. iIndex, iLoop: Integer;
  11713. ListItem: TRealICQContacterListItem;
  11714. RealICQUser: TRealICQUser;
  11715. Branch: TRealICQBranch;
  11716. RealICQContacterTreeView: TRealICQContacterTreeView;
  11717. begin
  11718. iIndex := FContacterListViews.IndexOf(LVMoreUsers);
  11719. FSearchMoreUserListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  11720. for iLoop := 0 to RealICQClient.SearchUsers.Count - 1 do
  11721. begin
  11722. RealICQUser := RealICQClient.SearchUsers.Objects[iLoop] as TRealICQUser;
  11723. iIndex := FSearchMoreUserListView.Items.IndexOf(RealICQUser.LoginName);
  11724. if iIndex = -1 then
  11725. begin
  11726. iIndex := FSearchMoreUserListView.Items.Add(RealICQUser.LoginName);
  11727. ListItem := FSearchMoreUserListView.Items.Objects[iIndex] as TRealICQContacterListItem;
  11728. ListItem.DisplayName := RealICQUser.DisplayName;
  11729. ListItem.LoginState := RealICQUser.LoginState;
  11730. ListItem.Data := RealICQUser;
  11731. Application.ProcessMessages;
  11732. end;
  11733. end;
  11734. RealICQContacterTreeView := FContacterTreeViews.Objects[FContacterTreeViews.IndexOf(LVMoreUsers)] as TRealICQContacterTreeView;
  11735. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  11736. begin
  11737. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  11738. if (AnsiPos(UpperCase(RealICQClient.KeyWord), UpperCase(Branch.BranchName)) > 0) or (AnsiPos(UpperCase(RealICQClient.KeyWord), GetPYIndexString(Branch.BranchName)) > 0) then
  11739. begin
  11740. iIndex := FSearchMoreUserListView.Items.Add(Branch.BranchName);
  11741. ListItem := FSearchMoreUserListView.Items.Objects[iIndex] as TRealICQContacterListItem;
  11742. ListItem.DisplayName := Branch.BranchName;
  11743. ListItem.LoginState := stOnline;
  11744. ListItem.StateIndex := 0;
  11745. ListItem.Data := Branch;
  11746. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  11747. end;
  11748. end;
  11749. PostMessage(FSearchMoreUserListView.Handle, WM_SIZE, 0, 0);
  11750. ImgLogining.Visible := False;
  11751. ScrollBoxSearchMoreUser.Visible := FSearchMoreUserListView.Items.Count > 0;
  11752. LblSearchHint.Visible := not ScrollBoxSearchMoreUser.Visible;
  11753. LblSearchHint.Caption := '没有找到相关记录';
  11754. end;
  11755. procedure TMainForm.RealICQClientSendedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  11756. var
  11757. TalkingForm: TTalkingForm;
  11758. begin
  11759. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11760. if TalkingForm = nil then
  11761. Exit;
  11762. if TalkingForm.CanWriteMessage then
  11763. TalkingForm.ShowSendedAudioTransmiteRequest;
  11764. end;
  11765. procedure TMainForm.RealICQClientSendedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  11766. var
  11767. TalkingForm: TTalkingForm;
  11768. begin
  11769. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11770. if TalkingForm = nil then
  11771. Exit;
  11772. if TalkingForm.CanWriteMessage then
  11773. TalkingForm.ShowSendedRemoteControlTransmiteControlRequest;
  11774. end;
  11775. procedure TMainForm.RealICQClientSendedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  11776. var
  11777. TalkingForm: TTalkingForm;
  11778. begin
  11779. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11780. if TalkingForm = nil then
  11781. Exit;
  11782. if TalkingForm.CanWriteMessage then
  11783. TalkingForm.ShowSendedRemoteControlTransmiteRequest;
  11784. end;
  11785. //------------------------------------------------------------------------------
  11786. procedure TMainForm.RealICQClientGettedCancelAudioTransmite(Sender: TObject; ALoginName: string);
  11787. var
  11788. TalkingForm: TTalkingForm;
  11789. begin
  11790. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11791. if TalkingForm = nil then
  11792. Exit;
  11793. if TalkingForm.CanWriteMessage then
  11794. TalkingForm.ShowCanceledAudioTransmite;
  11795. end;
  11796. procedure TMainForm.RealICQClientGettedCancelRemoteControlTransmite(Sender: TObject; ALoginName: string);
  11797. var
  11798. TalkingForm: TTalkingForm;
  11799. begin
  11800. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11801. if TalkingForm = nil then
  11802. Exit;
  11803. if TalkingForm.CanWriteMessage then
  11804. TalkingForm.ShowCanceledRemoteControlTransmite;
  11805. end;
  11806. //------------------------------------------------------------------------------
  11807. procedure TMainForm.RealICQClientGettedStopAudioTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  11808. var
  11809. TalkingForm: TTalkingForm;
  11810. begin
  11811. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11812. if TalkingForm = nil then
  11813. Exit;
  11814. if TalkingForm.CanWriteMessage then
  11815. TalkingForm.ShowStoppedAudioTransmite(AIsStopper);
  11816. end;
  11817. procedure TMainForm.RealICQClientGettedStopRemoteControlTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  11818. var
  11819. TalkingForm: TTalkingForm;
  11820. begin
  11821. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11822. if TalkingForm = nil then
  11823. Exit;
  11824. if TalkingForm.CanWriteMessage then
  11825. TalkingForm.ShowStoppedRemoteControlTransmite(AIsStopper);
  11826. end;
  11827. //------------------------------------------------------------------------------
  11828. procedure TMainForm.RealICQClientGettedVideoTransmiteConnectted(Sender: TObject; ALoginName: string; ASendBigBmp, ARecvBigBmp: Boolean);
  11829. var
  11830. TalkingForm: TTalkingForm;
  11831. begin
  11832. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11833. if TalkingForm = nil then
  11834. Exit;
  11835. if TalkingForm.CanWriteMessage then
  11836. TalkingForm.ShowGettedVideoTransmiteConnectted(ASendBigBmp, ARecvBigBmp);
  11837. end;
  11838. //------------------------------------------------------------------------------
  11839. procedure TMainForm.RealICQClientGettedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  11840. var
  11841. AShowActive: Boolean;
  11842. TalkingForm: TTalkingForm;
  11843. iWaitTimes: Integer;
  11844. begin
  11845. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  11846. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11847. if TalkingForm = nil then
  11848. begin
  11849. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  11850. end;
  11851. iWaitTimes := 0;
  11852. while not TalkingForm.CanWriteMessage do
  11853. begin
  11854. Application.ProcessMessages;
  11855. Inc(iWaitTimes);
  11856. if iWaitTimes > 1000 then
  11857. break;
  11858. Sleep(10);
  11859. end;
  11860. if (GetForegroundWindow <> TalkingForm.Handle) then
  11861. begin
  11862. FlashWindow(TalkingForm.Handle, True);
  11863. if PlaySoundOnGetMessage then
  11864. PlayEventSound(FMessageEventSound);
  11865. end;
  11866. TalkingForm.ShowGettedVideoTransmiteRequest;
  11867. end;
  11868. //------------------------------------------------------------------------------
  11869. procedure TMainForm.RealICQClientGettedVideoTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  11870. var
  11871. TalkingForm: TTalkingForm;
  11872. begin
  11873. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11874. if TalkingForm = nil then
  11875. Exit;
  11876. if TalkingForm.CanWriteMessage then
  11877. TalkingForm.ShowGettedVideoTransmiteResponse(AAcceptted);
  11878. end;
  11879. procedure TMainForm.RealICQClientGettedWebUrl(Sender: TObject);
  11880. begin
  11881. // if trim(RealICQClient.WeatherUrl)<>'' then
  11882. // begin
  11883. // FDownFile.OnComplete:=DownFileComplete;
  11884. // FDownFile.ThreadDownFile(RealICQClient.WeatherUrl,ExtractFilePath(Application.ExeName)+'Weather.txt');
  11885. // end;
  11886. end;
  11887. //------------------------------------------------------------------------------
  11888. procedure TMainForm.RealICQClientSendedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  11889. var
  11890. TalkingForm: TTalkingForm;
  11891. begin
  11892. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11893. if TalkingForm = nil then
  11894. Exit;
  11895. if TalkingForm.CanWriteMessage then
  11896. TalkingForm.ShowSendedVideoTransmiteRequest;
  11897. end;
  11898. //------------------------------------------------------------------------------
  11899. procedure TMainForm.RealICQClientGettedCancelVideoTransmite(Sender: TObject; ALoginName: string);
  11900. var
  11901. TalkingForm: TTalkingForm;
  11902. begin
  11903. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11904. if TalkingForm = nil then
  11905. Exit;
  11906. if TalkingForm.CanWriteMessage then
  11907. TalkingForm.ShowCanceledVideoTransmite;
  11908. end;
  11909. procedure TMainForm.RealICQClientGettedCanSendSMSCount(Sender: TObject);
  11910. begin
  11911. UpdateCanSendSMSCount;
  11912. end;
  11913. //------------------------------------------------------------------------------
  11914. procedure TMainForm.RealICQClientGettedStopVideoTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  11915. var
  11916. TalkingForm: TTalkingForm;
  11917. begin
  11918. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11919. if TalkingForm = nil then
  11920. Exit;
  11921. if TalkingForm.CanWriteMessage then
  11922. TalkingForm.ShowStoppedVideoTransmite(AIsStopper);
  11923. end;
  11924. //---显示黑名单-------------------------------------------------------------
  11925. procedure TMainForm.ShowBlacklists;
  11926. var
  11927. iLoop, ItemIndex: Integer;
  11928. RealICQUser: TRealICQUser;
  11929. FriendTreeView: TRealICQContacterTreeView;
  11930. Friend: TRealICQEmployee;
  11931. begin
  11932. SetFlashCaptionOnOnlineValue(False);
  11933. try
  11934. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  11935. FriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  11936. for iLoop := 0 to RealICQClient.Blacklists.Count - 1 do
  11937. begin
  11938. RealICQUser := RealICQClient.Blacklists.Objects[iLoop] as TRealICQUser;
  11939. if trim(RealICQUser.DisplayName) = '' then
  11940. TUsersService.GetUsersService.GetOrRequestUser(RealICQUser.LoginName, RealICQClient);
  11941. if (FriendTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then
  11942. Continue;
  11943. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  11944. Friend.BranchID := LVBlackLists;
  11945. FriendTreeView.AddEmployee(Friend);
  11946. UpdateFriendNode(Friend, RealICQUser, False);
  11947. end;
  11948. finally
  11949. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  11950. end;
  11951. end;
  11952. //------------------------------------------------------------------------------
  11953. procedure TMainForm.RealICQClientGettedBlacklists(Sender: TObject);
  11954. begin
  11955. ShowBlacklists;
  11956. end;
  11957. //-------显示与自己不同部门的联系人------------------------------
  11958. procedure TMainForm.RealICQClientGettedBranchUser(Sender: TObject);
  11959. var
  11960. iLoop, ItemIndex: Integer;
  11961. RealICQUser: TRealICQUser;
  11962. RealICQContacterTreeView: TRealICQContacterTreeView;
  11963. Employee: TRealICQEmployee;
  11964. TmpBranch, RootBranch: TRealICQBranch;
  11965. OnlineEmployee: Integer;
  11966. begin
  11967. // TmpBranch:=nil;
  11968. // RootBranch:=nil;
  11969. // ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  11970. // RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  11971. // RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  11972. // RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  11973. // RealICQContacterTreeView.AdjustPosition :=False;
  11974. // RealICQContacterTreeView.HideSystemScrollBar;
  11975. // pgcMainWorkArea.DisableAlign;
  11976. // RealICQContacterTreeView.BeginUpdate;
  11977. // try
  11978. // ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户');
  11979. // if ItemIndex>=0 then
  11980. // RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  11981. // OnlineEmployee:=0;
  11982. //
  11983. // for iLoop:=0 to RealICQContacterTreeView.EmployeeItems.Count-1 do
  11984. // begin
  11985. // Employee:=RealICQContacterTreeView.EmployeeItems.Objects[iLoop] as TRealICQEmployee;
  11986. // if (Employee.LoginState <> stOffline) and (Employee.LoginState <> stHidden) then
  11987. // OnlineEmployee := OnlineEmployee + 1;
  11988. // end;
  11989. // for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  11990. // begin
  11991. // TmpBranch:=RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  11992. // if not TmpBranch.IsGetUserList then
  11993. // begin
  11994. // TmpBranch.OnlineEmployee:=0;
  11995. // TmpBranch.EmployeeCount:=0;
  11996. // TmpBranch.IsGetUserList:=True;
  11997. // end;
  11998. // if (TmpBranch.ParentID='0') then
  11999. // RootBranch:=TmpBranch
  12000. // end;
  12001. // if RootBranch<>nil then
  12002. // begin
  12003. // RootBranch.OnlineEmployee:=OnlineEmployee;
  12004. // RootBranch.EmployeeCount:= RealICQContacterTreeView.EmployeeItems.Count;
  12005. // end;
  12006. // {$region '添加联系人'}
  12007. // for iLoop := RealICQClient.Friends.Count - 1 downto 0 do
  12008. // begin
  12009. // RealICQUser := RealICQClient.Friends.Objects[iLoop] as TRealICQUser;
  12010. // if (RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then Continue;
  12011. // if AnsiSameText(RealICQUser.BranchID, 'U') then Continue;
  12012. //
  12013. // Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12014. // Employee.BranchID := RealICQUser.BranchID;
  12015. // Employee.HasAddFreindButton:=False;
  12016. // Employee.HasEmail :=False;
  12017. // RealICQContacterTreeView.AddEmployee(Employee);
  12018. // if Assigned(Employee.Node.Parent) then
  12019. // begin
  12020. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12021. // end
  12022. // else
  12023. // FreeAndNil(Employee);
  12024. // end;
  12025. // {$endregion}
  12026. // PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12027. // finally
  12028. // RealICQContacterTreeView.EndUpdate;
  12029. // pgcMainWorkArea.EnableAlign;
  12030. // end;
  12031. end;
  12032. //------------------------------------------------------------------------------
  12033. procedure TMainForm.LoadLatests;
  12034. var
  12035. FLatestUsers: TStringList;
  12036. RealICQUser: TRealICQUser;
  12037. RealICQContacterListItem: TRealICQContacterListItem;
  12038. iLoop, ItemIndex: Integer;
  12039. LoginName: string;
  12040. begin
  12041. FLatestUsers := DBHistory.GetLatests(RealICQClient.LoginName);
  12042. try
  12043. for iLoop := 0 to FLatestUsers.Count - 1 do
  12044. begin
  12045. if iLoop >= 20 then
  12046. Break;
  12047. LoginName := FLatestUsers[iLoop];
  12048. if (AnsiPos('+', LoginName) <= 0) and (trim(RealICQClient.CenterServerID) <> '') then
  12049. LoginName := RealICQClient.CenterServerID + '+' + LoginName;
  12050. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  12051. if RealICQUser = nil then
  12052. Continue;
  12053. if not AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  12054. begin
  12055. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  12056. if ItemIndex = -1 then
  12057. ItemIndex := FLVLatests.Items.Add(RealICQUser.LoginName);
  12058. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  12059. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  12060. end;
  12061. end;
  12062. finally
  12063. FreeAndNil(FLatestUsers);
  12064. end;
  12065. end;
  12066. //------------------------------------------------------------------------------
  12067. procedure TMainForm.GetOtherBranchs;
  12068. var
  12069. iLoop: Integer;
  12070. RealICQUser: TRealICQUser;
  12071. ALoginNames: string;
  12072. begin
  12073. ALoginNames := '';
  12074. for iLoop := 0 to FNotAddedEmployeeList.Count - 1 do
  12075. begin
  12076. RealICQUser := FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  12077. ALoginNames := ALoginNames + RealICQUser.LoginName;
  12078. if (iLoop < FNotAddedEmployeeList.Count - 1) then
  12079. ALoginNames := ALoginNames + Chr(10);
  12080. end;
  12081. if (Length(Trim(ALoginNames)) > 0) then
  12082. RealICQClient.SendGetFriendsInfo(ALoginNames);
  12083. end;
  12084. //-----计算某个部门的总上线人数和总用户数-----------------------------------
  12085. procedure TMainForm.GetBranchEmpOnlineAndSum(Branchs: TStringList; BranchInfo: TRealICQBranchInfo; var OnlineEmployee, EmployeeCount: Integer);
  12086. var
  12087. iLoop: Integer;
  12088. TmpBranchInfo: TRealICQBranchInfo;
  12089. begin
  12090. OnlineEmployee := OnlineEmployee + BranchInfo.OnlineEmployee;
  12091. EmployeeCount := EmployeeCount + BranchInfo.EmployeeCount;
  12092. for iLoop := 0 to Branchs.Count - 1 do
  12093. begin
  12094. TmpBranchInfo := Branchs.Objects[iLoop] as TRealICQBranchInfo;
  12095. if TmpBranchInfo.ParentID = BranchInfo.ID then
  12096. begin
  12097. GetBranchEmpOnlineAndSum(Branchs, TmpBranchInfo, OnlineEmployee, EmployeeCount);
  12098. end;
  12099. end;
  12100. end;
  12101. //------------------------------------------------------------------------------
  12102. procedure TMainForm.ShowBranchAndUsers(ExpandSelfNode: Boolean = False);
  12103. var
  12104. iLoop, ItemIndex: Integer;
  12105. OnlineEmployee, EmployeeCount: Integer;
  12106. RealICQUser: TRealICQUser;
  12107. RealICQContacterTreeView: TRealICQContacterTreeView;
  12108. BranchInfo: TRealICQBranchInfo;
  12109. Branch: TRealICQBranch;
  12110. Employee: TRealICQEmployee;
  12111. ParentNode: TTreeNode;
  12112. begin
  12113. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  12114. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12115. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12116. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12117. RealICQContacterTreeView.AdjustPosition := False;
  12118. RealICQContacterTreeView.HideSystemScrollBar;
  12119. //pgcMainWorkArea.DisableAlign;
  12120. { TODO -olqq -c : 添加部门和用户 2015/3/14 17:03:49 }
  12121. { TODO -olqq -c : 需要考虑 2015/3/14 17:05:43 }
  12122. RealICQContacterTreeView.BeginUpdate;
  12123. try
  12124. // {$region '添加部门'}
  12125. for iLoop := 0 to RealICQClient.Branchs.Count - 1 do
  12126. begin
  12127. BranchInfo := RealICQClient.Branchs.Objects[iLoop] as TRealICQBranchInfo;
  12128. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12129. Continue;
  12130. OnlineEmployee := 0;
  12131. EmployeeCount := 0;
  12132. GetBranchEmpOnlineAndSum(RealICQClient.Branchs, BranchInfo, OnlineEmployee, EmployeeCount);
  12133. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12134. Branch.BranchID := BranchInfo.ID;
  12135. Branch.ParentID := BranchInfo.ParentID;
  12136. Branch.IsGetUserList := False;
  12137. Branch.OnlineEmployee := OnlineEmployee;
  12138. Branch.EmployeeCount := EmployeeCount;
  12139. RealICQContacterTreeView.AddBranch(Branch);
  12140. end;
  12141. //
  12142. // RealICQContacterTreeView.ReAlignBranchs;
  12143. // {$endregion}
  12144. // {$region '添加联系人'}
  12145. //
  12146. // for iLoop := RealICQClient.Friends.Count - 1 downto 0 do
  12147. // begin
  12148. // RealICQUser := RealICQClient.Friends.Objects[iLoop] as TRealICQUser;
  12149. //
  12150. // if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  12151. // begin
  12152. // ShowMeInformation;
  12153. // end;
  12154. // //if (RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then Continue;
  12155. //
  12156. // Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12157. // Employee.BranchID := RealICQUser.BranchID;
  12158. // Employee.HasEmail :=False;// (Length(Trim(RealICQUser.Email)) > 0);
  12159. // Employee.HasAddFreindButton:=False;
  12160. //
  12161. //
  12162. // if not AnsiSameText(Employee.BranchID, 'U') then
  12163. // begin
  12164. // RealICQContacterTreeView.AddEmployee(Employee);
  12165. // if Assigned(Employee.Node.Parent) then
  12166. // begin
  12167. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12168. // end
  12169. // else
  12170. // begin
  12171. // FreeAndNil(Employee);
  12172. // if AnsiPos('-',RealICQUser.LoginName)>0 then
  12173. // begin
  12174. // // RealICQClient.GetUserInformation(RealICQUser.LoginName,True);
  12175. // if (FNotAddedEmployeeList.IndexOf(RealICQUser.LoginName)) < 0 then
  12176. // FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  12177. // end;
  12178. // end;
  12179. // end
  12180. // else
  12181. // begin
  12182. //
  12183. // if AnsiPos('-',RealICQUser.LoginName)>0 then
  12184. // begin
  12185. // TUsersService.GetUsersService.RequestUserInformation(RealICQUser.LoginName, RealICQClient);
  12186. // if (FNotAddedEmployeeList.IndexOf(RealICQUser.LoginName)) < 0 then
  12187. // FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  12188. // end;
  12189. // end;
  12190. // end;
  12191. // {$endregion}
  12192. // {$region '展开自己所在的部门树'}
  12193. if ExpandSelfNode then
  12194. begin
  12195. Employee := RealICQContacterTreeView.GetEmployee(RealICQClient.Me.LoginName);
  12196. ParentNode := Employee.Node.Parent;
  12197. while ParentNode <> nil do
  12198. begin
  12199. ParentNode.Expanded := True;
  12200. Branch := ParentNode.Data;
  12201. Branch.IsGetUserList := True;
  12202. ParentNode := ParentNode.Parent;
  12203. end;
  12204. RealICQContacterTreeView.MoveScrollBarToTop;
  12205. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12206. end;
  12207. {$endregion}
  12208. finally
  12209. RealICQContacterTreeView.EndUpdate;
  12210. //pgcMainWorkArea.EnableAlign;
  12211. end;
  12212. GetOtherBranchs;
  12213. end;
  12214. //-------------
  12215. procedure TMainForm.ShowBranchAndFriends;
  12216. begin
  12217. end;
  12218. //------------------------------------------------------------------------------
  12219. procedure TMainForm.RealICQClientUsersBranchReady(Sender: TObject);
  12220. begin
  12221. //
  12222. end;
  12223. //------------------------------------------------------------------------------
  12224. procedure TMainForm.RealICQClientGettedFriendList(Sender: TObject);
  12225. begin
  12226. RealICQClient.OnGetCanSendSMSCount := Self.RealICQClientGettedCanSendSMSCount;
  12227. lblLoginState.Caption := '载入联系人列表...';
  12228. lblLoginState.Refresh;
  12229. try
  12230. if tsCustomers.Parent <> nil then
  12231. begin
  12232. tsCustomers.Parent := nil;
  12233. tsCustomers.PageControl := nil;
  12234. pgcMainWorkArea.RemoveControl(tsCustomers);
  12235. end;
  12236. except
  12237. end;
  12238. { TODO -olqq -c : 需要考虑 2015/3/14 17:06:30 }
  12239. //读取最近的联系人列表
  12240. try
  12241. LoadLatests;
  12242. except
  12243. end;
  12244. {$region '读取配置信息'}
  12245. try
  12246. //读取组配置信息
  12247. LoadGroupConfigs;
  12248. except
  12249. DeleteFile(TRealICQClient.GetUserDir + GroupConfigXMLFile);
  12250. LoadGroupConfigs;
  12251. end;
  12252. try
  12253. //读取样式
  12254. LoadStyleConfigs;
  12255. except
  12256. DeleteFile(TRealICQClient.GetUserDir + StyleConfigXMLFile);
  12257. LoadStyleConfigs;
  12258. end;
  12259. try
  12260. //读取热键设置
  12261. LoadHotKeyConfigs;
  12262. except
  12263. DeleteFile(TRealICQClient.GetUserDir + HotKeyConfigXMLFile);
  12264. LoadHotKeyConfigs;
  12265. end;
  12266. try
  12267. //读取消息提示和声音配置信息
  12268. LoadHintAndSoundConfigs;
  12269. except
  12270. DeleteFile(TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile);
  12271. LoadHintAndSoundConfigs;
  12272. end;
  12273. try
  12274. //读取文件传输配置选项
  12275. LoadReceiveFileConfigs;
  12276. except
  12277. DeleteFile(TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile);
  12278. LoadReceiveFileConfigs;
  12279. end;
  12280. try
  12281. //读取安全配置选项
  12282. LoadSafeConfigs;
  12283. except
  12284. DeleteFile(TRealICQClient.GetUserDir + SafeConfigXMLFile);
  12285. LoadSafeConfigs;
  12286. end;
  12287. try
  12288. //读取字体,表情等信息
  12289. LoadInputConfigs;
  12290. except
  12291. DeleteFile(TRealICQClient.GetUserDir + InputConfigXMLFile);
  12292. LoadInputConfigs;
  12293. end;
  12294. try
  12295. //读取出差设置
  12296. LoadOfflineAutoResponseSets;
  12297. except
  12298. DeleteFile(TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile);
  12299. LoadOfflineAutoResponseSets;
  12300. end;
  12301. {$endregion}
  12302. SetFlashCaptionOnOnlineValue(False);
  12303. FCanAlert := False;
  12304. // ShowBranchAndUsers(True);
  12305. try
  12306. //重新保存组成员列表
  12307. SaveGroupConfigs;
  12308. except
  12309. end;
  12310. FCanAlert := True;
  12311. ChangeUIColor(FUIMainColor);
  12312. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  12313. try
  12314. CheckCacheDir;
  12315. except
  12316. end;
  12317. try
  12318. ShowGroupInterface;
  12319. except
  12320. end;
  12321. spbShowNotReadMessage.Caption := Format('(%d)', [0]);
  12322. RealICQClient.SendGetNewInformation(0);
  12323. Sleep(50);
  12324. pnlForTopMessage.Visible := False;
  12325. RealICQClient.SendGetNewInformation(1);
  12326. if ScrollBoxTeam.Visible or PnlMoreUser.Visible or ScrollBoxMyFriend.Visible or ScrollBoxLatests.Visible then
  12327. else
  12328. SetToolBarState(MyContacters);
  12329. try
  12330. RealICQClientReceivedAdversement(nil);
  12331. except
  12332. end;
  12333. RealICQClient.SendGetMoreServerList;
  12334. // PostMessage(Handle, WM_SIZE, 0, 0);
  12335. //Application.ProcessMessages;
  12336. RealICQClient.SendGetWebUrl;
  12337. if FIsLogout then
  12338. RealICQClient.SendGetMoreServerList;
  12339. MainForm.RealICQClient.OnGettedAddrBookGroups := GettedAddrBookGroups;
  12340. MainForm.RealICQClient.OnManageAddrBookResult := GettedManageAddrBookResult;
  12341. RealICQClient.SendGetAddrBookGroup;
  12342. // if RealICQClient.ShowMiniPage then
  12343. // RealICQClient.SendGetNewInformation(2);
  12344. if TCustomerConfig.GetConfig.ShowGuideView then
  12345. btShowMiniPageClick(nil);
  12346. try
  12347. pgcMainWorkArea.ActivePageIndex := 0;
  12348. except
  12349. end;
  12350. end;
  12351. procedure TMainForm.TimerForGetBranchOnlineStatesTimer(Sender: TObject);
  12352. begin
  12353. miChangeServerClick(nil);
  12354. TimerForGetBranchUsersOnlineStates.Enabled := False;
  12355. TimerForGetBranchUsersOnlineStates.Enabled := True;
  12356. end;
  12357. procedure TMainForm.TimerForGetBranchUsersOnlineStatesTimer(Sender: TObject);
  12358. var
  12359. iLoop, ItemIndex: Integer;
  12360. RealICQContacterTreeView: TRealICQContacterTreeView;
  12361. Branch: TRealICQBranch;
  12362. StrBranchs: string;
  12363. begin
  12364. TimerForGetBranchUsersOnlineStates.Enabled := False;
  12365. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12366. if ItemIndex >= 0 then
  12367. begin
  12368. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12369. StrBranchs := '';
  12370. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12371. begin
  12372. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  12373. if Branch.Node.Expanded then
  12374. begin
  12375. StrBranchs := StrBranchs + Branch.BranchID + ',';
  12376. end;
  12377. end;
  12378. miChangeServerClick(nil);
  12379. if Length(StrBranchs) > 0 then
  12380. RealICQClient.SendGetMoreUser(StrBranchs, FCurrentServerID);
  12381. end;
  12382. end;
  12383. procedure TMainForm.btShowMiniPageClick(Sender: TObject);
  12384. var
  12385. AShowMiniPageSet, AShowMiniPageWhenEverLoginSet: Boolean;
  12386. jo: ISuperObject;
  12387. begin
  12388. jo := SO();
  12389. if TConditionConfig.GetConfig.RemoteUI then
  12390. begin
  12391. jo.S['url'] := Format('%s/guideview/#/',[TConditionConfig.GetConfig.RemoteUIHost]);
  12392. end
  12393. else
  12394. jo.S['url'] := ExtractFilePath(paramstr(0))+ 'html/guideview/#/';
  12395. jo.S['caption'] := '引导页';
  12396. jo.B['center'] := True;
  12397. jo.B['unsizeable'] := True;
  12398. // if not Assigned(AGuideViewForm) then
  12399. AGuideViewForm := TGuideViewForm.Create(Self);
  12400. AGuideViewForm.SetFormInfo(jo.AsString);
  12401. AGuideViewForm.Show;
  12402. // AShowMiniPageSet := RealICQClient.ShowMiniPageSet;
  12403. // AShowMiniPageWhenEverLoginSet := RealICQClient.ShowMiniPageWhenEverLoginSet;
  12404. // try
  12405. // RealICQClient.ShowMiniPageSet := True;
  12406. // RealICQClient.ShowMiniPageWhenEverLoginSet := True;
  12407. // RealICQClientGettedMiniPageSets(nil);
  12408. // finally
  12409. // RealICQClient.ShowMiniPageSet := AShowMiniPageSet;
  12410. // RealICQClient.ShowMiniPageWhenEverLoginSet := AShowMiniPageWhenEverLoginSet;
  12411. // end;
  12412. end;
  12413. procedure TMainForm.RealICQClientGettedMiniPageSets(Sender: TObject);
  12414. var
  12415. SystemMessage: TRealICQSystemMessage;
  12416. UserLoginName: string;
  12417. begin
  12418. //if (Sender <> nil) then
  12419. if not RealICQClient.ShowMiniPageSet then
  12420. Exit;
  12421. SystemMessage := TRealICQSystemMessage.Create;
  12422. SystemMessage.MessageID := 10000;
  12423. SystemMessage.MessageType := mtAdvertisement;
  12424. SystemMessage.AutoOpenWindow := True;
  12425. SystemMessage.Position := mpCenter;
  12426. SystemMessage.Left := 0;
  12427. SystemMessage.Top := 0;
  12428. SystemMessage.Width := 618;
  12429. SystemMessage.Height := 465;
  12430. SystemMessage.Delay := 0;
  12431. SystemMessage.MaxShowTimes := 0;
  12432. SystemMessage.Title := '每日新闻';
  12433. SystemMessage.Content := '';
  12434. UserLoginName := MainForm.RealICQClient.LoginName;
  12435. if Pos('+', UserLoginName) > 0 then
  12436. UserLoginName := Copy(UserLoginName, Pos('+', UserLoginName) + 1, Length(UserLoginName));
  12437. //SystemMessage.URL := Format(MiniPageURL, [UserLoginName]);
  12438. SystemMessage.URL := Format(RealICQClient.WebAppBaseURL + MiniPageURL, [UserLoginName]);
  12439. SystemMessage.AutoCloseTime := 0;
  12440. if RealICQClient.ShowMiniPageWhenEverLoginSet then
  12441. SystemMessage.MaxShowTimes := 0
  12442. else
  12443. SystemMessage.MaxShowTimes := 1;
  12444. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  12445. end;
  12446. procedure TMainForm.RealICQClientGettedMoreBranchList(Sender: TObject);
  12447. var
  12448. iLoop, jLoop, ItemIndex: Integer;
  12449. RealICQContacterTreeView: TRealICQContacterTreeView;
  12450. BranchInfo: TRealICQBranchInfo;
  12451. Branch, TopBranch: TRealICQBranch;
  12452. OnlineEmployee, EmployeeCount: Integer;
  12453. AFinded: Boolean;
  12454. Employee: TRealICQEmployee;
  12455. begin
  12456. AFinded := False;
  12457. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12458. if ItemIndex >= 0 then
  12459. begin
  12460. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12461. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12462. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12463. for iLoop := 0 to RealICQClient.MoreBranchs.Count - 1 do
  12464. begin
  12465. BranchInfo := RealICQClient.MoreBranchs.Objects[iLoop] as TRealICQBranchInfo;
  12466. if BranchInfo.ParentID = '0' then
  12467. begin
  12468. for jLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12469. begin
  12470. Branch := RealICQContacterTreeView.BranchItems.Objects[jLoop] as TRealICQBranch;
  12471. if (Branch.ParentID = '0') and AnsiSameText(Branch.BranchID, BranchInfo.ID) then
  12472. begin
  12473. AFinded := True;
  12474. Break;
  12475. end;
  12476. end;
  12477. Break;
  12478. end;
  12479. end;
  12480. if not AFinded then
  12481. begin
  12482. try
  12483. RealICQContacterTreeView.Clear;
  12484. FreeAndNil(RealICQContacterTreeView);
  12485. FContacterTreeViews.Delete(ItemIndex);
  12486. except
  12487. Exit;
  12488. end;
  12489. end;
  12490. end;
  12491. if not AFinded then
  12492. ItemIndex := AddContacterTreeView(ScrollBoxMoreUser, LVMoreUsers)
  12493. else
  12494. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12495. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12496. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12497. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12498. RealICQContacterTreeView.AdjustPosition := False;
  12499. RealICQContacterTreeView.AutoChangeOnlineNumeric := False;
  12500. if not AFinded then
  12501. begin
  12502. RealICQContacterTreeView.HideSystemScrollBar;
  12503. tsContacters.DisableAlign;
  12504. RealICQContacterTreeView.BeginUpdate;
  12505. end;
  12506. try
  12507. {$region '添加部门'}
  12508. for iLoop := 0 to RealICQClient.MoreBranchs.Count - 1 do
  12509. begin
  12510. BranchInfo := RealICQClient.MoreBranchs.Objects[iLoop] as TRealICQBranchInfo;
  12511. OnlineEmployee := 0;
  12512. EmployeeCount := 0;
  12513. //GetBranchEmpOnlineAndSum(RealICQClient.MoreBranchs, BranchInfo, OnlineEmployee,EmployeeCount);
  12514. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12515. begin
  12516. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12517. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12518. //Branch.EmployeeCount := EmployeeCount;
  12519. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12520. Branch.Update;
  12521. Continue;
  12522. end;
  12523. //-----------------------------------------------------------------
  12524. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12525. Branch.BranchID := BranchInfo.ID;
  12526. Branch.ParentID := BranchInfo.ParentID;
  12527. if Branch.ParentID = '0' then
  12528. begin
  12529. TopBranch := Branch;
  12530. //EmployeeCount:=EmployeeCount-BranchInfo.EmployeeCount;
  12531. if BranchInfo.EmployeeCount > 0 then
  12532. begin
  12533. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12534. end;
  12535. end;
  12536. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12537. //Branch.EmployeeCount:=EmployeeCount;
  12538. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12539. RealICQContacterTreeView.AddBranch(Branch);
  12540. Application.ProcessMessages;
  12541. end;
  12542. {$endregion}
  12543. if not AFinded then
  12544. begin
  12545. RealICQContacterTreeView.ReAlignBranchs;
  12546. if Assigned(TopBranch) then
  12547. TopBranch.Node.Expanded := True;
  12548. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12549. RealICQContacterTreeView.MoveScrollBarToTop;
  12550. end;
  12551. finally
  12552. if not AFinded then
  12553. begin
  12554. RealICQContacterTreeView.EndUpdate;
  12555. tsContacters.EnableAlign;
  12556. end;
  12557. end;
  12558. ImgLoadingMoreBranchs.Visible := False;
  12559. ScrollBoxMoreUser.Visible := True;
  12560. {TimerForGetBranchOnlineStates.Enabled := False;
  12561. TimerForGetBranchOnlineStates.Enabled := True;}
  12562. end;
  12563. //----用户单击部门------------------------------------
  12564. procedure TMainForm.NodeBranchClick(Sender: TObject; Branch: TRealICQBranch);
  12565. var
  12566. RealICQContacterTreeView: TRealICQContacterTreeView;
  12567. ItemIndex: Integer;
  12568. Employee: TRealICQEmployee;
  12569. BranchInfo: TRealICQBranchInfo;
  12570. begin
  12571. //-------获取指定部门下的用户------------------------------------------------
  12572. if (not Branch.IsGetUserList) then// and (FGetUsersTask.IndexOf(Branch.BranchID) < 0) then
  12573. begin
  12574. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12575. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12576. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12577. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12578. // BranchInfo := MainForm.RealICQClient.MoreBranchs.Objects[MainForm.RealICQClient.MoreBranchs.IndexOf(Branch.BranchID)] as TRealICQBranchInfo;
  12579. // FGetUsersTask.AddObject(Branch.BranchID, Branch);
  12580. // if (BranchInfo.IsGetUserList) then
  12581. // begin
  12582. // //RealICQContacterTreeView.ReCalculateEmployeeCount(Branch);
  12583. // RealICQClientGettedMoreUserList(nil)
  12584. // end
  12585. // else
  12586. if RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户') < 0 then
  12587. begin
  12588. Employee := TRealICQEmployee.Create('正在下载用户');
  12589. Employee.BranchID := Branch.BranchID;
  12590. RealICQContacterTreeView.AddEmployee(Employee);
  12591. Branch.Node.Expanded := True;
  12592. GetBranchUser(Branch);
  12593. Branch.IsGetUserList := True;
  12594. end;
  12595. end;
  12596. end;
  12597. //----------------------------------------------------------------------------
  12598. procedure TMainForm.GetBranchUser(Branch: TRealICQBranch);
  12599. var
  12600. RealICQContacterTreeView: TRealICQContacterTreeView;
  12601. iIndex: Integer;
  12602. begin
  12603. SetGetMoreUserEvent;
  12604. //iIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12605. //RealICQContacterTreeView := FContacterTreeViews.Objects[iIndex] as TRealICQContacterTreeView;
  12606. //RealICQContacterTreeView.ReCalculateEmployeeCount(Branch);
  12607. RealICQClient.SendGetBranchs(FCurrentServerID, StrToInt(Branch.BranchID));
  12608. Sleep(5);
  12609. RealICQClient.SendGetMoreUser(Branch.BranchID, FCurrentServerID);
  12610. end;
  12611. //----------------------------------------------------------------------
  12612. procedure TMainForm.RealICQClientGettedMoreUserList(Sender: TObject);
  12613. var
  12614. iLoop, ItemIndex: Integer;
  12615. RealICQUser: TRealICQUser;
  12616. RealICQContacterTreeView: TRealICQContacterTreeView;
  12617. Employee: TRealICQEmployee;
  12618. TmpBranch, Branch, TopBranch: TRealICQBranch;
  12619. ParentNode: TTreeNode;
  12620. BranchInfo: TRealICQBranchInfo;
  12621. begin
  12622. TmpBranch := nil;
  12623. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12624. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12625. RealICQContacterTreeView.AdjustPosition := False;
  12626. RealICQContacterTreeView.HideSystemScrollBar;
  12627. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  12628. RealICQContacterTreeView.OnItemOnline := nil;
  12629. RealICQContacterTreeView.OnItemOffline := nil;
  12630. tsContacters.DisableAlign;
  12631. RealICQContacterTreeView.BeginUpdate;
  12632. try
  12633. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户');
  12634. if ItemIndex >= 0 then
  12635. begin
  12636. Employee := RealICQContacterTreeView.GetEmployee('正在下载用户');
  12637. ParentNode := Employee.Node.Parent;
  12638. TmpBranch := TRealICQBranch(ParentNode.Data);
  12639. //BranchInfo:=MainForm.RealICQClient.MoreBranchs.Objects[MainForm.RealICQClient.MoreBranchs.IndexOf(TmpBranch.BranchID)] as TRealICQBranchInfo;
  12640. //BranchInfo.IsGetUserList:=True;
  12641. TmpBranch.IsGetUserList := True;
  12642. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12643. end;
  12644. // else if FGetUsersTask.Count > 0 then
  12645. // TmpBranch:=FGetUsersTask.Objects[FGetUsersTask.Count-1] as TRealICQBranch;
  12646. {$region '添加联系人'}
  12647. for iLoop := RealICQClient.MoreUsers.Count - 1 downto 0 do
  12648. begin
  12649. RealICQUser := RealICQClient.MoreUsers.Objects[iLoop] as TRealICQUser;
  12650. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName);
  12651. if ItemIndex >= 0 then
  12652. begin
  12653. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  12654. UpdateEmployeeNode(Employee, RealICQUser, False);
  12655. Continue;
  12656. end;
  12657. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(RealICQUser.BranchID);
  12658. if ItemIndex < 0 then
  12659. Continue;
  12660. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12661. Employee.BranchID := RealICQUser.BranchID;
  12662. Employee.HasAddFreindButton := True;
  12663. Employee.HasEmail := False;
  12664. if not TConditionConfig.GetConfig.UserInfoController then
  12665. Employee.SeeInfoPermissions := $00
  12666. else
  12667. Employee.SeeInfoPermissions := RealICQUser.SeeInfoPermissions;
  12668. RealICQContacterTreeView.AddEmployee(Employee);
  12669. UpdateEmployeeNode(Employee, RealICQUser, False);
  12670. ParentNode := Employee.Node.Parent;
  12671. while ParentNode <> nil do
  12672. begin
  12673. TmpBranch := ParentNode.Data;
  12674. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount - 1;
  12675. if (Employee.LoginState <> stOffline) and (Employee.LoginState <> stHidden) then
  12676. TmpBranch.OnlineEmployee := TmpBranch.OnlineEmployee - 1;
  12677. ParentNode := ParentNode.Parent;
  12678. end;
  12679. if Assigned(Employee.Node.Parent) then
  12680. begin
  12681. UpdateEmployeeNode(Employee, RealICQUser, False);
  12682. if (not Assigned(Employee.Node.Parent.Parent)) and (Employee.LoginState <> stOffline) and (Employee.LoginState <> stHidden) then
  12683. begin
  12684. TmpBranch := Employee.Node.Parent.data;
  12685. TmpBranch.OnlineEmployee := TmpBranch.OnlineEmployee - 1;
  12686. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount - 1;
  12687. TmpBranch.Update;
  12688. end;
  12689. end
  12690. else
  12691. FreeAndNil(Employee);
  12692. end;
  12693. {$endregion}
  12694. {$region '添加部门'}
  12695. for iLoop := RealICQClient.MoreBranchs2.Count - 1 downto 0 do
  12696. begin
  12697. BranchInfo := RealICQClient.MoreBranchs2.Objects[iLoop] as TRealICQBranchInfo;
  12698. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12699. begin
  12700. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12701. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12702. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12703. Branch.Update;
  12704. Continue;
  12705. end;
  12706. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12707. Branch.BranchID := BranchInfo.ID;
  12708. Branch.ParentID := BranchInfo.ParentID;
  12709. if Branch.ParentID = '0' then
  12710. begin
  12711. TopBranch := Branch;
  12712. //EmployeeCount:=EmployeeCount-BranchInfo.EmployeeCount;
  12713. if BranchInfo.EmployeeCount > 0 then
  12714. begin
  12715. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12716. end;
  12717. end;
  12718. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12719. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12720. //if Branch.BranchID<>TmpBranch.BranchID then continue;
  12721. RealICQContacterTreeView.AddBranch(Branch);
  12722. Application.ProcessMessages;
  12723. end;
  12724. {$endregion}
  12725. if TmpBranch <> nil then
  12726. begin
  12727. TmpBranch.Node.Expanded := True;
  12728. TmpBranch.IsGetUserList := True;
  12729. // ItemIndex := FGetUsersTask.IndexOf(TmpBranch.BranchID);
  12730. // if ItemIndex >= 0 then FGetUsersTask.Delete(ItemIndex);
  12731. // if FGetUsersTask.Count > 0 then GetBranchUser(FGetUsersTask.Objects[0] as TRealICQBranch);
  12732. end;
  12733. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12734. finally
  12735. RealICQContacterTreeView.EndUpdate;
  12736. tsContacters.EnableAlign;
  12737. end;
  12738. end;
  12739. procedure TMainForm.RealICQClientGettedPermission(Sender: TObject);
  12740. begin
  12741. //
  12742. spbNetworkBackup.Visible := RealICQClient.UserPermission.EnableBackup;
  12743. end;
  12744. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteBeControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12745. var
  12746. TalkingForm: TTalkingForm;
  12747. begin
  12748. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12749. if TalkingForm = nil then
  12750. Exit;
  12751. if TalkingForm.CanWriteMessage then
  12752. TalkingForm.ShowGettedRemoteControlTransmiteControlBeControlResponse(AAcceptted);
  12753. end;
  12754. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteConnectted(Sender: TObject; ALoginName: string);
  12755. var
  12756. TalkingForm: TTalkingForm;
  12757. begin
  12758. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12759. if TalkingForm = nil then
  12760. Exit;
  12761. if TalkingForm.CanWriteMessage then
  12762. TalkingForm.ShowGettedRemoteControlTransmiteConnectted;
  12763. end;
  12764. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  12765. var
  12766. TalkingForm: TTalkingForm;
  12767. begin
  12768. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12769. if TalkingForm = nil then
  12770. Exit;
  12771. if TalkingForm.CanWriteMessage then
  12772. TalkingForm.ShowGettedRemoteControlTransmiteControlRequest;
  12773. end;
  12774. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12775. var
  12776. TalkingForm: TTalkingForm;
  12777. begin
  12778. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12779. if TalkingForm = nil then
  12780. Exit;
  12781. if TalkingForm.CanWriteMessage then
  12782. TalkingForm.ShowGettedRemoteControlTransmiteControlControlResponse(AAcceptted);
  12783. end;
  12784. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  12785. var
  12786. AShowActive: Boolean;
  12787. TalkingForm: TTalkingForm;
  12788. iWaitTimes: Integer;
  12789. begin
  12790. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  12791. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12792. if TalkingForm = nil then
  12793. begin
  12794. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  12795. end;
  12796. iWaitTimes := 0;
  12797. while not TalkingForm.CanWriteMessage do
  12798. begin
  12799. Application.ProcessMessages;
  12800. Inc(iWaitTimes);
  12801. if iWaitTimes > 1000 then
  12802. break;
  12803. Sleep(10);
  12804. end;
  12805. if (GetForegroundWindow <> TalkingForm.Handle) then
  12806. begin
  12807. FlashWindow(TalkingForm.Handle, True);
  12808. if PlaySoundOnGetMessage then
  12809. PlayEventSound(FMessageEventSound);
  12810. end;
  12811. TalkingForm.ShowGettedRemoteControlTransmiteRequest;
  12812. end;
  12813. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12814. var
  12815. TalkingForm: TTalkingForm;
  12816. begin
  12817. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12818. if TalkingForm = nil then
  12819. Exit;
  12820. if TalkingForm.CanWriteMessage then
  12821. TalkingForm.ShowGettedRemoteControlTransmiteResponse(AAcceptted);
  12822. end;
  12823. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenImage(Sender: TObject; ALoginName: string; ALeft, ATop, AWidth, AHeight: Integer; AP: TPoint; ABitmap: TBitmap);
  12824. begin
  12825. if RemoteControlForm = nil then
  12826. Exit;
  12827. RemoteControlForm.imgRCScreen.Picture.Bitmap.Canvas.CopyRect(Rect(ALeft, ATop, ALeft + AWidth, ATop + AHeight), ABitmap.canvas, Rect(0, 0, ABitmap.width, ABitmap.height)); //拷贝
  12828. end;
  12829. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenSize(Sender: TObject; ALoginName: string; AWidth, AHeight: Integer);
  12830. var
  12831. TalkingForm: TTalkingForm;
  12832. begin
  12833. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12834. if TalkingForm = nil then
  12835. Exit;
  12836. TalkingForm.ShowGettedRemoteControlTransmiteRecvedScreenSize(AWidth, AHeight);
  12837. end;
  12838. //------------------------------------------------------------------------------
  12839. procedure TMainForm.CheckCacheDir;
  12840. var
  12841. DSearchRec: TSearchRec;
  12842. FindResult: Integer;
  12843. begin
  12844. FindResult := FindFirst(CacheDir + '*' + CacheFileExt, faAnyFile, DSearchRec);
  12845. while FindResult = 0 do
  12846. begin
  12847. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  12848. begin
  12849. try
  12850. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  12851. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12852. except
  12853. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  12854. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12855. end;
  12856. end;
  12857. FindResult := FindNext(DSearchRec);
  12858. end;
  12859. FindResult := FindFirst(CacheDir + '*' + CacheResumeSizeFileExt, faAnyFile, DSearchRec);
  12860. while FindResult = 0 do
  12861. begin
  12862. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  12863. begin
  12864. try
  12865. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  12866. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12867. except
  12868. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  12869. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12870. end;
  12871. end;
  12872. FindResult := FindNext(DSearchRec);
  12873. end;
  12874. if GetDirectorySize(CacheDir) > MaxCacheDirSize * 1024 * 1024 then
  12875. begin
  12876. if MessageBox(Handle, PChar('Cache目录的大小已经超过 ' + IntToStr(MaxCacheDirSize) + 'MB,是否打开Cache目录进行管理?'), '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_OK then
  12877. WinExec(PChar('explorer "' + CacheDir + '"'), SW_SHOWNORMAL);
  12878. end;
  12879. end;
  12880. //------------------------------------------------------------------------------
  12881. procedure TMainForm.ShowWebTabs;
  12882. var
  12883. iLoop: Integer;
  12884. TabSheet: TTabSheet;
  12885. Bitmap: TBitmap;
  12886. WebPanel: TWebPanel;
  12887. EUser, EPass: string;
  12888. begin
  12889. //先删除
  12890. try
  12891. for iLoop := 0 to FWebTabs.Count - 1 do
  12892. begin
  12893. TabSheet := FWebTabs[iLoop];
  12894. TabSheet.OnShow := nil;
  12895. TabSheet.PageControl := nil;
  12896. FreeAndNil(TabSheet);
  12897. end;
  12898. except
  12899. end;
  12900. FWebTabs.Clear;
  12901. //显示
  12902. pgcMainWorkArea.DisableAlign;
  12903. try
  12904. for iLoop := 0 to FWebPanels.Count - 1 do
  12905. begin
  12906. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12907. if (not WebPanel.Show) and (not WebPanel.MustShow) then
  12908. Continue;
  12909. if ((AnsiPos('邮件', WebPanel.FName) > 0) or (AnsiPos('邮箱', WebPanel.FName) > 0) or (AnsiPos('信箱', WebPanel.FName) > 0)) and (WebPanel.MustShow) then
  12910. begin
  12911. if WebPanel.UserIMLoginName then
  12912. EUser := RealICQClient.LoginName
  12913. else
  12914. EUser := WebPanel.CustomLoginName;
  12915. if WebPanel.UserIMPassword then
  12916. EPass := RealICQClient.Password
  12917. else
  12918. EPass := WebPanel.CustomPassword;
  12919. //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]));
  12920. end;
  12921. TabSheet := TTabSheet.Create(pgcMainWorkArea);
  12922. TabSheet.Parent := pgcMainWorkArea;
  12923. TabSheet.DoubleBuffered := True;
  12924. TabSheet.Caption := WebPanel.Name;
  12925. TabSheet.ShowHint := False;
  12926. if FileExists(WebPanel.Image) then
  12927. begin
  12928. Bitmap := GetSamllBitmap(WebPanel.Image, 32, 32, False);
  12929. try
  12930. try
  12931. Bitmap.LoadFromFile(WebPanel.Image);
  12932. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  12933. ImgLstPageControl.Add(Bitmap, nil);
  12934. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  12935. except
  12936. //
  12937. end;
  12938. finally
  12939. FreeAndNil(Bitmap);
  12940. end;
  12941. end
  12942. else
  12943. TabSheet.ImageIndex := 2; //?号图标
  12944. TabSheet.OnShow := WebTabShow;
  12945. TabSheet.Tag := iLoop;
  12946. TabSheet.PageControl := pgcMainWorkArea;
  12947. FWebTabs.Add(TabSheet);
  12948. end;
  12949. finally
  12950. pgcMainWorkArea.EnableAlign;
  12951. end;
  12952. end;
  12953. //------------------------------------------------------------------------------
  12954. procedure TMainForm.RealICQClientGetWebTabs(Sender: TObject; ATabCount: Integer; WebTabRecords: array of TWebTabRecord);
  12955. var
  12956. iLoop, jLoop: Integer;
  12957. WebTabRecord: TWebTabRecord;
  12958. WebPanel: TWebPanel;
  12959. FFinded: Boolean;
  12960. AWebPanels: TStringList;
  12961. begin
  12962. LoadWebPanelsFromXML;
  12963. AWebPanels := TStringList.Create;
  12964. for iLoop := 0 to FWebPanels.Count - 1 do
  12965. begin
  12966. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12967. AWebPanels.AddObject(WebPanel.ID, WebPanel);
  12968. end;
  12969. FWebPanels.Clear;
  12970. for iLoop := Low(WebTabRecords) to High(WebTabRecords) do
  12971. begin
  12972. WebTabRecord := WebTabRecords[iLoop];
  12973. if AWebPanels.IndexOf(WebTabRecord.ID) < 0 then
  12974. begin
  12975. WebPanel := TWebPanel.Create;
  12976. //FWebPanels.AddObject(WebTabRecord.Name, WebPanel);
  12977. WebPanel.FUserIMLoginName := True;
  12978. WebPanel.FUserIMPassword := True;
  12979. WebPanel.FCustomLoginName := '';
  12980. WebPanel.FCustomPassword := '';
  12981. WebPanel.FShow := False;
  12982. end
  12983. else
  12984. begin
  12985. WebPanel := AWebPanels.Objects[AWebPanels.IndexOf(WebTabRecord.ID)] as TWebPanel;
  12986. end;
  12987. WebPanel.MustShow := WebTabRecord.MustShow;
  12988. if WebPanel.MustShow then
  12989. WebPanel.FShow := True;
  12990. WebPanel.FID := WebTabRecord.ID;
  12991. WebPanel.FName := WebTabRecord.Name;
  12992. WebPanel.FURL := WebTabRecord.URL;
  12993. WebPanel.FImage := WebTabRecord.IconFile;
  12994. WebPanel.Content := WebTabRecord.Content;
  12995. if AnsiSameText(WebTabRecord.Method, 'GET') then
  12996. WebPanel.FNavigateType := ntGET
  12997. else if AnsiSameText(WebTabRecord.Method, 'POST') then
  12998. WebPanel.FNavigateType := ntPOST
  12999. else
  13000. WebPanel.FNavigateType := ntFill;
  13001. WebPanel.FPostFields := WebTabRecord.PostFields;
  13002. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  13003. end;
  13004. {for iLoop := FWebPanels.Count - 1 downto 0 do
  13005. begin
  13006. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  13007. //if WebPanel.MustShow then
  13008. begin
  13009. FFinded := False;
  13010. for jLoop := Low(WebTabRecords) to High(WebTabRecords) do
  13011. begin
  13012. WebTabRecord := WebTabRecords[jLoop];
  13013. if AnsiSameStr(WebTabRecord.ID, WebPanel.ID) then
  13014. begin
  13015. FFinded := True;
  13016. Break;
  13017. end;
  13018. end;
  13019. if not FFinded then
  13020. begin
  13021. FreeAndNil(WebPanel);
  13022. FWebPanels.Delete(iLoop);
  13023. end;
  13024. end;
  13025. end; }
  13026. SaveWebPanelsToXML;
  13027. DisplayWebs := False;
  13028. ShowWebTabs;
  13029. DisplayWebs := True;
  13030. end;
  13031. //------------------------------------------------------------------------------
  13032. procedure TMainForm.RealICQClientInputting(Sender: TObject; ALoginName: string; AInputting: Boolean);
  13033. var
  13034. TalkingForm: TTalkingForm;
  13035. begin
  13036. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  13037. if TalkingForm = nil then
  13038. Exit;
  13039. TalkingForm.ShowInputting(AInputting);
  13040. end;
  13041. //------------------------------------------------------------------------------
  13042. procedure TMainForm.RealICQClientJoinedTeam(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13043. var
  13044. AlertMessage: string;
  13045. RealICQUser: TRealICQUser;
  13046. begin
  13047. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13048. if RealICQUser.DisplayName = '' then
  13049. AlertMessage := RealICQUser.LoginName
  13050. else
  13051. AlertMessage := RealICQUser.DisplayName;
  13052. if ARealICQTeam.IsTempTeam then
  13053. AlertMessage := AlertMessage + ' 将您添加进了 临时多人会话'
  13054. else
  13055. AlertMessage := AlertMessage + ' 将您添加进了群组: ' + ARealICQTeam.TeamCaption;
  13056. ShowNotifyAlertForm(AlertMessage);
  13057. AddMessageHistory(smSimple, AlertMessage, nil);
  13058. UpdateTeamTalkingForm(ARealICQTeam);
  13059. end;
  13060. //------------------------------------------------------------------------------
  13061. procedure TMainForm.RealICQClientJoinTeamRequest(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName, ATag: string);
  13062. begin
  13063. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ARealICQTeam.TeamCaption, ARealICQTeam.TeamID]), nil);
  13064. ShowJoinTeamRequestWindow(Self, ARealICQTeam.TeamID, ARealICQTeam.TeamCaption, ALoginName, ATag);
  13065. end;
  13066. //------------------------------------------------------------------------------
  13067. procedure TMainForm.RealICQClientJoinTeamResponse(Sender: TObject; ATeamID: string; ALoginName: string; ATag: string; AAcceptted: Boolean);
  13068. var
  13069. ATeam: TRealICQTeam;
  13070. begin
  13071. ATeam := TTeamsAdapter.GetTeam(ATeamID);
  13072. if ATeam = nil then
  13073. Exit;
  13074. if AAcceptted then
  13075. begin
  13076. AddMessageHistory(smSimple, ALoginName + ' 接受了您加入群组 ' + ATeam.TeamCaption + ' 的请求', nil);
  13077. ShowNotifyAlertForm(ALoginName + ' 接受您加入群组 ' + ATeam.TeamCaption + ' 的请求');
  13078. end
  13079. else
  13080. begin
  13081. if Length(ATag) = 0 then
  13082. ATag := '无';
  13083. AddMessageHistory(smSimple, ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption, nil);
  13084. ShowNotifyAlertForm(ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption + #$D#$A + '附言 :' + ATag);
  13085. end;
  13086. end;
  13087. //------------------------------------------------------------------------------
  13088. procedure TMainForm.RealICQClientTeamDisbanded(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13089. var
  13090. iIndex: Integer;
  13091. AlertMessage: string;
  13092. RealICQUser: TRealICQUser;
  13093. begin
  13094. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13095. if iIndex >= 0 then
  13096. begin
  13097. FLVTeams.Items.Delete(iIndex);
  13098. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13099. if RealICQUser = RealICQClient.Me then
  13100. AlertMessage := '您'
  13101. else if RealICQUser.DisplayName = '' then
  13102. AlertMessage := RealICQUser.LoginName
  13103. else
  13104. AlertMessage := RealICQUser.DisplayName;
  13105. if ARealICQTeam.IsTempTeam then
  13106. AlertMessage := AlertMessage + ' 解散了 多人对话'
  13107. else
  13108. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  13109. ShowNotifyAlertForm(AlertMessage);
  13110. AddMessageHistory(smSimple, AlertMessage, nil);
  13111. ShowNavBarNumeric;
  13112. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13113. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13114. UpdateTeamTalkingForm(ARealICQTeam);
  13115. end;
  13116. end;
  13117. procedure TMainForm.RealICQClientTeamQuitted(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName: string);
  13118. var
  13119. iIndex: Integer;
  13120. AlertMessage: string;
  13121. begin
  13122. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13123. if iIndex >= 0 then
  13124. begin
  13125. FLVTeams.Items.Delete(iIndex);
  13126. if ARealICQTeam.IsTempTeam then
  13127. AlertMessage := '您 退出了 多人对话'
  13128. else
  13129. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  13130. ShowNotifyAlertForm(AlertMessage);
  13131. AddMessageHistory(smSimple, AlertMessage, nil);
  13132. ShowNavBarNumeric;
  13133. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13134. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13135. UpdateTeamTalkingForm(ARealICQTeam);
  13136. end;
  13137. end;
  13138. //------------------------------------------------------------------------------
  13139. procedure TMainForm.SetFlashCaptionOnOnlineValue(Value: Boolean);
  13140. var
  13141. iLoop: Integer;
  13142. GroupName: string;
  13143. RealICQContacterListView: TRealICQContacterListView;
  13144. RealICQContacterTreeView: TRealICQContacterTreeView;
  13145. begin
  13146. for iLoop := 0 to FContacterListViews.Count - 1 do
  13147. begin
  13148. GroupName := FContacterListViews[iLoop];
  13149. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  13150. RealICQContacterListView.FlashCaptionOnOnline := Value and (GroupName <> LVStrangers) and (GroupName <> LVBlacklists) and (GroupName <> LVLatests);
  13151. end;
  13152. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  13153. begin
  13154. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  13155. RealICQContacterTreeView.FlashCaptionOnOnline := Value;
  13156. RealICQContacterTreeView.ReDrawAll;
  13157. end;
  13158. end;
  13159. //------------------------------------------------------------------------------
  13160. procedure TMainForm.RealICQClientUserExInformationChanged(Sender: TObject; RealICQUser: TRealICQUser);
  13161. begin
  13162. if (OptionsForm <> nil) and (RealICQUser = RealICQClient.Me) then
  13163. begin
  13164. OptionsForm.GetSets;
  13165. end;
  13166. // UpdateSeeInformationForm(RealICQUser);
  13167. UpdateTalkingForm(RealICQUser);
  13168. UpdateSMSForm(RealICQUser);
  13169. end;
  13170. //------------------------------------------------------------------------------
  13171. procedure TMainForm.RealICQClientUserInformationReady(Sender: TObject; RealICQUser: TRealICQUser);
  13172. var
  13173. ItemIndex: Integer;
  13174. RealICQContacterListItem: TRealICQContacterListItem;
  13175. RealICQContacterListView: TRealICQContacterListView;
  13176. RealICQFriendTreeView: TRealICQContacterTreeView;
  13177. RealICQContacterTreeView: TRealICQContacterTreeView;
  13178. Employee: TRealICQEmployee;
  13179. Friend: TRealICQEmployee;
  13180. iIndex, iLoop, jLoop: Integer;
  13181. GroupName: string;
  13182. GroupMembers: TStringList;
  13183. begin
  13184. if UserCardForm <> nil then
  13185. begin
  13186. if AnsiSameText(UserCardForm.LoginName, RealICQUser.LoginName) then
  13187. UserCardForm.LoginName := RealICQUser.LoginName;
  13188. end;
  13189. {$region '如果正处于过滤用户的状态,则同时也更新FSearchListView中的数据'}
  13190. if FSearchListViewInVisible then
  13191. begin
  13192. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  13193. if ItemIndex >= 0 then
  13194. begin
  13195. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13196. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13197. end;
  13198. end;
  13199. {$endregion}
  13200. {$region '更新“最近联系人列表”中的数据'}
  13201. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  13202. if ItemIndex >= 0 then
  13203. begin
  13204. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13205. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13206. end;
  13207. {$endregion}
  13208. if TUsersService.GetUsersService.IsWorkmateOrFriend(RealICQUser.LoginName) then
  13209. begin
  13210. {$region 'wmCorporation工作模式或采用了树型方式组织好友列表'}
  13211. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  13212. ShowMeInformation;
  13213. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  13214. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13215. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13216. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13217. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13218. if Employee <> nil then
  13219. begin
  13220. UpdateEmployeeNode(Employee, RealICQUser, True);
  13221. end;
  13222. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  13223. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13224. Friend := RealICQFriendTreeView.GetEmployee(RealICQUser.LoginName);
  13225. if Friend <> nil then
  13226. begin
  13227. UpdateFriendNode(Friend, RealICQUser, True);
  13228. end;
  13229. if RealICQClient.WorkingMode = wmCorporation then
  13230. begin
  13231. {$region '更新自定义组中的信息'}
  13232. for iLoop := 0 to FGroups.Count - 1 do
  13233. begin
  13234. GroupName := FGroups[iLoop];
  13235. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  13236. for jLoop := 0 to GroupMembers.Count - 1 do
  13237. begin
  13238. if AnsiSameText(GroupMembers[jLoop], RealICQClient.LoginName) then
  13239. begin
  13240. iIndex := FContacterListViews.IndexOf(GroupName);
  13241. if iIndex >= 0 then
  13242. begin
  13243. RealICQContacterListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  13244. if RealICQContacterListView.Items.IndexOf(RealICQClient.LoginName) = -1 then
  13245. RealICQContacterListView.Items.Add(RealICQClient.LoginName);
  13246. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  13247. if ItemIndex >= 0 then
  13248. begin
  13249. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13250. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13251. end;
  13252. end; //if
  13253. end; //if
  13254. end; //for jLoop
  13255. end; //for iLoop
  13256. {$endregion}
  13257. end;
  13258. {$endregion}
  13259. end;
  13260. if RealICQClient.MoreUsers.IndexOf(RealICQUser.LoginName) >= 0 then
  13261. begin
  13262. {$region '更新“全市”中的数据'}
  13263. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  13264. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13265. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13266. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13267. RealICQContacterTreeView.OnItemOnline := nil;
  13268. RealICQContacterTreeView.OnItemOffline := nil;
  13269. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  13270. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13271. if Employee <> nil then
  13272. begin
  13273. UpdateEmployeeNode(Employee, RealICQUser, True);
  13274. end;
  13275. {$endregion}
  13276. end;
  13277. // UpdateSeeInformationForm(RealICQUser);
  13278. UpdateTalkingForm(RealICQUser);
  13279. UpdateSMSForm(RealICQUser);
  13280. UpdateMemberInfoOfTeamOptionsForm(RealICQUser);
  13281. UpdateAddrBookInfo(RealICQUser);
  13282. end;
  13283. procedure TMainForm.UpdateAddrBookInfo(RealICQUser: TRealICQUser);
  13284. var
  13285. iLoop, ItemIndex: Integer;
  13286. Employee: TRealICQEmployee;
  13287. TmpRealICQUser: TRealICQUser;
  13288. RealICQContacterTreeView: TRealICQContacterTreeView;
  13289. begin
  13290. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  13291. if ItemIndex < 0 then
  13292. Exit;
  13293. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13294. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13295. if (Employee <> nil) then
  13296. begin
  13297. Employee.Mobile := RealICQUser.Mobile;
  13298. Employee.SMSHint := RealICQUser.Mobile;
  13299. Employee.Tel := RealICQUser.Tel;
  13300. Employee.Update;
  13301. end
  13302. else
  13303. Exit;
  13304. ItemIndex := MainForm.RealICQClient.AddrBookUsers.IndexOf(RealICQUser.LoginName);
  13305. if ItemIndex < 0 then
  13306. Exit;
  13307. TmpRealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[ItemIndex] as TRealICQUser;
  13308. TmpRealICQUser.Mobile := RealICQUser.Mobile;
  13309. TmpRealICQUser.Tel := RealICQUser.Tel;
  13310. end;
  13311. //------------------------------------------------------------------------------
  13312. procedure TMainForm.ShowNetWorkDiskSpaceInfo;
  13313. begin
  13314. lblNDSpaceSize.Caption := Format('%0fM/%dM', [RealICQNetWorkDiskClient.UsedSpaceSize / (1024 * 1024), RealICQNetWorkDiskClient.MaxSpaceSize div (1024 * 1024)]);
  13315. end;
  13316. //------------------------------------------------------------------------------
  13317. procedure TMainForm.RealICQNetWorkDiskClientConnectStateChanged(Sender: TObject);
  13318. begin
  13319. if tsNetWorkDisk.Parent = nil then
  13320. Exit;
  13321. try
  13322. FConfirmReplaceResult := -1;
  13323. if RealICQNetWorkDiskClient.Connectting then
  13324. begin
  13325. lblNDState.Caption := '正在连接...';
  13326. lblNDSpaceSize.Caption := '';
  13327. end
  13328. else if RealICQNetWorkDiskClient.Connected then
  13329. begin
  13330. lblNDState.Caption := '已连接';
  13331. ShowNetWorkDiskSpaceInfo;
  13332. end
  13333. else
  13334. begin
  13335. lblNDState.Caption := '连接已断开';
  13336. lblNDSpaceSize.Caption := '';
  13337. try
  13338. if FLVNetWorkDisk <> nil then
  13339. begin
  13340. FLVNetWorkDisk.Items.Clear;
  13341. FLVNetWorkDisk.ReDrawAll;
  13342. end;
  13343. except
  13344. end;
  13345. try
  13346. spbNDCancelAllClick(spbNDCancelAll);
  13347. except
  13348. end;
  13349. end;
  13350. spbNDMoveUp.Enabled := RealICQNetWorkDiskClient.Connected;
  13351. spbNDRefresh.Enabled := spbNDMoveUp.Enabled;
  13352. spbNDNewDir.Enabled := spbNDMoveUp.Enabled;
  13353. spbNDDelete.Enabled := spbNDMoveUp.Enabled;
  13354. shpNDDirBorder.Enabled := spbNDMoveUp.Enabled;
  13355. edNDDir.Enabled := spbNDMoveUp.Enabled;
  13356. spbNDUpload.Enabled := spbNDMoveUp.Enabled;
  13357. spbNDDownload.Enabled := spbNDMoveUp.Enabled;
  13358. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13359. spbNDConnect.Enabled := (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) and (RealICQClient.Connected);
  13360. spbNDDisconnect.Enabled := not spbNDConnect.Enabled and not RealICQNetWorkDiskClient.Connectting;
  13361. if not edNDDir.Enabled then
  13362. edNDDir.Text := '';
  13363. except
  13364. end;
  13365. end;
  13366. //------------------------------------------------------------------------------
  13367. procedure TMainForm.ItemShowHint(Sender: TObject; Item: TRealICQContacterListItem; var HintStr: string);
  13368. var
  13369. AFile: TRealICQNetWorkDiskFile;
  13370. ADirectory: TRealICQNetWorkDiskDirectory;
  13371. AUploadMission: TUploadMission;
  13372. ADownloadMission: TDownloadMission;
  13373. begin
  13374. if Item = nil then
  13375. Exit;
  13376. if Sender = FLVNetWorkDisk then
  13377. begin
  13378. if Copy(Item.LoginName, 1, 1) = 'D' then
  13379. begin
  13380. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  13381. HintStr := '目录名称: ' + Trim(ADirectory.Name) + #$D#$A;
  13382. HintStr := HintStr + '创建时间: ' + DateTimeToStr(ADirectory.CreateDate);
  13383. end
  13384. else if Copy(Item.LoginName, 1, 1) = 'F' then
  13385. begin
  13386. AFile := TRealICQNetWorkDiskFile(Item.Data);
  13387. HintStr := '文件名称: ' + Trim(AFile.Name) + #$D#$A;
  13388. HintStr := HintStr + '创建时间: ' + Trim(DateTimeToStr(AFile.CreateDate)) + #$D#$A;
  13389. HintStr := HintStr + '修改时间: ' + Trim(DateTimeToStr(AFile.ModifyDate)) + #$D#$A;
  13390. HintStr := HintStr + '大小: ' + Trim(Item.Watchword);
  13391. end;
  13392. end;
  13393. if Sender = FLVNetWorkDiskUploadingFiles then
  13394. begin
  13395. if AnsiSameText(HintStr, '取消') then
  13396. Exit;
  13397. AUploadMission := TUploadMission(Item.Data);
  13398. HintStr := AUploadMission.Name;
  13399. end;
  13400. if Sender = FLVNetWorkDiskDownloadingFiles then
  13401. begin
  13402. if AnsiSameText(HintStr, '取消') then
  13403. Exit;
  13404. ADownloadMission := TDownloadMission(Item.Data);
  13405. if ADownloadMission.FDownloadMissionType = mtDir then
  13406. HintStr := ADownloadMission.DirectoryName
  13407. else
  13408. HintStr := ADownloadMission.FileName;
  13409. end;
  13410. end;
  13411. procedure TMainForm.LblHintClick(Sender: TObject);
  13412. var
  13413. FAutoSaveMessage: Boolean;
  13414. begin
  13415. FAutoSaveMessage := AutoSaveMessage;
  13416. AutoSaveMessage := False;
  13417. try
  13418. RealICQClientReceivedSystemMessage(RealICQClient, FTopSystemMessage);
  13419. finally
  13420. btCloseTopMessageClick(nil);
  13421. AutoSaveMessage := FAutoSaveMessage;
  13422. end;
  13423. end;
  13424. //------------------------------------------------------------------------------
  13425. procedure TMainForm.NDSelectItemChanged(Item: TRealICQContacterListItem);
  13426. begin
  13427. if not pnlNDMissions.Visible then
  13428. begin
  13429. spbNDDelete.Enabled := (FLVNetWorkDisk <> nil) and (FLVNetWorkDisk.SelCount > 0);
  13430. spbNDDownload.Enabled := spbNDDelete.Enabled;
  13431. end;
  13432. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13433. end;
  13434. //------------------------------------------------------------------------------
  13435. procedure TMainForm.NDItemMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  13436. begin
  13437. end;
  13438. //------------------------------------------------------------------------------
  13439. procedure TMainForm.NDMissionItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  13440. var
  13441. UploadMission: TUploadMission;
  13442. DownloadMission: TDownloadMission;
  13443. AMissionID: string;
  13444. begin
  13445. if Sender = FLVNetWorkDiskUploadingFiles then
  13446. begin
  13447. try
  13448. if not Assigned(Item) then
  13449. Exit;
  13450. UploadMission := TUploadMission(Item.Data);
  13451. if not Assigned(UploadMission) then
  13452. Exit;
  13453. AMissionID := UploadMission.FID;
  13454. try
  13455. FLVNetWorkDiskUploadingFiles.Items.Delete(Item.ItemIndex);
  13456. FreeAndNil(UploadMission);
  13457. except
  13458. end;
  13459. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  13460. finally
  13461. CheckUploadMissions
  13462. end;
  13463. end;
  13464. if Sender = FLVNetWorkDiskDownloadingFiles then
  13465. begin
  13466. try
  13467. if not Assigned(Item) then
  13468. Exit;
  13469. FLVNetWorkDiskDownloadingFiles.Items.Delete(Item.ItemIndex);
  13470. DownloadMission := TDownloadMission(Item.Data);
  13471. FreeAndNil(DownloadMission);
  13472. RealICQNetWorkDiskClient.StopDownloader;
  13473. finally
  13474. CheckDownloadMissions
  13475. end;
  13476. end;
  13477. end;
  13478. //------------------------------------------------------------------------------
  13479. procedure TMainForm.NDMissionDropFiles(Sender: TObject; var Message: TMessage);
  13480. var
  13481. i: Integer;
  13482. p: array[0..1023] of Char;
  13483. AName: string;
  13484. begin
  13485. try
  13486. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  13487. begin
  13488. MessageBox(Handle, '抱歉,系统正忙!', '提示', MB_ICONINFORMATION);
  13489. Exit;
  13490. end;
  13491. i := DragQueryFile(Message.wParam, $FFFFFFFF, nil, 0);
  13492. for i := 0 to i - 1 do
  13493. begin
  13494. DragQueryFile(Message.wParam, i, p, 1024);
  13495. AName := StrPas(p);
  13496. if FileExists(AName) then
  13497. begin
  13498. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13499. end
  13500. else if DirectoryExists(AName) then
  13501. begin
  13502. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13503. end;
  13504. end;
  13505. finally
  13506. CheckUploadMissions;
  13507. DragFinish(Message.wParam);
  13508. Message.Result := 1;
  13509. end;
  13510. end;
  13511. //------------------------------------------------------------------------------
  13512. procedure TMainForm.miNDCancelClick(Sender: TObject);
  13513. var
  13514. ListItem: TRealICQContacterListItem;
  13515. UploadMission: TUploadMission;
  13516. DownloadMission: TDownloadMission;
  13517. iLoop: Integer;
  13518. begin
  13519. if TabSetNDMissions.TabIndex = 0 then
  13520. begin
  13521. for iLoop := FLVNetWorkDiskUploadingFiles.Items.Count - 1 downto 0 do
  13522. begin
  13523. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13524. if ListItem.Selected then
  13525. begin
  13526. UploadMission := TUploadMission(ListItem.Data);
  13527. if ListItem.LoginState = stOnline then
  13528. begin
  13529. if UploadMission.FUploadMissionType = mtFile then
  13530. begin
  13531. RealICQNetWorkDiskClient.CancelUploadingFile(UploadMission.FID);
  13532. Continue;
  13533. end;
  13534. end;
  13535. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13536. FreeAndNil(UploadMission);
  13537. end;
  13538. end;
  13539. CheckUploadMissions;
  13540. end;
  13541. if TabSetNDMissions.TabIndex = 1 then
  13542. begin
  13543. for iLoop := FLVNetWorkDiskDownloadingFiles.Items.Count - 1 downto 0 do
  13544. begin
  13545. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13546. if ListItem.Selected then
  13547. begin
  13548. DownloadMission := TDownloadMission(ListItem.Data);
  13549. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13550. FreeAndNil(DownloadMission);
  13551. if ListItem.LoginState = stOnline then
  13552. begin
  13553. RealICQNetWorkDiskClient.StopDownloader;
  13554. end;
  13555. end;
  13556. end;
  13557. CheckDownloadMissions;
  13558. end;
  13559. end;
  13560. //------------------------------------------------------------------------------
  13561. procedure TMainForm.spbNDMoveUpClick(Sender: TObject);
  13562. begin
  13563. if RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil then
  13564. begin
  13565. lblNDState.Caption := '正在载入...';
  13566. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13567. end;
  13568. end;
  13569. //------------------------------------------------------------------------------
  13570. procedure TMainForm.miNDRenameClick(Sender: TObject);
  13571. var
  13572. DirectoryName, FileName: string;
  13573. AFile: TRealICQNetWorkDiskFile;
  13574. ADirectory: TRealICQNetWorkDiskDirectory;
  13575. ListItem, ListItem1: TRealICQContacterListItem;
  13576. iLoop, jLoop: Integer;
  13577. begin
  13578. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13579. begin
  13580. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13581. if ListItem.Selected then
  13582. begin
  13583. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13584. begin
  13585. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  13586. DirectoryName := Trim(ShowMyInputBox('重命名目录', '请输入新的目录名称', ADirectory.Name, 200));
  13587. if AnsiSameStr(DirectoryName, ADirectory.Name) then
  13588. Exit;
  13589. if Length(DirectoryName) > 0 then
  13590. begin
  13591. 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
  13592. begin
  13593. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13594. Exit;
  13595. end;
  13596. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13597. begin
  13598. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13599. if ListItem1 = ListItem then
  13600. continue;
  13601. if Copy(ListItem1.LoginName, 1, 1) = 'D' then
  13602. begin
  13603. if AnsiSameText(DirectoryName, ListItem1.DisplayName) then
  13604. begin
  13605. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13606. Exit;
  13607. end;
  13608. end;
  13609. end;
  13610. RealICQNetWorkDiskClient.Rename(rtDir, ADirectory.ID, DirectoryName);
  13611. end;
  13612. end
  13613. else if Copy(ListItem.LoginName, 1, 1) = 'F' then
  13614. begin
  13615. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  13616. FileName := Trim(ShowMyInputBox('重命名文件', '请输入新的文件名称', AFile.Name, 200));
  13617. if AnsiSameStr(FileName, AFile.Name) then
  13618. Exit;
  13619. if Length(FileName) > 0 then
  13620. begin
  13621. 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
  13622. begin
  13623. MessageBox(Handle, '文件名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13624. Exit;
  13625. end;
  13626. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13627. begin
  13628. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13629. if ListItem1 = ListItem then
  13630. continue;
  13631. if Copy(ListItem1.LoginName, 1, 1) = 'F' then
  13632. begin
  13633. if AnsiSameText(FileName, ListItem1.DisplayName) then
  13634. begin
  13635. MessageBox(Handle, '指定的文件已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13636. Exit;
  13637. end;
  13638. end;
  13639. end;
  13640. RealICQNetWorkDiskClient.Rename(rtFile, AFile.ID, FileName);
  13641. end;
  13642. end;
  13643. Exit;
  13644. end;
  13645. end;
  13646. end;
  13647. //------------------------------------------------------------------------------
  13648. procedure TMainForm.spbNDNewDirClick(Sender: TObject);
  13649. var
  13650. DirectoryName: string;
  13651. iLoop: Integer;
  13652. ListItem: TRealICQContacterListItem;
  13653. begin
  13654. DirectoryName := Trim(ShowMyInputBox('新建目录', '请输入目录名称', '', 200));
  13655. if Length(DirectoryName) > 0 then
  13656. begin
  13657. 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
  13658. begin
  13659. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13660. Exit;
  13661. end;
  13662. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13663. begin
  13664. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13665. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13666. begin
  13667. if AnsiSameText(DirectoryName, ListItem.DisplayName) then
  13668. begin
  13669. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13670. Exit;
  13671. end;
  13672. end;
  13673. end;
  13674. RealICQNetWorkDiskClient.NewDirectory(DirectoryName);
  13675. end;
  13676. end;
  13677. //------------------------------------------------------------------------------
  13678. procedure TMainForm.spbNDRefreshClick(Sender: TObject);
  13679. begin
  13680. RealICQNetWorkDiskClient.Refresh;
  13681. end;
  13682. //------------------------------------------------------------------------------
  13683. procedure TMainForm.GoNextLevelUploadMissions(UploadMission: TUploadMission);
  13684. var
  13685. iLoop: Integer;
  13686. Missions: TStringList;
  13687. ListItem: TRealICQContacterListItem;
  13688. AUploadMission: TUploadMission;
  13689. DSearchRec: TSearchRec;
  13690. FindResult: Integer;
  13691. begin
  13692. if UploadMission.FUploadMissionType <> mtDir then
  13693. Exit;
  13694. Missions := TStringList.Create;
  13695. for iLoop := 0 to FLVNetWorkDiskUploadingFiles.Items.Count - 1 do
  13696. begin
  13697. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13698. AUploadMission := TUploadMission(ListItem.Data);
  13699. Missions.AddObject(AUploadMission.FID, AUploadMission);
  13700. try
  13701. FUploadMissions.Delete(FUploadMissions.IndexOf(AUploadMission.ID));
  13702. except
  13703. end;
  13704. end;
  13705. FSavedUploadMissions.Add(Missions);
  13706. FLVNetWorkDiskUploadingFiles.Items.Clear;
  13707. FindResult := FindFirst(UploadMission.FName + '\*.*', faDirectory, DSearchRec);
  13708. while FindResult = 0 do
  13709. begin
  13710. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13711. begin
  13712. if DirectoryExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13713. begin
  13714. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13715. end;
  13716. end;
  13717. FindResult := FindNext(DSearchRec);
  13718. end;
  13719. FindResult := FindFirst(UploadMission.FName + '\*.*', faAnyFile - faDirectory, DSearchRec);
  13720. while FindResult = 0 do
  13721. begin
  13722. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13723. begin
  13724. if FileExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13725. begin
  13726. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13727. end;
  13728. end;
  13729. FindResult := FindNext(DSearchRec);
  13730. end;
  13731. CheckUploadMissions;
  13732. end;
  13733. //------------------------------------------------------------------------------
  13734. procedure TMainForm.CheckUploadMissions;
  13735. var
  13736. ListItem: TRealICQContacterListItem;
  13737. UploadMission: TUploadMission;
  13738. Missions: TStringList;
  13739. iLoop: Integer;
  13740. ADirectory: TRealICQNetWorkDiskDirectory;
  13741. AFile: TRealICQNetWorkDiskFile;
  13742. Finded: Boolean;
  13743. MessageBoxResult: Integer;
  13744. ConfirmReplaceNDFileForm: TConfirmReplaceNDFileForm;
  13745. begin
  13746. if FLVNetWorkDiskUploadingFiles.OnlineNumeric = 0 then
  13747. begin
  13748. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  13749. begin
  13750. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  13751. UploadMission := TUploadMission(ListItem.Data);
  13752. if UploadMission.UploadMissionType = mtFile then
  13753. begin
  13754. with ListItem do
  13755. begin
  13756. LoginState := stOnline;
  13757. HasSMS := True;
  13758. Watchword := '';
  13759. SMSHint := '取消';
  13760. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13761. ReDrawItem;
  13762. end;
  13763. for iLoop := RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 downto 0 do
  13764. begin
  13765. AFile := RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop];
  13766. if AnsiSameText(ExtractFileName(AFile.Name), ExtractFileName(UploadMission.Name)) then
  13767. begin
  13768. if FConfirmReplaceResult <> mrYesToAll then
  13769. begin
  13770. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  13771. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(AFile.Name)]);
  13772. try
  13773. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  13774. finally
  13775. FreeAndNil(ConfirmReplaceNDFileForm);
  13776. end;
  13777. end;
  13778. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  13779. begin
  13780. //FreeAndNil(AFile);
  13781. RealICQNetWorkDiskClient.Delete('F' + IntToStr(AFile.ID));
  13782. Sleep(100);
  13783. Application.ProcessMessages;
  13784. Break;
  13785. end
  13786. else if FConfirmReplaceResult = mrNO then
  13787. begin
  13788. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  13789. FreeAndNil(UploadMission);
  13790. CheckUploadMissions;
  13791. Exit;
  13792. end
  13793. else if FConfirmReplaceResult = mrCancel then
  13794. begin
  13795. spbNDCancelAllClick(spbNDCancelAll);
  13796. Exit;
  13797. end;
  13798. end;
  13799. end;
  13800. while True do
  13801. begin
  13802. try
  13803. RealICQNetWorkDiskClient.UploadFile(UploadMission.Name, UploadMission.DirectoryID, UploadMission.ID);
  13804. Break;
  13805. except
  13806. on E: Exception do
  13807. begin
  13808. MessageBoxResult := MessageBox(Handle, PChar('上传文件时出错:'#$D#$A#$D#$A + E.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  13809. if MessageBoxResult = ID_ABORT then
  13810. begin
  13811. spbNDCancelAllClick(spbNDCancelAll);
  13812. Exit;
  13813. end
  13814. else if MessageBoxResult = ID_RETRY then
  13815. begin
  13816. Continue;
  13817. end
  13818. else if MessageBoxResult = ID_IGNORE then
  13819. begin
  13820. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  13821. FreeAndNil(UploadMission);
  13822. CheckUploadMissions;
  13823. Exit;
  13824. end;
  13825. end;
  13826. end; //try
  13827. end; //while
  13828. end
  13829. else
  13830. begin
  13831. with ListItem do
  13832. begin
  13833. LoginState := stOnline;
  13834. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13835. ReDrawItem;
  13836. end;
  13837. Finded := False;
  13838. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  13839. begin
  13840. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop];
  13841. if Length(ExtractFileName(UploadMission.Name)) > 0 then
  13842. begin
  13843. if AnsiSameText(ADirectory.Name, ExtractFileName(UploadMission.Name)) then
  13844. begin
  13845. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  13846. Finded := True;
  13847. end;
  13848. end
  13849. else
  13850. begin
  13851. if AnsiSameText(ADirectory.Name, '[' + Copy(UploadMission.Name, 1, 1) + ']') then
  13852. begin
  13853. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  13854. Finded := True;
  13855. end;
  13856. end;
  13857. end;
  13858. if not Finded then
  13859. begin
  13860. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  13861. RealICQNetWorkDiskClient.NewDirectory('[' + Copy(UploadMission.Name, 1, 1) + ']')
  13862. else
  13863. RealICQNetWorkDiskClient.NewDirectory(ExtractFileName(UploadMission.Name));
  13864. end;
  13865. end;
  13866. end;
  13867. end;
  13868. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  13869. if FLVNetWorkDiskUploadingFiles.Items.Count = 0 then
  13870. begin
  13871. if FSavedUploadMissions.Count > 0 then
  13872. begin
  13873. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  13874. begin
  13875. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  13876. begin
  13877. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13878. Missions := TStringList(FSavedUploadMissions[FSavedUploadMissions.Count - 1]);
  13879. FSavedUploadMissions.Remove(Missions);
  13880. for iLoop := 0 to Missions.Count - 1 do
  13881. begin
  13882. UploadMission := Missions.Objects[iLoop] as TUploadMission;
  13883. AddUploadMission(UploadMission.UploadMissionType, UploadMission.DirectoryID, UploadMission.Name, False);
  13884. FreeAndNil(UploadMission);
  13885. end;
  13886. Missions.Clear;
  13887. FreeAndNil(Missions);
  13888. CheckUploadMissions;
  13889. Exit;
  13890. end;
  13891. end;
  13892. end
  13893. else
  13894. begin
  13895. RealICQNetWorkDiskClient.GetUsedSpaceSize;
  13896. end;
  13897. end;
  13898. CheckNDControlState;
  13899. end;
  13900. //------------------------------------------------------------------------------
  13901. procedure TMainForm.CheckNDControlState;
  13902. begin
  13903. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count = 0) and (FLVNetWorkDiskDownloadingFiles.Items.Count = 0) and (FSavedUploadMissions.Count = 0) and (FSavedDownloadMissions.Count = 0) then
  13904. begin
  13905. pnlNDMissions.Visible := False;
  13906. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13907. end;
  13908. spbNDMoveUp.Enabled := not pnlNDMissions.Visible;
  13909. spbNDNewDir.Enabled := not pnlNDMissions.Visible;
  13910. spbNDDelete.Enabled := not pnlNDMissions.Visible;
  13911. spbNDUpload.Enabled := not pnlNDMissions.Visible;
  13912. spbNDDownload.Enabled := not pnlNDMissions.Visible;
  13913. spbNDRefresh.Enabled := not pnlNDMissions.Visible;
  13914. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13915. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  13916. if not pnlNDMissions.Visible then
  13917. begin
  13918. FConfirmReplaceResult := -1;
  13919. FLastDownloadDirectory := '';
  13920. NDSelectItemChanged(nil);
  13921. end;
  13922. end;
  13923. //------------------------------------------------------------------------------
  13924. procedure TMainForm.AddUploadMission(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string; CheckMission: Boolean = True);
  13925. var
  13926. UploadMission: TUploadMission;
  13927. ItemIndex: Integer;
  13928. ListItem: TRealICQContacterListItem;
  13929. begin
  13930. UploadMission := TUploadMission.Create(AUploadMissionType, ADirectoryID, AName);
  13931. if FUploadMissions.IndexOf(UploadMission.ID) >= 0 then
  13932. begin
  13933. MessageBox(Handle, PChar(AName + ' 已在任务队列中!'), '提示', MB_ICONINFORMATION);
  13934. Exit;
  13935. end;
  13936. FUploadMissions.AddObject(UploadMission.ID, UploadMission);
  13937. if not pnlNDMissions.Visible then
  13938. pnlNDMissions.Visible := True;
  13939. TabSetNDMissions.TabIndex := 0;
  13940. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13941. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  13942. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(UploadMission.ID);
  13943. if ItemIndex >= 0 then
  13944. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  13945. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.Add(UploadMission.ID);
  13946. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13947. with ListItem do
  13948. begin
  13949. LoginState := stOffline;
  13950. Data := UploadMission;
  13951. DisplayName := (UploadMission.Name);
  13952. Watchword := '队列中';
  13953. if UploadMission.UploadMissionType = mtFile then
  13954. begin
  13955. try
  13956. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(UploadMission.Name));
  13957. except
  13958. end;
  13959. end;
  13960. ReDrawItem;
  13961. end;
  13962. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  13963. if CheckMission then
  13964. CheckUploadMissions;
  13965. end;
  13966. //------------------------------------------------------------------------------
  13967. procedure TMainForm.AddDownloadMission(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = ''; CheckMission: Boolean = True);
  13968. var
  13969. DownloadMission: TDownloadMission;
  13970. ItemIndex: Integer;
  13971. ListItem: TRealICQContacterListItem;
  13972. begin
  13973. DownloadMission := TDownloadMission.Create(ADownloadMissionType, ADirectoryName, AFileID, AFileName);
  13974. if not pnlNDMissions.Visible then
  13975. pnlNDMissions.Visible := True;
  13976. TabSetNDMissions.TabIndex := 1;
  13977. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13978. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  13979. ItemIndex := FLVNetWorkDiskDownloadingFiles.Items.Add(DownloadMission.ID);
  13980. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13981. with ListItem do
  13982. begin
  13983. LoginState := stOffline;
  13984. Data := DownloadMission;
  13985. Watchword := '队列中';
  13986. if DownloadMission.DownloadMissionType = mtFile then
  13987. begin
  13988. DisplayName := (DownloadMission.FileName);
  13989. try
  13990. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(DownloadMission.FileName));
  13991. except
  13992. end;
  13993. end
  13994. else
  13995. begin
  13996. DisplayName := (DownloadMission.DirectoryName);
  13997. end;
  13998. ReDrawItem;
  13999. end;
  14000. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  14001. if CheckMission then
  14002. CheckDownloadMissions;
  14003. end;
  14004. //------------------------------------------------------------------------------
  14005. procedure TMainForm.CheckDownloadMissions;
  14006. var
  14007. iLoop, jLoop: Integer;
  14008. ListItem: TRealICQContacterListItem;
  14009. DownloadMission: TDownloadMission;
  14010. ADownloadMission: TDownloadMission;
  14011. ADirectory: TRealICQNetWorkDiskDirectory;
  14012. Missions: TStringList;
  14013. begin
  14014. if FLVNetWorkDiskDownloadingFiles.OnlineNumeric = 0 then
  14015. begin
  14016. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14017. begin
  14018. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14019. DownloadMission := TDownloadMission(ListItem.Data);
  14020. if DownloadMission.DownloadMissionType = mtFile then
  14021. begin
  14022. with ListItem do
  14023. begin
  14024. LoginState := stOnline;
  14025. HasSMS := True;
  14026. Watchword := '';
  14027. SMSHint := '取消';
  14028. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14029. ReDrawItem;
  14030. end;
  14031. if FileExists(DownloadMission.FFileName) then
  14032. begin
  14033. if FConfirmReplaceResult <> mrYesToAll then
  14034. begin
  14035. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  14036. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(DownloadMission.FFileName)]);
  14037. try
  14038. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  14039. finally
  14040. FreeAndNil(ConfirmReplaceNDFileForm);
  14041. end;
  14042. end;
  14043. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  14044. begin
  14045. end
  14046. else if FConfirmReplaceResult = mrNO then
  14047. begin
  14048. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14049. FreeAndNil(DownloadMission);
  14050. CheckDownloadMissions;
  14051. Exit;
  14052. end
  14053. else if FConfirmReplaceResult = mrCancel then
  14054. begin
  14055. spbNDCancelAllClick(spbNDCancelAll);
  14056. Exit;
  14057. end;
  14058. end;
  14059. try
  14060. RealICQNetWorkDiskClient.DownloadFile(DownloadMission.FFileID, DownloadMission.FFileName);
  14061. except
  14062. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14063. FreeAndNil(DownloadMission);
  14064. CheckDownloadMissions;
  14065. Exit;
  14066. end;
  14067. end
  14068. else
  14069. begin
  14070. with ListItem do
  14071. begin
  14072. LoginState := stOnline;
  14073. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14074. ReDrawItem;
  14075. end;
  14076. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14077. begin
  14078. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14079. if AnsiSameText(ExtractFileName(ADirectory.Name), ExtractFileName(DownloadMission.DirectoryName)) then
  14080. begin
  14081. if not DirectoryExists(DownloadMission.DirectoryName) then
  14082. CreateDir(DownloadMission.DirectoryName);
  14083. FLastDownloadDirectory := DownloadMission.DirectoryName;
  14084. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14085. FreeAndNil(DownloadMission);
  14086. Missions := TStringList.Create;
  14087. for jLoop := 0 to FLVNetWorkDiskDownloadingFiles.Items.Count - 1 do
  14088. begin
  14089. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[jLoop] as TRealICQContacterListItem;
  14090. ADownloadMission := TDownloadMission(ListItem.Data);
  14091. Missions.AddObject(ADownloadMission.FID, ADownloadMission);
  14092. end;
  14093. FSavedDownloadMissions.Add(Missions);
  14094. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  14095. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14096. Exit;
  14097. end;
  14098. end;
  14099. end;
  14100. end;
  14101. end;
  14102. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  14103. if FLVNetWorkDiskDownloadingFiles.Items.Count = 0 then
  14104. begin
  14105. if FSavedDownloadMissions.Count > 0 then
  14106. begin
  14107. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  14108. begin
  14109. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  14110. begin
  14111. FLastDownloadDirectory := '';
  14112. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  14113. Missions := TStringList(FSavedDownloadMissions[FSavedDownloadMissions.Count - 1]);
  14114. FSavedDownloadMissions.Remove(Missions);
  14115. for iLoop := 0 to Missions.Count - 1 do
  14116. begin
  14117. DownloadMission := Missions.Objects[iLoop] as TDownloadMission;
  14118. AddDownloadMission(DownloadMission.DownloadMissionType, DownloadMission.DirectoryName, DownloadMission.FileID, DownloadMission.FileName, False);
  14119. FreeAndNil(DownloadMission);
  14120. end;
  14121. Missions.Clear;
  14122. FreeAndNil(Missions);
  14123. CheckDownloadMissions;
  14124. Exit;
  14125. end;
  14126. end;
  14127. end;
  14128. end;
  14129. CheckNDControlState;
  14130. end;
  14131. //------------------------------------------------------------------------------
  14132. procedure TMainForm.spbNDUploadClick(Sender: TObject);
  14133. var
  14134. iLoop: Integer;
  14135. begin
  14136. MainForm.FormStyle := fsNormal;
  14137. try
  14138. if UploadFileOpenDialog.Execute then
  14139. begin
  14140. for iLoop := 0 to UploadFileOpenDialog.Files.Count - 1 do
  14141. begin
  14142. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadFileOpenDialog.Files.Strings[iLoop], False);
  14143. end;
  14144. end;
  14145. finally
  14146. // if MainForm.AlwaysOnTop then
  14147. // MainForm.FormStyle := fsStayOnTop
  14148. // else
  14149. // MainForm.FormStyle := fsNormal;
  14150. CheckUploadMissions;
  14151. end;
  14152. end;
  14153. procedure TMainForm.spbNextClick(Sender: TObject);
  14154. var
  14155. TabSheet: TTabSheet;
  14156. WebBrowser: TWebBrowser;
  14157. begin
  14158. try
  14159. TabSheet := pgcMultiWeb.ActivePage;
  14160. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14161. if WebBrowser.Busy then
  14162. WebBrowser.Stop;
  14163. WebBrowser.GoForward;
  14164. except
  14165. end;
  14166. end;
  14167. function TMainForm.GetDefaultBrowser: string;//获取默认浏览器
  14168. var
  14169. reg: TRegistry;
  14170. begin
  14171. reg := TRegistry.Create;
  14172. try
  14173. {reg.RootKey := HKEY_CLASSES_ROOT;
  14174. reg.OpenKey('HTTP\shell\open\ddeexec\Application',false);
  14175. result:=reg.ReadString('');
  14176. reg.CloseKey; }
  14177. reg.RootKey := HKEY_CLASSES_ROOT;
  14178. reg.OpenKey('http\\shell\\open\\command', false);
  14179. result := reg.ReadString('');
  14180. result := Copy(result, Pos('"', result) + 1, Length(result) - 1);
  14181. result := Copy(result, 1, Pos('"', result) - 1);
  14182. reg.CloseKey;
  14183. finally
  14184. if (result = '') then
  14185. result := 'IEXPLORE.EXE';
  14186. reg.Free;
  14187. end;
  14188. end;
  14189. //---用户自助管理平台--------------------------------------
  14190. procedure TMainForm.spbPersonManageClick(Sender: TObject);
  14191. //var
  14192. // EncryptStr,
  14193. // Md5Pwd,
  14194. // Url,
  14195. // TmpStr:String;
  14196. begin
  14197. //Md5Pwd:=Md5En(RealICQClient.Password);
  14198. //TmpStr:='{'+RealICQClient.Me.LoginName+'}{'+Md5Pwd+'}';
  14199. //EncryptStr:=StrToBase64(Encrypt(TmpStr,'B77A5C561934E089'));
  14200. //Url:=RealICQClient.PersonManageUrl+'?'+ EncryptStr;
  14201. // ShellExecute(handle,'open', 'IEXPLORE.EXE', 'http://www.baidu.com', nil,SW_SHOWNORMAL);//
  14202. // ShellExecute(handle, 'open','http://220.191.210.103:8080/Default.aspx?url=', '','',SW_SHOWDEFAULT);
  14203. //MessageBox(Handle, PChar(RealICQClient.WebAppBaseURL), '提示', MB_ICONQUESTION);
  14204. //MessageBox(Handle, PChar(LoginURL), '提示', MB_ICONQUESTION);
  14205. //ShellExecute(handle, 'open', PChar(GetDefaultBrowser),PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), ''])), '',SW_SHOWDEFAULT);
  14206. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(LoginURL)])), '', SW_SHOWDEFAULT);
  14207. end;
  14208. procedure TMainForm.spbPrevClick(Sender: TObject);
  14209. var
  14210. TabSheet: TTabSheet;
  14211. WebBrowser: TWebBrowser;
  14212. begin
  14213. try
  14214. TabSheet := pgcMultiWeb.ActivePage;
  14215. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14216. if WebBrowser.Busy then
  14217. WebBrowser.Stop;
  14218. WebBrowser.GoBack;
  14219. except
  14220. end;
  14221. end;
  14222. procedure TMainForm.spbPrintPrevClick(Sender: TObject);
  14223. var
  14224. TabSheet: TTabSheet;
  14225. WebBrowser: TWebBrowser;
  14226. begin
  14227. MainForm.FormStyle := fsNormal;
  14228. try
  14229. try
  14230. TabSheet := pgcMultiWeb.ActivePage;
  14231. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14232. if WebBrowser.QueryStatusWB(OLECMDID_PRINTPREVIEW) = 3 then
  14233. WebBrowser.ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT, EmptyParam, EmptyParam);
  14234. except
  14235. end;
  14236. finally
  14237. // if MainForm.AlwaysOnTop then
  14238. // MainForm.FormStyle := fsStayOnTop
  14239. // else
  14240. // MainForm.FormStyle := fsNormal;
  14241. end;
  14242. end;
  14243. procedure TMainForm.spbRefreshBranchUsersClick(Sender: TObject);
  14244. begin
  14245. //
  14246. {TimerForGetBranchOnlineStates.Enabled := False;
  14247. TimerForGetBranchOnlineStates.Enabled := True;}
  14248. miChangeServerClick(nil);
  14249. TimerForGetBranchUsersOnlineStates.Enabled := False;
  14250. TimerForGetBranchUsersOnlineStates.Enabled := True;
  14251. end;
  14252. procedure TMainForm.spbRefreshClick(Sender: TObject);
  14253. var
  14254. TabSheet: TTabSheet;
  14255. WebBrowser: TWebBrowser;
  14256. begin
  14257. try
  14258. TabSheet := pgcMultiWeb.ActivePage;
  14259. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14260. if WebBrowser.Busy then
  14261. WebBrowser.Stop;
  14262. WebBrowser.Refresh;
  14263. except
  14264. end;
  14265. end;
  14266. //------------------------------------------------------------------------------
  14267. procedure TMainForm.RealICQNetWorkDiskClientNewDirResult(Sender: TObject; Directory: TRealICQNetWorkDiskDirectory);
  14268. var
  14269. ItemIndex: Integer;
  14270. ListItem: TRealICQContacterListItem;
  14271. UploadMission: TUploadMission;
  14272. NDDirName: string;
  14273. begin
  14274. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14275. begin
  14276. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14277. UploadMission := TUploadMission(ListItem.Data);
  14278. if UploadMission.UploadMissionType = mtDir then
  14279. begin
  14280. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14281. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14282. else
  14283. NDDirName := ExtractFileName(UploadMission.Name);
  14284. if AnsiSameText(NDDirName, Directory.Name) and (Directory.ParentID = UploadMission.DirectoryID) then
  14285. begin
  14286. RealICQNetWorkDiskClient.GetDirectory(Directory);
  14287. Exit;
  14288. end;
  14289. end;
  14290. end;
  14291. if Directory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14292. Exit;
  14293. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(Directory.ID));
  14294. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14295. with ListItem do
  14296. begin
  14297. LoginState := stOnline;
  14298. Data := Directory;
  14299. DisplayName := Directory.Name;
  14300. ReDrawItem;
  14301. end;
  14302. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14303. end;
  14304. //------------------------------------------------------------------------------
  14305. procedure TMainForm.RealICQNetWorkDiskClientNoSpace(Sender: TObject);
  14306. begin
  14307. ShowNetWorkDiskSpaceInfo;
  14308. spbNDCancelAllClick(spbNDCancelAll);
  14309. MessageBox(Handle, '抱歉!您的网络硬盘空间不足,任务已取消!', '提示', MB_ICONINFORMATION);
  14310. end;
  14311. //------------------------------------------------------------------------------
  14312. procedure TMainForm.RealICQNetWorkDiskClientRenamedDir(Sender: TObject; ADirectory: TRealICQNetWorkDiskDirectory);
  14313. var
  14314. ItemIndex: Integer;
  14315. ListItem: TRealICQContacterListItem;
  14316. begin
  14317. FLVNetWorkDisk.AdjustPosition := False;
  14318. try
  14319. if ADirectory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14320. Exit;
  14321. ItemIndex := FLVNetWorkDisk.Items.IndexOf('D' + IntToStr(ADirectory.ID));
  14322. if ItemIndex < 0 then
  14323. Exit;
  14324. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14325. with ListItem do
  14326. begin
  14327. LoginState := stOnline;
  14328. Data := ADirectory;
  14329. DisplayName := ADirectory.Name;
  14330. ReDrawItem;
  14331. end;
  14332. finally
  14333. FLVNetWorkDisk.AdjustPosition := True;
  14334. end;
  14335. end;
  14336. //------------------------------------------------------------------------------
  14337. procedure TMainForm.RealICQNetWorkDiskClientRenamedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile);
  14338. var
  14339. ItemIndex: Integer;
  14340. ListItem: TRealICQContacterListItem;
  14341. begin
  14342. FLVNetWorkDisk.AdjustPosition := False;
  14343. try
  14344. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14345. Exit;
  14346. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14347. if ItemIndex < 0 then
  14348. Exit;
  14349. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14350. with ListItem do
  14351. begin
  14352. LoginState := stLeave;
  14353. Data := AFile;
  14354. DisplayName := AFile.Name;
  14355. try
  14356. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14357. except
  14358. end;
  14359. ReDrawItem;
  14360. end;
  14361. finally
  14362. FLVNetWorkDisk.AdjustPosition := True;
  14363. end;
  14364. end;
  14365. //------------------------------------------------------------------------------
  14366. procedure TMainForm.RealICQNetWorkDiskClientUploadedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile; AMissionID: string);
  14367. var
  14368. iLoop: Integer;
  14369. ItemIndex: Integer;
  14370. ListItem: TRealICQContacterListItem;
  14371. UploadMission: TUploadMission;
  14372. AFile1: TRealICQNetWorkDiskFile;
  14373. Finded: Boolean;
  14374. begin
  14375. try
  14376. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14377. if ItemIndex >= 0 then
  14378. begin
  14379. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14380. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14381. UploadMission := TUploadMission(ListItem.Data);
  14382. FreeAndNil(UploadMission);
  14383. end;
  14384. FLVNetWorkDisk.AdjustPosition := False;
  14385. try
  14386. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14387. Exit;
  14388. Finded := False;
  14389. ListItem := nil;
  14390. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14391. begin
  14392. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14393. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14394. begin
  14395. AFile1 := TRealICQNetWorkDiskFile(ListItem.Data);
  14396. if AnsiSameText(AFile1.Name, AFile.Name) then
  14397. begin
  14398. Finded := True;
  14399. Break;
  14400. end;
  14401. end;
  14402. end;
  14403. if not Finded then
  14404. begin
  14405. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14406. if ItemIndex >= 0 then
  14407. begin
  14408. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14409. Finded := True;
  14410. end;
  14411. end;
  14412. if not Finded then
  14413. begin
  14414. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14415. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14416. end;
  14417. with ListItem do
  14418. begin
  14419. LoginState := stLeave;
  14420. Data := AFile;
  14421. DisplayName := AFile.Name;
  14422. if AFile.Size >= 1024 * 1024 then
  14423. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14424. else if AFile.Size >= 1024 then
  14425. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14426. else
  14427. Watchword := IntToStr(AFile.Size) + 'B';
  14428. try
  14429. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14430. except
  14431. end;
  14432. ReDrawItem;
  14433. end;
  14434. finally
  14435. FLVNetWorkDisk.AdjustPosition := True;
  14436. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14437. ShowNetWorkDiskSpaceInfo;
  14438. end;
  14439. finally
  14440. CheckUploadMissions;
  14441. end;
  14442. end;
  14443. //------------------------------------------------------------------------------
  14444. procedure TMainForm.RealICQNetWorkDiskClientUploadFileAborted(Sender: TObject; AMissionID: string);
  14445. var
  14446. ItemIndex: Integer;
  14447. ListItem: TRealICQContacterListItem;
  14448. UploadMission: TUploadMission;
  14449. begin
  14450. try
  14451. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14452. if ItemIndex >= 0 then
  14453. begin
  14454. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14455. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14456. UploadMission := TUploadMission(ListItem.Data);
  14457. FreeAndNil(UploadMission);
  14458. end;
  14459. finally
  14460. CheckUploadMissions;
  14461. end;
  14462. end;
  14463. //------------------------------------------------------------------------------
  14464. procedure TMainForm.RealICQNetWorkDiskClientUploadingFile(Sender: TObject; ATransmitter: TResponsionStreamTransmitter; ATransmittedSize: Int64);
  14465. var
  14466. ItemIndex: Integer;
  14467. ListItem: TRealICQContacterListItem;
  14468. Completed: Integer;
  14469. ASpeed: Cardinal;
  14470. SpeedStr: string;
  14471. begin
  14472. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf((ATransmitter as TNetWorkFileTransmitter).MissionID);
  14473. if ItemIndex >= 0 then
  14474. begin
  14475. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14476. with ListItem do
  14477. begin
  14478. Completed := ATransmittedSize * 100 div ATransmitter.StreamLength;
  14479. try
  14480. ASpeed := Round(ATransmittedSize div ((GetTickCount - ATransmitter.StartTicket) div 1000) * 1.2);
  14481. except
  14482. Exit;
  14483. end;
  14484. if ASpeed > 1000 * 1000 then
  14485. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14486. else if ASpeed > 1000 then
  14487. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14488. else
  14489. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14490. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14491. DisplayName := DisplayName + ((ATransmitter as TNetWorkFileTransmitter).FileName);
  14492. ReDrawItem;
  14493. end;
  14494. end;
  14495. end;
  14496. function ServiceGetStatus(sMachine, sService: string): DWord;
  14497. var
  14498. //service control
  14499. //manager handle
  14500. schm,
  14501. //service handle
  14502. schs: SC_Handle;
  14503. //service status
  14504. ss: TServiceStatus;
  14505. //current service status
  14506. dwStat: DWord;
  14507. begin
  14508. dwStat := 0;
  14509. //connect to the service
  14510. //control manager
  14511. schm := OpenSCManager(pchar(sMachine), Nil, SC_MANAGER_CONNECT);
  14512. //if successful...
  14513. if (schm > 0) then
  14514. begin
  14515. //open a handle to
  14516. //the specified service
  14517. schs := OpenService(schm, PChar(sService), SERVICE_QUERY_STATUS);
  14518. //if successful...
  14519. if (schs > 0) then
  14520. begin
  14521. //retrieve the current status
  14522. //of the specified service
  14523. if (QueryServiceStatus(schs, ss)) then
  14524. begin
  14525. dwStat := ss.dwCurrentState;
  14526. end;
  14527. //close service handle
  14528. CloseServiceHandle(schs);
  14529. end;
  14530. // close service control
  14531. // manager handle
  14532. CloseServiceHandle(schm);
  14533. end;
  14534. Result := dwStat;
  14535. end;
  14536. function ServiceUninstalled(sMachine, sService: string): boolean;
  14537. begin
  14538. Result := 0 = ServiceGetStatus(sMachine, sService);
  14539. end;
  14540. //------------------------------------------------------------------------------
  14541. //调用360杀毒软件
  14542. //------------------------------------------------------------------------------
  14543. procedure TMainForm.spb360SDClick(Sender: TObject);
  14544. begin
  14545. //
  14546. end;
  14547. //------------------------------------------------------------------------------
  14548. //调用360安全卫士
  14549. //------------------------------------------------------------------------------
  14550. procedure TMainForm.spb360SafeClick(Sender: TObject);
  14551. var
  14552. URL: string;
  14553. TempReg: TRegistry;
  14554. safePath: string;
  14555. begin
  14556. URL := 'http://' + self.RealICQClient.RemoteAddress + '/client/setup.exe';
  14557. try
  14558. TempReg := TRegistry.Create;
  14559. try
  14560. TempReg.RootKey := HKEY_LOCAL_MACHINE;
  14561. if not TempReg.OpenKey('\Software\360Safe\menuext\LiveUpdate360', False) then
  14562. //DownloadUpdate(URL)
  14563. else
  14564. begin
  14565. safePath := ExtractFilePath(TempReg.ReadString('Application'));
  14566. //WinExec(PChar(safePath+'\360Safe.exe'),SW_SHOW);
  14567. end;
  14568. finally
  14569. TempReg.Free;
  14570. end;
  14571. except
  14572. end;
  14573. end;
  14574. //------------------------------------------------------------------------------
  14575. procedure TMainForm.spbNDDeleteClick(Sender: TObject);
  14576. var
  14577. ListItem: TRealICQContacterListItem;
  14578. iLoop: Integer;
  14579. AList: string;
  14580. begin
  14581. if FLVNetWorkDisk.SelCount <= 0 then
  14582. Exit;
  14583. if (GetKeyState(VK_Shift) and - 128) = 0 then
  14584. begin
  14585. if MessageBox(Handle, '确认要删除选中的文件吗?', '提示', MB_ICONQUESTION or MB_OKCANCEL) <> ID_OK then
  14586. Exit;
  14587. end;
  14588. AList := '';
  14589. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14590. begin
  14591. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14592. if ListItem.Selected then
  14593. begin
  14594. AList := AList + ListItem.LoginName + Chr(10);
  14595. end;
  14596. if Length(AList) >= 1024 then
  14597. begin
  14598. RealICQNetWorkDiskClient.Delete(AList);
  14599. AList := '';
  14600. Sleep(1000);
  14601. end;
  14602. end;
  14603. if Length(AList) > 0 then
  14604. RealICQNetWorkDiskClient.Delete(AList);
  14605. end;
  14606. //------------------------------------------------------------------------------
  14607. procedure TMainForm.spbNDDisconnectClick(Sender: TObject);
  14608. begin
  14609. RealICQNetWorkDiskClient.Logout;
  14610. end;
  14611. //------------------------------------------------------------------------------
  14612. procedure TMainForm.spbNDDownloadClick(Sender: TObject);
  14613. var
  14614. iLoop: Integer;
  14615. ListItem: TRealICQContacterListItem;
  14616. Dir: string;
  14617. AFile: TRealICQNetWorkDiskFile;
  14618. ADirectory: TRealICQNetWorkDiskDirectory;
  14619. begin
  14620. if FLVNetWorkDisk.SelCount = 0 then
  14621. Exit;
  14622. if FLVNetWorkDisk.SelCount = 1 then
  14623. begin
  14624. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14625. begin
  14626. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14627. if ListItem.Selected then
  14628. begin
  14629. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14630. begin
  14631. NDItemDoubleClick(ListItem);
  14632. Exit;
  14633. end;
  14634. end;
  14635. end;
  14636. end;
  14637. MainForm.FormStyle := fsNormal;
  14638. try
  14639. if SelectDirectory('请选择目录', '', Dir) then
  14640. begin
  14641. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14642. begin
  14643. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14644. if ListItem.Selected then
  14645. begin
  14646. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14647. begin
  14648. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14649. AddDownloadMission(mtDir, Dir + '\' + ADirectory.Name, 0, '', False);
  14650. end
  14651. else
  14652. begin
  14653. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14654. AddDownloadMission(mtFile, ExtractFilePath(Dir), AFile.ID, Dir + '\' + AFile.Name, False);
  14655. end;
  14656. end;
  14657. end; //for
  14658. CheckDownloadMissions;
  14659. end;
  14660. finally
  14661. // if MainForm.AlwaysOnTop then
  14662. // MainForm.FormStyle := fsStayOnTop
  14663. // else
  14664. // MainForm.FormStyle := fsNormal;
  14665. end;
  14666. end;
  14667. //------------------------------------------------------------------------------
  14668. procedure TMainForm.NDItemDoubleClick(Item: TRealICQContacterListItem);
  14669. var
  14670. AFile: TRealICQNetWorkDiskFile;
  14671. ADirectory: TRealICQNetWorkDiskDirectory;
  14672. begin
  14673. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  14674. begin
  14675. Exit;
  14676. end;
  14677. if Copy(Item.LoginName, 1, 1) = 'D' then
  14678. begin
  14679. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  14680. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14681. end
  14682. else if Copy(Item.LoginName, 1, 1) = 'F' then
  14683. begin
  14684. AFile := TRealICQNetWorkDiskFile(Item.Data);
  14685. MainForm.FormStyle := fsNormal;
  14686. try
  14687. DownloadFileSaveDialog.FileName := AFile.Name;
  14688. if DownloadFileSaveDialog.Execute then
  14689. begin
  14690. AddDownloadMission(mtFile, ExtractFilePath(DownloadFileSaveDialog.FileName), AFile.ID, DownloadFileSaveDialog.FileName, True);
  14691. end;
  14692. finally
  14693. // if MainForm.AlwaysOnTop then
  14694. // MainForm.FormStyle := fsStayOnTop
  14695. // else
  14696. // MainForm.FormStyle := fsNormal;
  14697. end;
  14698. end;
  14699. end;
  14700. //------------------------------------------------------------------------------
  14701. procedure TMainForm.RealICQNetWorkDiskClientDeleteResult(Sender: TObject; AList: string);
  14702. var
  14703. AStringList: TStringList;
  14704. iLoop, iIndex: Integer;
  14705. begin
  14706. AStringList := SplitString(AList, Chr(10));
  14707. FLVNetWorkDisk.DisableAlign;
  14708. try
  14709. for iLoop := 0 to AStringList.Count - 1 do
  14710. begin
  14711. iIndex := FLVNetWorkDisk.Items.IndexOf(AStringList.Strings[iLoop]);
  14712. if iIndex >= 0 then
  14713. FLVNetWorkDisk.Items.Delete(iIndex);
  14714. end;
  14715. finally
  14716. FLVNetWorkDisk.EnableAlign;
  14717. FreeAndNil(AStringList);
  14718. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14719. ShowNetWorkDiskSpaceInfo;
  14720. NDSelectItemChanged(nil);
  14721. end;
  14722. end;
  14723. //------------------------------------------------------------------------------
  14724. procedure TMainForm.RealICQNetWorkDiskClientDirectoryListReady(Sender: TObject);
  14725. var
  14726. iLoop, ItemIndex: Integer;
  14727. AFile: TRealICQNetWorkDiskFile;
  14728. ADirectory: TRealICQNetWorkDiskDirectory;
  14729. ListItem: TRealICQContacterListItem;
  14730. Bitmap: TBitmap;
  14731. UploadMission: TUploadMission;
  14732. NDDirName: string;
  14733. begin
  14734. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  14735. edNDDir.Text := '';
  14736. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory;
  14737. while ADirectory <> nil do
  14738. begin
  14739. edNDDir.Text := ADirectory.Name + '\' + edNDDir.Text;
  14740. ADirectory := ADirectory.Parent;
  14741. end;
  14742. try
  14743. FLVNetWorkDisk.AdjustPosition := False;
  14744. FLVNetWorkDisk.DisableAlign;
  14745. FLVNetWorkDisk.Items.Clear;
  14746. NDSelectItemChanged(nil);
  14747. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14748. begin
  14749. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14750. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(ADirectory.ID));
  14751. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14752. with ListItem do
  14753. begin
  14754. LoginState := stOnline;
  14755. Data := ADirectory;
  14756. DisplayName := ADirectory.Name;
  14757. end;
  14758. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, 0, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14759. lblNDState.Update;
  14760. end;
  14761. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 do
  14762. begin
  14763. AFile := TRealICQNetWorkDiskFile(RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop]);
  14764. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14765. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14766. with ListItem do
  14767. begin
  14768. LoginState := stLeave;
  14769. Data := AFile;
  14770. DisplayName := AFile.Name;
  14771. if AFile.Size >= 1024 * 1024 then
  14772. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14773. else if AFile.Size >= 1024 then
  14774. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14775. else
  14776. Watchword := IntToStr(AFile.Size) + 'B';
  14777. try
  14778. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14779. except
  14780. end;
  14781. FreeAndNil(Bitmap);
  14782. end;
  14783. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14784. lblNDState.Update;
  14785. end;
  14786. finally
  14787. FLVNetWorkDisk.ReDrawAll;
  14788. FLVNetWorkDisk.EnableAlign;
  14789. FLVNetWorkDisk.AdjustPosition := True;
  14790. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14791. end;
  14792. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14793. begin
  14794. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14795. UploadMission := TUploadMission(ListItem.Data);
  14796. if UploadMission.UploadMissionType = mtDir then
  14797. begin
  14798. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14799. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14800. else
  14801. NDDirName := ExtractFileName(UploadMission.Name);
  14802. if AnsiSameText(NDDirName, RealICQNetWorkDiskClient.CurrentDirectory.Name) and (RealICQNetWorkDiskClient.CurrentDirectory.ParentID = UploadMission.DirectoryID) then
  14803. begin
  14804. try
  14805. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  14806. except
  14807. end;
  14808. try
  14809. GoNextLevelUploadMissions(UploadMission);
  14810. finally
  14811. FreeAndNil(UploadMission);
  14812. end;
  14813. Exit;
  14814. end;
  14815. end;
  14816. end;
  14817. if Length(Trim(FLastDownloadDirectory)) > 0 then
  14818. begin
  14819. if (DirectoryExists(FLastDownloadDirectory)) then
  14820. begin
  14821. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14822. begin
  14823. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14824. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14825. begin
  14826. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14827. AddDownloadMission(mtDir, FLastDownloadDirectory + '\' + ADirectory.Name, 0, '', False);
  14828. end
  14829. else
  14830. begin
  14831. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14832. AddDownloadMission(mtFile, ExtractFilePath(FLastDownloadDirectory), AFile.ID, FLastDownloadDirectory + '\' + AFile.Name, False);
  14833. end;
  14834. end; //for
  14835. CheckDownloadMissions;
  14836. end;
  14837. end;
  14838. end;
  14839. //------------------------------------------------------------------------------
  14840. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileAborted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14841. begin
  14842. end;
  14843. //------------------------------------------------------------------------------
  14844. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileCompleted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14845. var
  14846. ListItem: TRealICQContacterListItem;
  14847. DownloadMission: TDownloadMission;
  14848. MessageBoxResult: Integer;
  14849. begin
  14850. if not RealICQNetWorkDiskClient.Connected then
  14851. Exit;
  14852. try
  14853. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14854. begin
  14855. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14856. DownloadMission := TDownloadMission(ListItem.Data);
  14857. if DownloadMission.FFileID = AFileDownloader.FileID then
  14858. begin
  14859. if not AFileDownloader.Completed then
  14860. begin
  14861. if AFileDownloader.Exp <> nil then
  14862. begin
  14863. MessageBoxResult := MessageBox(Handle, PChar('下载文件时出错:'#$D#$A#$D#$A + AFileDownloader.Exp.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  14864. if MessageBoxResult = ID_ABORT then
  14865. begin
  14866. spbNDCancelAllClick(spbNDCancelAll);
  14867. Exit;
  14868. end
  14869. else if MessageBoxResult = ID_RETRY then
  14870. begin
  14871. CheckDownloadMissions;
  14872. Exit;
  14873. end
  14874. else if MessageBoxResult = ID_IGNORE then
  14875. begin
  14876. end;
  14877. end;
  14878. end;
  14879. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14880. FreeAndNil(DownloadMission);
  14881. end;
  14882. end;
  14883. except
  14884. end;
  14885. CheckDownloadMissions;
  14886. end;
  14887. //------------------------------------------------------------------------------
  14888. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileTransmitting(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14889. var
  14890. ListItem: TRealICQContacterListItem;
  14891. Completed: Integer;
  14892. ASpeed: Cardinal;
  14893. SpeedStr: string;
  14894. begin
  14895. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14896. begin
  14897. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14898. with ListItem do
  14899. begin
  14900. Completed := AFileDownloader.RecvedSize * 100 div AFileDownloader.FileSize;
  14901. try
  14902. ASpeed := Round(AFileDownloader.RecvedSize div ((GetTickCount - AFileDownloader.StartTicket) div 1000) * 1.2);
  14903. except
  14904. Exit;
  14905. end;
  14906. if ASpeed > 1000 * 1000 then
  14907. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14908. else if ASpeed > 1000 then
  14909. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14910. else
  14911. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14912. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14913. DisplayName := DisplayName + (AFileDownloader.LocalFileName);
  14914. ReDrawItem;
  14915. end;
  14916. end;
  14917. end;
  14918. //------------------------------------------------------------------------------
  14919. procedure TMainForm.RealICQNetWorkDiskClientGettedUsedSpaceSize(Sender: TObject);
  14920. begin
  14921. ShowNetWorkDiskSpaceInfo;
  14922. end;
  14923. //------------------------------------------------------------------------------
  14924. procedure TMainForm.RealICQNetWorkDiskClientLoginFailed(Sender: TObject; E: Exception);
  14925. begin
  14926. lblNDState.Caption := '连接失败(' + E.Message + ')';
  14927. end;
  14928. //------------------------------------------------------------------------------
  14929. procedure TMainForm.RealICQNetWorkDiskClientLoginResult(Sender: TObject; LoginResultType: Byte);
  14930. begin
  14931. if LoginResultType = 0 then
  14932. begin
  14933. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory);
  14934. end
  14935. else if LoginResultType = 1 then
  14936. begin
  14937. lblNDState.Caption := '连接失败,服务器版本错误';
  14938. end
  14939. else if LoginResultType = 2 then
  14940. begin
  14941. lblNDState.Caption := '连接失败,用户验证错误';
  14942. end;
  14943. end;
  14944. //------------------------------------------------------------------------------
  14945. procedure TMainForm.RealICQClientBeDropped(Sender: TObject; Excuse: string);
  14946. begin
  14947. MessageBox(Handle, PChar(Excuse), '你已被强制下线', MB_ICONINFORMATION or MB_OK);
  14948. TTeamsAdapter.Stop;
  14949. end;
  14950. //------------------------------------------------------------------------------
  14951. procedure TMainForm.RealICQClientDownloadFile(Sender: TObject; AFileName: string);
  14952. var
  14953. iLoop: Integer;
  14954. WebPanel: TWebPanel;
  14955. TabSheet: TTabSheet;
  14956. Bitmap: TBitmap;
  14957. begin
  14958. for iLoop := 0 to FWebTabs.Count - 1 do
  14959. begin
  14960. TabSheet := FWebTabs[iLoop];
  14961. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  14962. if AnsiSameText(WebPanel.Image, AFileName) then
  14963. begin
  14964. Bitmap := TBitmap.Create;
  14965. try
  14966. try
  14967. Bitmap.LoadFromFile(AFileName);
  14968. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  14969. ImgLstPageControl.Add(Bitmap, Bitmap);
  14970. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  14971. except
  14972. end;
  14973. finally
  14974. FreeAndNil(Bitmap);
  14975. end;
  14976. end;
  14977. end;
  14978. end;
  14979. //------------------------------------------------------------------------------
  14980. procedure TMainForm.RealICQClientDownloadTeamFace(Sender: TObject; AFileName: string);
  14981. begin
  14982. ShowGettedFace(AFileName);
  14983. end;
  14984. //------------------------------------------------------------------------------
  14985. procedure TMainForm.RealICQClientLoginFailed(Sender: TObject; E: Exception);
  14986. begin
  14987. TimerForLogining.Enabled := False;
  14988. SetUIState;
  14989. MessageBox(Handle, PChar('抱歉,您现在无法登录至服务器: ' + E.Message), '登录失败', MB_ICONINFORMATION or MB_OK);
  14990. end;
  14991. //------------------------------------------------------------------------------
  14992. procedure TMainForm.actShowLoginNameExecute(Sender: TObject);
  14993. var
  14994. iLoop: Integer;
  14995. RealICQContacterListView: TRealICQContacterListView;
  14996. RealICQContacterTreeView: TRealICQContacterTreeView;
  14997. begin
  14998. for iLoop := 0 to FContacterListViews.Count - 1 do
  14999. begin
  15000. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15001. RealICQContacterListView.CaptionStyle := csLoginName;
  15002. end;
  15003. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15004. begin
  15005. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15006. RealICQContacterTreeView.CaptionStyle := csLoginName;
  15007. RealICQContacterTreeView.ReDrawAll;
  15008. end;
  15009. FLVCaptionStyle := csLoginName;
  15010. SaveStyleConfigs;
  15011. end;
  15012. //------------------------------------------------------------------------------
  15013. procedure TMainForm.actShowDisplayNameExecute(Sender: TObject);
  15014. var
  15015. iLoop: Integer;
  15016. RealICQContacterListView: TRealICQContacterListView;
  15017. RealICQContacterTreeView: TRealICQContacterTreeView;
  15018. begin
  15019. for iLoop := 0 to FContacterListViews.Count - 1 do
  15020. begin
  15021. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15022. RealICQContacterListView.CaptionStyle := csDisplayName;
  15023. end;
  15024. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15025. begin
  15026. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15027. RealICQContacterTreeView.CaptionStyle := csDisplayName;
  15028. RealICQContacterTreeView.ReDrawAll;
  15029. end;
  15030. FLVCaptionStyle := csDisplayName;
  15031. SaveStyleConfigs;
  15032. end;
  15033. //------------------------------------------------------------------------------
  15034. procedure TMainForm.actShowGIFInMailFormExecute(Sender: TObject);
  15035. begin
  15036. actShowGIFInMailForm.Checked := not actShowGIFInMailForm.Checked;
  15037. FShowGIFInMailForm := actShowGIFInMailForm.Checked;
  15038. SaveStyleConfigs;
  15039. if RealICQClient.Me = nil then
  15040. Exit;
  15041. if RealICQClient.Me.HeadImageFileType = htGIF then
  15042. begin
  15043. ShowMeInformation;
  15044. end;
  15045. end;
  15046. //------------------------------------------------------------------------------
  15047. procedure TMainForm.actShowGIFInTalkingFormExecute(Sender: TObject);
  15048. begin
  15049. actShowGIFInTalkingForm.Checked := not actShowGIFInTalkingForm.Checked;
  15050. FShowGIFInTalkingForm := actShowGIFInTalkingForm.Checked;
  15051. SaveStyleConfigs;
  15052. UpdateAllTakingFormGIFHeadImage;
  15053. end;
  15054. //------------------------------------------------------------------------------
  15055. procedure TMainForm.actShowGroupExecute(Sender: TObject);
  15056. begin
  15057. FShowGroup := not FShowGroup;
  15058. actShowGroup.Checked := FShowGroup;
  15059. SaveIfShowGroupConfig;
  15060. ShowGroupInterface;
  15061. end;
  15062. //------------------------------------------------------------------------------
  15063. function TMainForm.GetSelectedLoginName: string;
  15064. var
  15065. GroupIndex, iLoop: Integer;
  15066. GroupName: string;
  15067. ListView: TRealICQContacterListView;
  15068. ListItem: TRealICQContacterListItem;
  15069. ItemIndex: Integer;
  15070. RealICQFriendTreeView: TRealICQContacterTreeView;
  15071. RealICQContacterTreeView: TRealICQContacterTreeView;
  15072. Employee: TRealICQEmployee;
  15073. Friend: TRealICQEmployee;
  15074. begin
  15075. Result := '';
  15076. if FSearchListViewInVisible then
  15077. begin
  15078. for iLoop := 0 to FSearchListView.Items.Count - 1 do
  15079. begin
  15080. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15081. if ListItem.Selected then
  15082. begin
  15083. Result := ListItem.LoginName;
  15084. Exit;
  15085. end;
  15086. end;
  15087. end;
  15088. GroupName := GetActiveTabSheetName;
  15089. if GroupName = LVMyContacters then
  15090. begin
  15091. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  15092. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15093. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15094. if Employee <> nil then
  15095. begin
  15096. Result := Employee.LoginName;
  15097. end;
  15098. Exit;
  15099. end;
  15100. if GroupName = LVMoreUsers then
  15101. begin
  15102. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  15103. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15104. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15105. if Employee <> nil then
  15106. begin
  15107. Result := Employee.LoginName;
  15108. end;
  15109. Exit;
  15110. end;
  15111. if GroupName = LVFriends then
  15112. begin
  15113. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  15114. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15115. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  15116. if Friend <> nil then
  15117. begin
  15118. Result := Friend.LoginName;
  15119. end;
  15120. Exit;
  15121. end;
  15122. GroupIndex := FContacterListViews.IndexOf(GroupName);
  15123. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  15124. for iLoop := 0 to ListView.Items.Count - 1 do
  15125. begin
  15126. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15127. if ListItem.Selected then
  15128. begin
  15129. Result := ListItem.LoginName;
  15130. Break;
  15131. end;
  15132. end;
  15133. end;
  15134. //------------------------------------------------------------------------------
  15135. procedure TMainForm.actShowHistoryExecute(Sender: TObject);
  15136. var
  15137. LoginName: string;
  15138. begin
  15139. LoginName := GetSelectedLoginName;
  15140. if LoginName <> '' then
  15141. begin
  15142. OpenMessagesManagerForm;
  15143. Application.ProcessMessages;
  15144. MessagesManagerForm.ShowUsersMessages(LoginName);
  15145. end;
  15146. end;
  15147. //------------------------------------------------------------------------------
  15148. procedure TMainForm.actSeeInformationExecute(Sender: TObject);
  15149. var
  15150. LoginName: string;
  15151. begin
  15152. LoginName := GetSelectedLoginName;
  15153. if LoginName <> '' then
  15154. begin
  15155. SeeUserInformation(LoginName);
  15156. end;
  15157. end;
  15158. //------------------------------------------------------------------------------
  15159. procedure TMainForm.actChangeRemarkExecute(Sender: TObject);
  15160. var
  15161. LoginName: string;
  15162. Remark: string;
  15163. RealICQUser: TRealICQUser;
  15164. begin
  15165. LoginName := GetSelectedLoginName;
  15166. if LoginName <> '' then
  15167. begin
  15168. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  15169. if RealICQUser = nil then
  15170. Exit;
  15171. if (RealICQUser.LoginName = RealICQClient.Me.LoginName) then
  15172. begin
  15173. ShowMessage('不允许修改自己的备注名称!');
  15174. Exit;
  15175. end;
  15176. Remark := RealICQUser.Remark;
  15177. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  15178. if not AnsiSameStr(Remark, RealICQUser.Remark) then
  15179. RealICQClient.ChangeRemark(LoginName, Remark);
  15180. end;
  15181. end;
  15182. //------------------------------------------------------------------------------
  15183. procedure TMainForm.actSendMessageExecute(Sender: TObject);
  15184. var
  15185. LoginName: string;
  15186. begin
  15187. LoginName := GetSelectedLoginName;
  15188. if LoginName <> '' then
  15189. begin
  15190. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  15191. begin
  15192. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  15193. Exit;
  15194. end;
  15195. //----------------------------------------
  15196. {if GetActiveTabSheetName=MoreUser then
  15197. begin
  15198. RealICQClient.GetUserInformation(LoginName,True);
  15199. end;}
  15200. OpenTalkingForm(LoginName);
  15201. end;
  15202. end;
  15203. //------------------------------------------------------------------------------
  15204. procedure TMainForm.actSendTeamMessageExecute(Sender: TObject);
  15205. var
  15206. iLoop: Integer;
  15207. ListItem: TRealICQContacterListItem;
  15208. RealICQTeam: TRealICQTeam;
  15209. begin
  15210. if FLVTeams.SelCount = 1 then
  15211. begin
  15212. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15213. begin
  15214. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15215. if ListItem.Selected then
  15216. begin
  15217. RealICQTeam := ListItem.Data;
  15218. OpenTeamTalkingForm(RealICQTeam.TeamID);
  15219. Break;
  15220. end;
  15221. end;
  15222. end;
  15223. end;
  15224. //------------------------------------------------------------------------------
  15225. procedure TMainForm.actSeeTeamInformationExecute(Sender: TObject);
  15226. var
  15227. iLoop: Integer;
  15228. ListItem: TRealICQContacterListItem;
  15229. RealICQTeam: TRealICQTeam;
  15230. begin
  15231. if FLVTeams.SelCount = 1 then
  15232. begin
  15233. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15234. begin
  15235. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15236. if ListItem.Selected then
  15237. begin
  15238. RealICQTeam := ListItem.Data;
  15239. OpenTeamOptionsForm(RealICQTeam);
  15240. Break;
  15241. end;
  15242. end;
  15243. end;
  15244. end;
  15245. //------------------------------------------------------------------------------
  15246. procedure TMainForm.actQuitTeamExecute(Sender: TObject);
  15247. var
  15248. iLoop: Integer;
  15249. ListItem: TRealICQContacterListItem;
  15250. RealICQTeam: TRealICQTeam;
  15251. begin
  15252. if FLVTeams.SelCount = 1 then
  15253. begin
  15254. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15255. begin
  15256. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15257. if ListItem.Selected then
  15258. begin
  15259. RealICQTeam := ListItem.Data;
  15260. if MessageBox(Handle, '真的要退出该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15261. Exit;
  15262. TTeamsAdapter.QuitTeam(RealICQTeam.TeamID);
  15263. Break;
  15264. end;
  15265. end;
  15266. end;
  15267. end;
  15268. //------------------------------------------------------------------------------
  15269. procedure TMainForm.actDisbandTeamExecute(Sender: TObject);
  15270. var
  15271. iLoop: Integer;
  15272. ListItem: TRealICQContacterListItem;
  15273. RealICQTeam: TRealICQTeam;
  15274. begin
  15275. {if FLVTeams.SelCount = 1 then
  15276. begin
  15277. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15278. begin
  15279. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15280. if ListItem.Selected then
  15281. begin
  15282. RealICQTeam := ListItem.Data;
  15283. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then Exit;
  15284. RealICQClient.DisbandTeam(RealICQTeam.TeamID);
  15285. Break;
  15286. end;
  15287. end;
  15288. end; }
  15289. if FLVTeams.SelCount = 1 then
  15290. begin
  15291. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15292. begin
  15293. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15294. if ListItem.Selected then
  15295. begin
  15296. RealICQTeam := ListItem.Data;
  15297. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15298. Exit;
  15299. TTeamsAdapter.DisbandTeam(RealICQTeam.TeamID);
  15300. Break;
  15301. end;
  15302. end;
  15303. end;
  15304. end;
  15305. //------------------------------------------------------------------------------
  15306. procedure TMainForm.actQuitOrDisbandTeamsExecute(Sender: TObject);
  15307. var
  15308. iLoop: Integer;
  15309. ListItem: TRealICQContacterListItem;
  15310. RealICQTeam: TRealICQTeam;
  15311. begin
  15312. if MessageBox(Handle, '真的要退出 / 解散选中的群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15313. Exit;
  15314. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15315. begin
  15316. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15317. if ListItem.Selected then
  15318. begin
  15319. RealICQTeam := ListItem.Data;
  15320. if AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName) then
  15321. RealICQClient.DisbandTeam(RealICQTeam.TeamID)
  15322. else
  15323. RealICQClient.QuitTeam(RealICQTeam.TeamID);
  15324. end;
  15325. end;
  15326. end;
  15327. //------------------------------------------------------------------------------
  15328. procedure TMainForm.actShowAllNameExecute(Sender: TObject);
  15329. var
  15330. iLoop: Integer;
  15331. RealICQContacterListView: TRealICQContacterListView;
  15332. RealICQContacterTreeView: TRealICQContacterTreeView;
  15333. begin
  15334. for iLoop := 0 to FContacterListViews.Count - 1 do
  15335. begin
  15336. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15337. RealICQContacterListView.CaptionStyle := csDisplayNameAndLoginName;
  15338. end;
  15339. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15340. begin
  15341. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15342. RealICQContacterTreeView.CaptionStyle := csDisplayNameAndLoginName;
  15343. RealICQContacterTreeView.ReDrawAll;
  15344. end;
  15345. FLVCaptionStyle := csDisplayNameAndLoginName;
  15346. SaveStyleConfigs;
  15347. end;
  15348. //------------------------------------------------------------------------------
  15349. procedure TMainForm.actShowBigHeadImageExecute(Sender: TObject);
  15350. var
  15351. iLoop: Integer;
  15352. RealICQContacterListView: TRealICQContacterListView;
  15353. RealICQContacterTreeView: TRealICQContacterTreeView;
  15354. begin
  15355. for iLoop := 0 to FContacterListViews.Count - 1 do
  15356. begin
  15357. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15358. RealICQContacterListView.Style := lsBigHeadImage;
  15359. end;
  15360. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15361. begin
  15362. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15363. RealICQContacterTreeView.Style := lsBigHeadImage;
  15364. RealICQContacterTreeView.ReDrawAll;
  15365. end;
  15366. FLVStyle := lsBigHeadImage;
  15367. SaveStyleConfigs;
  15368. end;
  15369. procedure TMainForm.actShowMiddleHeadImageExecute(Sender: TObject);
  15370. var
  15371. iLoop: Integer;
  15372. RealICQContacterListView: TRealICQContacterListView;
  15373. RealICQContacterTreeView: TRealICQContacterTreeView;
  15374. begin
  15375. for iLoop := 0 to FContacterListViews.Count - 1 do
  15376. begin
  15377. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15378. RealICQContacterListView.Style := lsMiddleHeadImage;
  15379. end;
  15380. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15381. begin
  15382. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15383. RealICQContacterTreeView.Style := lsMiddleHeadImage;
  15384. RealICQContacterTreeView.ReDrawAll;
  15385. end;
  15386. FLVStyle := lsMiddleHeadImage;
  15387. SaveStyleConfigs;
  15388. end;
  15389. //------------------------------------------------------------------------------
  15390. procedure TMainForm.actShowSmallHeadImageExecute(Sender: TObject);
  15391. var
  15392. iLoop: Integer;
  15393. RealICQContacterListView: TRealICQContacterListView;
  15394. RealICQContacterTreeView: TRealICQContacterTreeView;
  15395. begin
  15396. for iLoop := 0 to FContacterListViews.Count - 1 do
  15397. begin
  15398. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15399. RealICQContacterListView.Style := lsSmallHeadImage;
  15400. end;
  15401. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15402. begin
  15403. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15404. RealICQContacterTreeView.Style := lsSmallHeadImage;
  15405. RealICQContacterTreeView.ReDrawAll;
  15406. end;
  15407. FLVStyle := lsSmallHeadImage;
  15408. SaveStyleConfigs;
  15409. end;
  15410. //------------------------------------------------------------------------------
  15411. procedure TMainForm.actShowStrangersExecute(Sender: TObject);
  15412. begin
  15413. // SaveStyleConfigs;
  15414. end;
  15415. //------------------------------------------------------------------------------
  15416. procedure TMainForm.actShowBlacklistsExecute(Sender: TObject);
  15417. begin
  15418. // SaveStyleConfigs;
  15419. end;
  15420. //------------------------------------------------------------------------------
  15421. procedure TMainForm.actShowTeamHistoryExecute(Sender: TObject);
  15422. var
  15423. iLoop: Integer;
  15424. ListItem: TRealICQContacterListItem;
  15425. RealICQTeam: TRealICQTeam;
  15426. begin
  15427. if FLVTeams.SelCount = 1 then
  15428. begin
  15429. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15430. begin
  15431. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15432. if ListItem.Selected then
  15433. begin
  15434. RealICQTeam := ListItem.Data;
  15435. OpenMessagesManagerForm;
  15436. Application.ProcessMessages;
  15437. MessagesManagerForm.ShowTeamsMessages(RealICQTeam.TeamID);
  15438. Break;
  15439. end;
  15440. end;
  15441. end;
  15442. end;
  15443. //------------------------------------------------------------------------------
  15444. procedure TMainForm.actShowTeamsExecute(Sender: TObject);
  15445. begin
  15446. // SaveStyleConfigs;
  15447. end;
  15448. //------------------------------------------------------------------------------
  15449. procedure TMainForm.actShowTreeExecute(Sender: TObject);
  15450. begin
  15451. FShowTree := not FShowTree;
  15452. actShowTree.Checked := FShowTree;
  15453. actShowBigHeadImage.Visible := not actShowTree.Checked;
  15454. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  15455. if FShowTree then
  15456. begin
  15457. if FLVStyle <> lsNoHeadImage then
  15458. begin
  15459. FLVStyle := lsSmallHeadImage;
  15460. actShowSmallHeadImage.Execute;
  15461. end;
  15462. end;
  15463. SaveStyleConfigs;
  15464. ShowGroupInterface;
  15465. end;
  15466. //------------------------------------------------------------------------------
  15467. procedure TMainForm.actShowLatestsExecute(Sender: TObject);
  15468. begin
  15469. //
  15470. end;
  15471. //------------------------------------------------------------------------------
  15472. procedure TMainForm.actAboutExecute(Sender: TObject);
  15473. begin
  15474. AboutForm := TAboutForm.Create(Self);
  15475. try
  15476. AboutForm.ShowModal;
  15477. finally
  15478. FreeAndNil(AboutForm);
  15479. end;
  15480. end;
  15481. //------------------------------------------------------------------------------
  15482. procedure TMainForm.actAlwaysOnTopExecute(Sender: TObject);
  15483. begin
  15484. FAlwaysOnTop := not FAlwaysOnTop;
  15485. // if FAlwaysOnTop then
  15486. // FormStyle := fsStayOnTop
  15487. // else
  15488. FormStyle := fsNormal;
  15489. actAlwaysOnTop.Checked := FAlwaysOnTop;
  15490. SaveDefaultConfigs;
  15491. end;
  15492. //------------------------------------------------------------------------------
  15493. procedure TMainForm.actShowNormalHeadImageExecute(Sender: TObject);
  15494. var
  15495. iLoop: Integer;
  15496. RealICQContacterListView: TRealICQContacterListView;
  15497. RealICQContacterTreeView: TRealICQContacterTreeView;
  15498. begin
  15499. for iLoop := 0 to FContacterListViews.Count - 1 do
  15500. begin
  15501. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15502. RealICQContacterListView.Style := lsNoHeadImage;
  15503. end;
  15504. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15505. begin
  15506. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15507. RealICQContacterTreeView.Style := lsNoHeadImage;
  15508. RealICQContacterTreeView.ReDrawAll;
  15509. end;
  15510. FLVStyle := lsNoHeadImage;
  15511. SaveStyleConfigs;
  15512. end;
  15513. //------------------------------------------------------------------------------
  15514. procedure TMainForm.actShowRemarkExecute(Sender: TObject);
  15515. var
  15516. iLoop, jLoop: Integer;
  15517. RealICQContacterListView: TRealICQContacterListView;
  15518. RealICQContacterTreeView: TRealICQContacterTreeView;
  15519. RealICQContacterListItem: TRealICQContacterListItem;
  15520. RealICQUser: TRealICQUser;
  15521. Employee: TRealICQEmployee;
  15522. begin
  15523. actShowRemark.Checked := not actShowRemark.Checked;
  15524. RealICQClient.ShowRemark := actShowRemark.Checked;
  15525. for iLoop := 0 to FContacterListViews.Count - 1 do
  15526. begin
  15527. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15528. for jLoop := 0 to RealICQContacterListView.Items.Count - 1 do
  15529. begin
  15530. RealICQContacterListItem := RealICQContacterListView.Items.Objects[jLoop] as TRealICQContacterListItem;
  15531. RealICQUser := RealICQContacterListItem.Data;
  15532. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  15533. end;
  15534. end;
  15535. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15536. begin
  15537. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15538. for jLoop := 0 to RealICQContacterTreeView.Count - 1 do
  15539. begin
  15540. Employee := RealICQContacterTreeView.EmployeeItems.Objects[jLoop] as TRealICQEmployee;
  15541. RealICQUser := Employee.Data;
  15542. UpdateEmployeeNode(Employee, RealICQUser, False);
  15543. end;
  15544. RealICQContacterTreeView.ReDrawAll;
  15545. end;
  15546. end;
  15547. //------------------------------------------------------------------------------
  15548. procedure TMainForm.actFindUsersExecute(Sender: TObject);
  15549. begin
  15550. if SearchForm <> nil then
  15551. begin
  15552. SearchForm.BringToFront;
  15553. Exit;
  15554. end;
  15555. SearchForm := TSearchForm.Create(Application);
  15556. SearchForm.Show;
  15557. end;
  15558. procedure TMainForm.actGroupManagerExecute(Sender: TObject);
  15559. begin
  15560. if GroupManagerForm <> nil then
  15561. Exit;
  15562. GroupManagerForm := TGroupManagerForm.Create(Self);
  15563. try
  15564. GroupManagerForm.ShowModal;
  15565. finally
  15566. FreeAndNil(GroupManagerForm);
  15567. end;
  15568. end;
  15569. //------------------------------------------------------------------------------
  15570. procedure TMainForm.OpenMessagesManagerForm;
  15571. begin
  15572. actMsgManagerExecute(nil);
  15573. end;
  15574. //------------------------------------------------------------------------------
  15575. procedure TMainForm.pgcMainWorkAreaTabChanging(Sender: TObject; NewIndex: Integer; var AllowChanged: Boolean);
  15576. var
  15577. TabSheet: TTabSheet;
  15578. WebPanel: TWebPanel;
  15579. Point: TPoint;
  15580. begin
  15581. {if NewIndex = 1 then
  15582. begin
  15583. MainForm.RealICQClient.OnGettedAddrBookGroups:=GettedAddrBookGroups;
  15584. MainForm.RealICQClient.OnManageAddrBookResult:=GettedManageAddrBookResult;
  15585. RealICQClient.SendGetAddrBookGroup;
  15586. end;}
  15587. if NewIndex > 2 then
  15588. begin
  15589. AllowChanged := False;
  15590. //if not DisplayWebs then Exit;
  15591. TabSheet := pgcMainWorkArea.Pages[NewIndex];
  15592. WebPanel := FWebPanels.Objects[TabSheet.Tag] as TWebPanel;
  15593. //if WebPanel.FNavigateType = ntFill then AllowChanged := True;
  15594. if WebPanel.Acounts.Count > 1 then
  15595. begin
  15596. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  15597. begin
  15598. Point.X := Mouse.CursorPos.X;
  15599. Point.Y := Mouse.CursorPos.Y;
  15600. FreeAndNil(SelWebTabAcountsForm);
  15601. SelWebTabAcountsForm := TSelWebTabAcountsForm.Create(Self);
  15602. SelWebTabAcountsForm.WebPanel := WebPanel;
  15603. SelWebTabAcountsForm.TabSheet := TabSheet;
  15604. SelWebTabAcountsForm.Left := Point.X;
  15605. SelWebTabAcountsForm.Top := Point.Y - 20;
  15606. if Left <= SelWebTabAcountsForm.Width then
  15607. SelWebTabAcountsForm.Left := Left + Width
  15608. else
  15609. SelWebTabAcountsForm.Left := Left - SelWebTabAcountsForm.Width;
  15610. if WebPanel.Acounts.Count < 10 then
  15611. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := WebPanel.Acounts.Count * cntHeightOfBigHeadImage + 3
  15612. else
  15613. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := 10 * cntHeightOfBigHeadImage + 3;
  15614. SelWebTabAcountsForm.pnlClient.Constraints.MaxHeight := SelWebTabAcountsForm.pnlClient.Constraints.MinHeight;
  15615. SelWebTabAcountsForm.Show;
  15616. Exit;
  15617. end;
  15618. end;
  15619. WebTabShow(TabSheet);
  15620. end;
  15621. end;
  15622. procedure TMainForm.pgcMainWorkAreaWebPanelButtonClick(Sender: TObject);
  15623. begin
  15624. pgcMainWorkArea.OnWebPanelButtonClick := nil;
  15625. if OptionsForm = nil then
  15626. OptionsForm := TOptionsForm.Create(Self);
  15627. try
  15628. OptionsForm.PageIndex := 10;
  15629. OptionsForm.ShowModal;
  15630. finally
  15631. FreeAndNil(OptionsForm);
  15632. pgcMainWorkArea.OnWebPanelButtonClick := pgcMainWorkAreaWebPanelButtonClick;
  15633. end;
  15634. end;
  15635. procedure TMainForm.pnlToolBarResize(Sender: TObject);
  15636. var
  15637. AvgWidth: Integer;
  15638. iLeft: Integer;
  15639. begin
  15640. AvgWidth := (pnlToolBar.Width - 2) div 5;
  15641. iLeft := 1;
  15642. MyContacters.Left := iLeft;
  15643. MyContacters.Width := AvgWidth;
  15644. MyContactersIcon.Left := iLeft + (AvgWidth - MyContactersIcon.Width) div 2;
  15645. iLeft := iLeft + AvgWidth;
  15646. SysMsg.Left := iLeft;
  15647. SysMsg.Width := AvgWidth;
  15648. SysMsgIcon.Left := iLeft + (AvgWidth - SysMsgIcon.Width) div 2;
  15649. iLeft := iLeft + AvgWidth;
  15650. MyFriend.Left := iLeft;
  15651. MyFriend.Width := AvgWidth;
  15652. MyFriendIcon.Left := iLeft + (AvgWidth - MyFriendIcon.Width) div 2;
  15653. iLeft := iLeft + AvgWidth;
  15654. MyTeam.Left := iLeft;
  15655. MyTeam.Width := AvgWidth;
  15656. MyTeamIcon.Left := iLeft + (AvgWidth - MyTeamIcon.Width) div 2;
  15657. iLeft := iLeft + AvgWidth;
  15658. Latests.Left := iLeft;
  15659. Latests.Width := pnlToolBar.Width - (AvgWidth * 4);
  15660. LatestsIcon.Left := iLeft + (AvgWidth - LatestsIcon.Width) div 2;
  15661. iLeft := iLeft + AvgWidth;
  15662. end;
  15663. procedure TMainForm.pnlWorkAreaClick(Sender: TObject);
  15664. begin
  15665. end;
  15666. {设置WebBrowser的样式}
  15667. //------------------------------------------------------------------------------
  15668. procedure TMainForm.SetDOMStyle(Doc: IHTMLDocument2);
  15669. var
  15670. CurrentColor, CssColor: string;
  15671. begin
  15672. try
  15673. CurrentColor := IntToHex(ConvertColorToColor(FormColor, MainForm.UIMainColor), 6);
  15674. CssColor := '#' + Copy(CurrentColor, 5, 2) + Copy(CurrentColor, 3, 2) + Copy(CurrentColor, 1, 2);
  15675. Doc.body.style.cssText := 'word-break: break-all;';
  15676. Doc.body.style.border := '0px solid';
  15677. Doc.body.style.fontFamily := '宋体';
  15678. Doc.body.style.fontSize := '9pt';
  15679. Doc.body.style.margin := '0pt';
  15680. Doc.body.setAttribute('scroll', 'no', 0);
  15681. Doc.body.style.backgroundColor := CssColor;
  15682. except
  15683. end;
  15684. end;
  15685. //------------------------------------------------------------------------------
  15686. procedure TMainForm.WebBrowserRightStatusTextChange(ASender: TObject; const Text: WideString);
  15687. var
  15688. TabSheet: TTabSheet;
  15689. begin
  15690. try
  15691. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15692. if pgcMultiWeb.ActivePage = TabSheet then
  15693. lblIEStatus.Caption := Text
  15694. else
  15695. lblIEStatus.Caption := '';
  15696. except
  15697. lblIEStatus.Caption := Text
  15698. end;
  15699. end;
  15700. //------------------------------------------------------------------------------
  15701. procedure TMainForm.WebBrowserRightTitleChange(ASender: TObject; const Text: WideString);
  15702. var
  15703. IETitle: WideString;
  15704. TabSheet: TTabSheet;
  15705. begin
  15706. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15707. IETitle := Text;
  15708. //字符串长度过长时,截短字符串并在后面显示“...”
  15709. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) > 138 do
  15710. begin
  15711. if Length(IETitle) > 3 then
  15712. begin
  15713. if Copy(IETitle, Length(IETitle) - 2, Length(IETitle)) = '...' then
  15714. IETitle := Copy(IETitle, 1, Length(IETitle) - 3);
  15715. IETitle := Copy(IETitle, 1, Length(IETitle) - 1) + '...';
  15716. end
  15717. else
  15718. begin
  15719. IETitle := '...';
  15720. end;
  15721. end;
  15722. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) < 88 do
  15723. begin
  15724. IETitle := IETitle + ' ';
  15725. end;
  15726. TabSetMuiltWeb.Tabs.Strings[TabSheet.TabIndex] := IETitle + ' ';
  15727. end;
  15728. //------------------------------------------------------------------------------
  15729. procedure TMainForm.WebBrowserRightWindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
  15730. var
  15731. TabSheet: TTabSheet;
  15732. WebBrowser: TWebBrowser;
  15733. begin
  15734. CoInitialize(nil);
  15735. try
  15736. WebBrowser := ASender as TWebBrowser;
  15737. TabSheet := (WebBrowser.Owner as TPanel).Owner as TTabSheet;
  15738. if pgcMultiWeb.PageCount > 1 then
  15739. begin
  15740. try
  15741. if WebBrowser.Busy then
  15742. WebBrowser.Stop;
  15743. except
  15744. end;
  15745. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  15746. TabSheet.PageControl := nil;
  15747. FreeAndNil(TabSheet);
  15748. end
  15749. else
  15750. begin
  15751. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15752. WebBrowser.Navigate('about:blank');
  15753. end;
  15754. finally
  15755. CoUninitialize;
  15756. Cancel := True;
  15757. end;
  15758. end;
  15759. {procedure TMainForm.WebSocketBroadCastMesssage(var msg: TMessage);
  15760. var
  15761. pdata: PBroadCastMessage;
  15762. RealICQTeamMessage: TRealICQTeamMessage;
  15763. begin
  15764. showmessage(pdata.GroupID);
  15765. RealICQTeamMessage:= TRealICQTeamMessage.Create(pdata.GroupID,pdata.Sayer,{pdata.Style}//'"宋体",9,[],[clBlack]',pdata.Msg,False);
  15766. { RealICQTeamMessage.MessageID := gettickcount();
  15767. RealICQTeamMessage.SendDateTime := pdata.timestamp;
  15768. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15769. end; }
  15770. { TODO -olqq -c : WebSocket群通讯功能 2014/12/12 9:02:40 }
  15771. procedure TMainForm.WebSocketJionTeamRequest(TeamID, ALoginName, ATag: string);
  15772. var
  15773. ATeam: TRealICQTeam;
  15774. ATeamCaption: string;
  15775. begin
  15776. ATeam := TTeamsAdapter.GetTeam(TeamID);
  15777. if ATeam <> nil then
  15778. ATeamCaption := ATeam.TeamCaption;
  15779. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ATeamCaption, TeamID]), nil);
  15780. ShowJoinTeamRequestWindow(Self, TeamID, ATeamCaption, ALoginName, ATag);
  15781. end;
  15782. procedure TMainForm.WebSocketQuitTeam(aTeamID: string);
  15783. var
  15784. iIndex: Integer;
  15785. AlertMessage: string;
  15786. ARealICQTeam: TRealICQTeam;
  15787. AForm: TForm;
  15788. begin
  15789. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15790. if iIndex >= 0 then
  15791. begin
  15792. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15793. if ARealICQTeam = nil then
  15794. Exit;
  15795. FLVTeams.Items.Delete(iIndex);
  15796. if ARealICQTeam.IsTempTeam then
  15797. AlertMessage := '您 退出了 多人对话'
  15798. else
  15799. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  15800. ShowNotifyAlertForm(AlertMessage);
  15801. AddMessageHistory(smSimple, AlertMessage, nil);
  15802. ShowNavBarNumeric;
  15803. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  15804. AForm := GetTeamTalkingForm(aTeamID);
  15805. FreeAndNil(AForm);
  15806. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  15807. UpdateTeamTalkingForm(ARealICQTeam);
  15808. end;
  15809. end;
  15810. procedure TMainForm.WebSocketRecivedbroadcastmesssage(aID, aGroupID, aSayer, aStyle, aMsg: string; aTimesTamp: TDateTime);
  15811. var
  15812. RealICQTeamMessage: TRealICQTeamMessage;
  15813. aDateTime: TDateTime;
  15814. begin
  15815. RealICQTeamMessage := TRealICQTeamMessage.Create(aGroupID, aSayer, aStyle{'"宋体",9,[],[clBlack]'}, aMsg, False);
  15816. RealICQTeamMessage.MessageID := gettickcount();
  15817. RealICQTeamMessage.SendDateTime := aTimesTamp;
  15818. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15819. end;
  15820. procedure TMainForm.WebSocketRemoveTeamResponse(aTeamID: string);
  15821. var
  15822. iIndex: Integer;
  15823. AlertMessage: string;
  15824. RealICQUser: TRealICQUser;
  15825. ARealICQTeam: TRealICQTeam;
  15826. AForm: TForm;
  15827. begin
  15828. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15829. if iIndex >= 0 then
  15830. begin
  15831. FLVTeams.Items.Delete(iIndex);
  15832. FLVTeams.ReDrawAll;
  15833. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15834. if ARealICQTeam = nil then
  15835. Exit;
  15836. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  15837. if RealICQUser = RealICQClient.Me then
  15838. AlertMessage := '您'
  15839. else if RealICQUser.DisplayName = '' then
  15840. AlertMessage := RealICQUser.LoginName
  15841. else
  15842. AlertMessage := RealICQUser.DisplayName;
  15843. if ARealICQTeam.IsTempTeam then
  15844. AlertMessage := AlertMessage + ' 解散了 多人对话'
  15845. else
  15846. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  15847. ShowNotifyAlertForm(AlertMessage);
  15848. AddMessageHistory(smSimple, AlertMessage, nil);
  15849. ShowNavBarNumeric;
  15850. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  15851. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  15852. AForm := GetTeamTalkingForm(aTeamID);
  15853. FreeAndNil(AForm);
  15854. end;
  15855. end;
  15856. procedure TMainForm.WebSocketSendReadTeamInfo(aTeamID: string);
  15857. var
  15858. iLoop, iIndex: Integer;
  15859. ListItem: TRealICQContacterListItem;
  15860. MemberList: TStringList;
  15861. ARealICQTeam: TRealICQTeam;
  15862. begin
  15863. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15864. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  15865. if iIndex = -1 then
  15866. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  15867. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  15868. if ARealICQTeam.IsTempTeam then
  15869. ListItem.Watchword := ''
  15870. else
  15871. ListItem.Watchword := ARealICQTeam.TeamIntro;
  15872. ListItem.LoginState := stLeave;
  15873. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  15874. try
  15875. for iLoop := MemberList.Count - 1 downto 0 do
  15876. begin
  15877. if Length(Trim(MemberList[iLoop])) = 0 then
  15878. MemberList.Delete(iLoop);
  15879. end;
  15880. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  15881. finally
  15882. MemberList.Free;
  15883. end;
  15884. {try
  15885. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  15886. except
  15887. ListItem.HeadImagePicture.Graphic := nil;
  15888. end; }
  15889. if ARealICQTeam.IsTempTeam then
  15890. ListItem.DisplayName := '多人对话'
  15891. else
  15892. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  15893. ListItem.Data := ARealICQTeam;
  15894. ListItem.ReDrawItem;
  15895. ShowNavBarNumeric;
  15896. UpdateTeamOptionsForm(ARealICQTeam);
  15897. UpdateTeamTalkingForm(ARealICQTeam);
  15898. end;
  15899. { TODO -olqq -c : EndWebsocket 2014/12/12 9:05:23 }
  15900. //------------------------------------------------------------------------------
  15901. procedure TMainForm.WebBrowserRightNewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
  15902. var
  15903. WebBrowser1, WebBrowser: TWebBrowser;
  15904. begin
  15905. CoInitialize(nil);
  15906. try
  15907. try
  15908. WebBrowser1 := ASender as TWebBrowser;
  15909. if WebBrowser1.Busy then
  15910. begin
  15911. Cancel := True;
  15912. Exit;
  15913. end;
  15914. WebBrowser := AddWebBrowserToPageControl('about:blank', -3);
  15915. if WebBrowser = nil then
  15916. begin
  15917. Cancel := True;
  15918. Exit;
  15919. end;
  15920. try
  15921. if (WebBrowser.Busy) then
  15922. WebBrowser.Stop;
  15923. except
  15924. end;
  15925. ppDisp := WebBrowser.ControlInterface;
  15926. except
  15927. Cancel := True;
  15928. end;
  15929. finally
  15930. CoUninitialize;
  15931. end;
  15932. end;
  15933. //------------------------------------------------------------------------------
  15934. function TMainForm.AddWebBrowserToPageControl(AUrl: string; WebPanelTag: Integer = -1): TWebBrowser;
  15935. var
  15936. TabSheet: TTabSheet;
  15937. PanelForIE: TPanel;
  15938. WebBrowser: TWebBrowser;
  15939. begin
  15940. if (WebPanelTag = -1) or (WebPanelTag = -3) or (pgcMultiWeb.PageCount <= 0) then
  15941. begin
  15942. TabSheet := TTabSheet.Create(pgcMultiWeb);
  15943. try
  15944. TabSheet.Parent := pgcMultiWeb;
  15945. TabSheet.PageControl := pgcMultiWeb;
  15946. TabSheet.DoubleBuffered := True;
  15947. PanelForIE := TPanel.Create(TabSheet);
  15948. PanelForIE.Parent := TabSheet;
  15949. PanelForIE.DoubleBuffered := True;
  15950. PanelForIE.Color := clWhite;
  15951. PanelForIE.Align := alClient;
  15952. PanelForIE.BevelInner := bvNone;
  15953. PanelForIE.BevelOuter := bvNone;
  15954. PanelForIE.Visible := True;
  15955. PanelForIE.Padding.Left := 2;
  15956. PanelForIE.Padding.Top := 2;
  15957. PanelForIE.Padding.Right := 2;
  15958. PanelForIE.Padding.Bottom := 2;
  15959. WebBrowser := TWebBrowser.Create(PanelForIE);
  15960. WebBrowser.DoubleBuffered := True;
  15961. WebBrowser.ParentWindow := PanelForIE.Handle;
  15962. WebBrowser.Align := alClient;
  15963. WebBrowser.OnStatusTextChange := WebBrowserRightStatusTextChange;
  15964. WebBrowser.OnTitleChange := WebBrowserRightTitleChange;
  15965. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15966. WebBrowser.OnNewWindow2 := WebBrowserRightNewWindow2;
  15967. WebBrowser.OnWindowClosing := WebBrowserRightWindowClosing;
  15968. WebBrowser.Tag := WebPanelTag;
  15969. PanelForIE.InsertControl(WebBrowser);
  15970. except
  15971. TabSheet.PageControl := nil;
  15972. FreeAndNil(TabSheet);
  15973. Result := nil;
  15974. Exit;
  15975. end;
  15976. TabSetMuiltWeb.Tabs.Add(AUrl + ' ');
  15977. try
  15978. TabSetMuiltWeb.TabIndex := TabSetMuiltWeb.Tabs.Count - 1;
  15979. except
  15980. end;
  15981. pgcMultiWeb.ActivePageIndex := pgcMultiWeb.PageCount - 1;
  15982. end
  15983. else
  15984. begin
  15985. TabSheet := pgcMultiWeb.Pages[0];
  15986. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  15987. WebBrowser.Tag := WebPanelTag;
  15988. TabSetMuiltWeb.Tabs.Strings[0] := (AUrl + ' ');
  15989. TabSetMuiltWeb.TabIndex := 0;
  15990. pgcMultiWeb.ActivePageIndex := 0;
  15991. end;
  15992. {
  15993. if not pnlMiddleRight.Visible then
  15994. begin
  15995. if RealICQClient.Logined and RealICQClient.Connected then
  15996. begin
  15997. ShowOrHideMuiltiWeb;
  15998. end;
  15999. end;
  16000. try
  16001. if (WebBrowser.Busy) then WebBrowser.Stop;
  16002. except
  16003. end;
  16004. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16005. //if not ((WebPanelTag = -3) and AnsiSameText(AUrl, 'about:blank')) then
  16006. try
  16007. WebBrowser.Navigate(AUrl);
  16008. except
  16009. end;
  16010. Result := WebBrowser;
  16011. }
  16012. end;
  16013. //------------------------------------------------------------------------------
  16014. {
  16015. procedure TMainForm.WebTabShow(Sender: TObject);
  16016. var
  16017. iIndex: Integer;
  16018. TabSheet: TTabSheet;
  16019. WebPanel: TWebPanel;
  16020. WebURL: String;
  16021. begin
  16022. TabSheet := Sender as TTabSheet;
  16023. //TabSheet.OnShow := nil;
  16024. iIndex := FWebTabs.IndexOf(TabSheet);
  16025. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16026. while TabSheet.ControlCount > 0 do
  16027. begin
  16028. TabSheet.Controls[0].Free;
  16029. //TabSheet.RemoveControl(TabSheet.Controls[0]);
  16030. end;
  16031. if WebPanel.NavigateType = ntGET then
  16032. begin
  16033. WebURL := WebPanel.URL;
  16034. if WebPanel.UserIMLoginName then
  16035. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', RealICQClient.LoginName)
  16036. else
  16037. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebPanel.CustomLoginName);
  16038. if WebPanel.UserIMPassword then
  16039. WebURL := AnsiReplaceText(WebURL, '[%Password%]', RealICQClient.Password)
  16040. else
  16041. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebPanel.CustomPassword);
  16042. AddWebBrowserToPageControl(WebUrl, iIndex);
  16043. end
  16044. else
  16045. AddWebBrowserToPageControl('about:blank', iIndex);
  16046. end;
  16047. }
  16048. //------------------------------------------------------------------------------
  16049. //新Post方式
  16050. procedure TMainForm.WebBrowserRightDocumentCompleteForPost(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16051. var
  16052. WebBrowser: TWebBrowser;
  16053. WebPanel: TWebPanel;
  16054. WebTabAcount: TWebTabAcount;
  16055. FieldName, ALoginName, FieldValue: string;
  16056. PostFields, Field: TStringList;
  16057. iLoop, jLoop, kLoop: Integer;
  16058. WebItem: Olevariant;
  16059. WebItemChild: Olevariant;
  16060. WebItemForm: Olevariant;
  16061. AFindedForm: Boolean;
  16062. ASubmitID: string;
  16063. begin
  16064. WebBrowser := ASender as TWebBrowser;
  16065. WebBrowser.OnDocumentComplete := nil;
  16066. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16067. if WebPanel.Acounts.Count > 0 then
  16068. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16069. else
  16070. WebTabAcount := nil;
  16071. ASubmitID := '';
  16072. ;
  16073. AFindedForm := False;
  16074. PostFields := SplitString(WebPanel.PostFields, ',');
  16075. try
  16076. for kLoop := 0 to PostFields.Count - 1 do
  16077. begin
  16078. Field := SplitStringEx(PostFields.Strings[kLoop], '=');
  16079. try
  16080. try
  16081. FieldName := Field.Strings[0];
  16082. FieldValue := Field.Strings[1];
  16083. if FieldName = 'LXTALK_SUBMIT_BTN' then
  16084. ASubmitID := FieldValue;
  16085. if WebTabAcount <> nil then
  16086. begin
  16087. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16088. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16089. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16090. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16091. end;
  16092. WebBrowser.OleObject.Document.getElementByID(FieldName).value := FieldValue;
  16093. //找到Form
  16094. if not AFindedForm then
  16095. begin
  16096. WebItem := WebBrowser.Document;
  16097. for iLoop := 0 to WebItem.Forms.length - 1 do
  16098. begin
  16099. //ShowMessage(WebItem.Forms.Item(iLoop, 0).name);
  16100. WebItemChild := WebItem.Forms.Item(iLoop, 0);
  16101. for jLoop := 0 to WebItemChild.all.length - 1 do
  16102. begin
  16103. if AnsiSameText(WebItemChild.all.item(jLoop).tagName, 'INPUT') then
  16104. begin
  16105. if AnsiSameText(WebItemChild.all.item(jLoop).name, FieldName) then
  16106. begin
  16107. AFindedForm := True;
  16108. WebItemForm := WebItemChild;
  16109. Break;
  16110. end;
  16111. //ShowMessage(WebItemChild.all.item(jLoop).tagName);
  16112. //ShowMessage(WebItemChild.all.item(jLoop).type);
  16113. //ShowMessage(WebItemChild.all.item(jLoop).name);
  16114. end;
  16115. end; //for
  16116. end; //for
  16117. end; //if
  16118. except
  16119. end;
  16120. finally
  16121. Field.Free;
  16122. end;
  16123. end;
  16124. finally
  16125. PostFields.Free;
  16126. end;
  16127. //ShowMessage(WebItemForm.Action);
  16128. //Exit;
  16129. WebItemForm.target := '_blank';
  16130. //Exit;
  16131. if ASubmitID <> '' then
  16132. begin
  16133. for jLoop := 0 to WebItemForm.all.length - 1 do
  16134. begin
  16135. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16136. begin
  16137. if AnsiSameText(WebItemForm.all.item(jLoop).name, ASubmitID) then
  16138. begin
  16139. WebItemForm.all.item(jLoop).click;
  16140. end;
  16141. end;
  16142. end;
  16143. end
  16144. else
  16145. begin
  16146. for jLoop := 0 to WebItemForm.all.length - 1 do
  16147. begin
  16148. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16149. begin
  16150. if AnsiSameText(WebItemForm.all.item(jLoop).type, 'submit') then
  16151. begin
  16152. WebItemForm.all.item(jLoop).click;
  16153. end;
  16154. end;
  16155. end;
  16156. end;
  16157. Application.ProcessMessages;
  16158. Sleep(100);
  16159. Application.ProcessMessages;
  16160. //FreeAndNil(WebBrowser);
  16161. end;
  16162. //------------------------------------------------------------------------------
  16163. //Get方式加旧版本Post方式
  16164. procedure TMainForm.WebBrowserRightDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16165. var
  16166. PanelForIE: TPanel;
  16167. WebBrowser: TWebBrowser;
  16168. WebPanel: TWebPanel;
  16169. v: Variant;
  16170. parameters: string;
  16171. OldTag, iLoop: Integer;
  16172. PostFields, Field: TStringList;
  16173. WebURL, FieldName, ALoginName, FieldValue: string;
  16174. WebTabAcount: TWebTabAcount;
  16175. SetTagAsZero: Boolean;
  16176. begin
  16177. WebBrowser := ASender as TWebBrowser;
  16178. OldTag := WebBrowser.Tag;
  16179. SetTagAsZero := True;
  16180. PanelForIE := WebBrowser.Owner as TPanel;
  16181. try
  16182. if (not PanelForIE.Visible) and (not AnsiSameText(URL, 'about:blank')) then
  16183. begin
  16184. //PanelForIE.Visible := True;
  16185. WebBrowser.OnDocumentComplete := nil;
  16186. WebBrowser.Navigate('about:blank');
  16187. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar(String(URL)),'',SW_SHOWMAXIMIZED);
  16188. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(URL)), '', SW_SHOWMAXIMIZED);
  16189. Exit;
  16190. end;
  16191. {if not AnsiSameText(URL, 'about:blank') then
  16192. begin
  16193. WebBrowser.OnDocumentComplete := nil;
  16194. with cbxURLInputer.ItemsEx.Add do
  16195. begin
  16196. Caption := URL;
  16197. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  16198. ImageIndex := 2
  16199. else if Copy(Caption, 1, 4) = 'ftp:' then
  16200. ImageIndex := 1
  16201. else
  16202. ImageIndex := 0;
  16203. end;
  16204. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  16205. if WebBrowser.Document <> nil then
  16206. begin
  16207. (WebBrowser.Application as IOleobject).DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser, 0, Handle, GetClientRect);
  16208. end;
  16209. end;}
  16210. if AnsiSameText(URL, 'about:blank') and (WebBrowser.Tag >= 0) and (TabAcountIndex >= 0) then
  16211. begin
  16212. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16213. if WebPanel.Acounts.Count > 0 then
  16214. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16215. else
  16216. WebTabAcount := nil;
  16217. WebBrowser.Tag := -1;
  16218. WebURL := WebPanel.URL;
  16219. if WebPanel.FName = '网络存储' then
  16220. begin
  16221. OpenNewWorkDisk(WebPanel.FURL);
  16222. Exit;
  16223. end;
  16224. if WebPanel.FNavigateType = ntGET then
  16225. begin
  16226. if Length(Trim(WebPanel.PostFields)) > 0 then
  16227. begin
  16228. if Pos('?', WebPanel.URL) > 0 then
  16229. WebURL := WebPanel.URL + '&' + ReplaceStr(WebPanel.PostFields, ',', '&')
  16230. else
  16231. WebURL := WebPanel.URL + '?' + ReplaceStr(WebPanel.PostFields, ',', '&');
  16232. end;
  16233. if WebTabAcount <> nil then
  16234. begin
  16235. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebTabAcount.LoginName);
  16236. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebTabAcount.Password);
  16237. WebURL := AnsiReplaceText(WebURL, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16238. WebURL := AnsiReplaceText(WebURL, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16239. WebURL := AnsiReplaceText(WebURL, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16240. WebURL := AnsiReplaceText(WebURL, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16241. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16242. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16243. end;
  16244. parameters := ALoginName + ' ' + RealICQClient.Password;
  16245. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(Trim(WebURL))), PChar(parameters), SW_SHOWMAXIMIZED);
  16246. end
  16247. else
  16248. begin
  16249. v := VarArrayCreate([0, 0], varVariant);
  16250. v[0] := '<body>' + '<form method="post" action="' + WebURL + '" target="_blank">';
  16251. PostFields := SplitString(WebPanel.PostFields, ',');
  16252. for iLoop := 0 to PostFields.Count - 1 do
  16253. begin
  16254. Field := SplitStringEx(PostFields.Strings[iLoop], '=');
  16255. try
  16256. FieldName := Field.Strings[0];
  16257. FieldValue := Field.Strings[1];
  16258. if WebTabAcount <> nil then
  16259. begin
  16260. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16261. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16262. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16263. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16264. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16265. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16266. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16267. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16268. end;
  16269. v[0] := v[0] + '<input type="hidden" ' + 'name="' + FieldName + '" ' + 'value="' + FieldValue + '">';
  16270. except
  16271. end;
  16272. Field.Free;
  16273. end;
  16274. PostFields.Free;
  16275. v[0] := v[0] + '</form>' + '</body>';
  16276. (WebBrowser.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16277. WebBrowser.oleobject.document.Forms.Item(0, 0).Submit;
  16278. end;
  16279. end;
  16280. finally
  16281. ClearMemory;
  16282. if SetTagAsZero then
  16283. WebBrowser.Tag := -1;
  16284. //pgcMainWorkArea.ActivePageIndex := 0;
  16285. end;
  16286. end;
  16287. procedure TMainForm.WebBrowserForPostWorkOrderDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16288. begin
  16289. //
  16290. { if URL='about:blank' then
  16291. begin
  16292. v := VarArrayCreate([0, 0], varVariant);
  16293. v[0] := '<body>' +
  16294. '<form method="post" action="' + WebURL + '" target="_blank">';
  16295. v[0] := v[0] +
  16296. '<input type="hidden" ' +
  16297. 'name="' + FieldName +'" ' +
  16298. 'value="'+ FieldValue + '">';
  16299. v[0] := v[0] +
  16300. '</form>' +
  16301. '</body>';
  16302. (WebBrowserForPostWorkOrder.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16303. WebBrowserForPostWorkOrder.oleobject.document.Forms.Item(0, 0).Submit;
  16304. end; }
  16305. end;
  16306. procedure TMainForm.UploadWebTabAccounts;
  16307. var
  16308. iLoop, jLoop: Integer;
  16309. WebPanel: TWebPanel;
  16310. StrTemp: string;
  16311. WebTabAcount: TWebTabAcount;
  16312. begin
  16313. StrTemp := '';
  16314. for iLoop := 0 to WebPanels.Count - 1 do
  16315. begin
  16316. WebPanel := WebPanels.Objects[iLoop] as TWebPanel;
  16317. for jLoop := 0 to WebPanel.Acounts.Count - 1 do
  16318. begin
  16319. WebTabAcount := WebPanel.Acounts[jLoop];
  16320. 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);
  16321. end;
  16322. end;
  16323. MainForm.RealICQClient.CallServerDBProcedure('SetWebTabAcounts', StrTemp);
  16324. end;
  16325. //------------------------------------------------------------------------------
  16326. procedure TMainForm.WebTabShow(Sender: TObject);
  16327. var
  16328. iIndex: Integer;
  16329. TabSheet: TTabSheet;
  16330. WebPanel: TWebPanel;
  16331. WebTabAcount: TWebTabAcount;
  16332. iLoop: Integer;
  16333. begin
  16334. if not DisplayWebs then
  16335. Exit;
  16336. TabSheet := Sender as TTabSheet;
  16337. //TabSheet.OnShow := nil;
  16338. iIndex := FWebTabs.IndexOf(TabSheet);
  16339. iIndex := TabSheet.Tag;
  16340. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16341. TabAcountIndex := 0;
  16342. if WebPanel.Acounts.Count = 0 then
  16343. begin
  16344. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  16345. begin
  16346. AddWebTabForm := TAddWebTabForm.Create(Self);
  16347. try
  16348. AddWebTabForm.NewWebPanel := True;
  16349. AddWebTabForm.Left := Mouse.CursorPos.X;
  16350. AddWebTabForm.Top := Mouse.CursorPos.Y - 20;
  16351. if Left <= AddWebTabForm.Width then
  16352. AddWebTabForm.Left := Left + Width - 10
  16353. else
  16354. AddWebTabForm.Left := Left - AddWebTabForm.Width + 10;
  16355. if (AddWebTabForm.Top + AddWebTabForm.Height) > Screen.Height then
  16356. AddWebTabForm.Top := Screen.Height - AddWebTabForm.Height;
  16357. if AddWebTabForm.ShowModal = mrOK then
  16358. begin
  16359. WebTabAcount := TWebTabAcount.Create;
  16360. WebTabAcount.WebTabID := StrToInt(WebPanel.ID);
  16361. WebTabAcount.Title := Trim(AddWebTabForm.edTitle.Text);
  16362. WebTabAcount.LoginName := AddWebTabForm.ALoginName;
  16363. WebTabAcount.Password := AddWebTabForm.APassword;
  16364. WebTabAcount.Explain := Trim(AddWebTabForm.edExplain.Text);
  16365. WebPanel.Acounts.Add(WebTabAcount);
  16366. UploadWebTabAccounts;
  16367. end
  16368. else
  16369. begin
  16370. TabAcountIndex := -1;
  16371. end;
  16372. finally
  16373. FreeAndNil(AddWebTabForm);
  16374. end;
  16375. end;
  16376. end;
  16377. OpenWebTab(TabSheet, WebPanel, TabAcountIndex);
  16378. end;
  16379. //------------------------------------------------------------------------------
  16380. procedure TMainForm.ShowOrHideMuiltiWeb;
  16381. var
  16382. OldWidth: Integer;
  16383. begin
  16384. LockWindowUpdate(GetDesktopWindow);
  16385. OldWidth := pnlMiddleClient.Width;
  16386. try
  16387. //if not pnlMiddleRight.Visible then pnlMiddleRight.Width := 680;
  16388. pnlMiddleRight.Visible := not pnlMiddleRight.Visible;
  16389. Spl.Visible := pnlMiddleRight.Visible;
  16390. if not pnlMiddleRight.Visible then
  16391. begin
  16392. Width := Width - pnlMiddleRight.Width - Spl.Width;
  16393. Spl.Align := alRight;
  16394. pnlMiddleClient.Align := alClient;
  16395. pnlMiddleRight.Align := alRight;
  16396. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  16397. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  16398. end
  16399. else
  16400. begin
  16401. // Width := Width + pnlMiddleRight.Width + Spl.Width;
  16402. Top := Screen.Height div 2 - 290;
  16403. Left := Screen.Width div 2 - 440;
  16404. Width := 880;
  16405. Height := 580;
  16406. Spl.Align := alLeft;
  16407. pnlMiddleClient.Align := alLeft;
  16408. pnlMiddleRight.Align := alClient;
  16409. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth + pnlMiddleRight.Constraints.MinWidth + Spl.Width;
  16410. pnlAll.Constraints.MaxWidth := 0;
  16411. pnlMiddleClient.Left := 0;
  16412. spl.Left := pnlMiddleClient.Left + pnlMiddleClient.Width + 1;
  16413. end;
  16414. finally
  16415. pnlMiddleClient.Width := OldWidth;
  16416. LockWindowUpdate(0);
  16417. end;
  16418. end;
  16419. //------------------------------------------------------------------------------
  16420. procedure TMainForm.actMsgManagerExecute(Sender: TObject);
  16421. begin
  16422. if MessagesManagerForm <> nil then
  16423. begin
  16424. MessagesManagerForm.BringToFront;
  16425. Exit;
  16426. end;
  16427. MessagesManagerForm := TMessagesManagerForm.Create(Application);
  16428. MessagesManagerForm.Width := Round(Screen.WorkAreaWidth * 0.95);
  16429. MessagesManagerForm.Height := Round(Screen.WorkAreaHeight * 0.95);
  16430. MessagesManagerForm.Show;
  16431. end;
  16432. //------------------------------------------------------------------------------
  16433. procedure TMainForm.RealICQClientAddedBlacklists(Sender: TObject; ALoginName: string);
  16434. var
  16435. ItemIndex: Integer;
  16436. RealICQUser: TRealICQUser;
  16437. RealICQContacterListView: TRealICQContacterListView;
  16438. RealICQContacterListItem: TRealICQContacterListItem;
  16439. begin
  16440. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  16441. if RealICQContacterListView.Items.IndexOf(ALoginName) = -1 then
  16442. begin
  16443. ItemIndex := RealICQClient.Blacklists.IndexOf(ALoginName);
  16444. RealICQUser := RealICQClient.Blacklists.Objects[ItemIndex] as TRealICQUser;
  16445. RealICQContacterListView := GetListViewByLoginName(RealICQUser.LoginName);
  16446. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  16447. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  16448. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  16449. end;
  16450. end;
  16451. procedure TMainForm.RealICQClientAddFriendRequest(Sender: TObject; ALoginName, ATag: string);
  16452. begin
  16453. AddMessageHistory(smSimple, ALoginName + ' 请求加您为好友', nil);
  16454. ShowAddFriendRequestWindow(Self, ALoginName, ATag);
  16455. end;
  16456. procedure TMainForm.RealICQClientAddFriendResponse(Sender: TObject; ALoginName, ATag: string; AAcceptted: Boolean);
  16457. var
  16458. RealICQUser: TRealICQUser;
  16459. itemIndex: Integer;
  16460. begin
  16461. if AAcceptted then
  16462. begin
  16463. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  16464. AddMessageHistory(smSimple, '您已将 ' + ALoginName + ' 添加至好友列表', nil);
  16465. FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  16466. //显示好友
  16467. // ShowGroupInterface;
  16468. ShowNotifyAlertForm('已将 ' + ALoginName + ' 添加至好友列表');
  16469. end
  16470. else
  16471. begin
  16472. if Length(ATag) = 0 then
  16473. ATag := '无';
  16474. AddMessageHistory(smSimple, ALoginName + ' 拒绝了您添加好友的请求', nil);
  16475. ShowNotifyAlertForm(ALoginName + ' 拒绝添加好友的请求' + #$D#$A + '附言:' + ATag);
  16476. end;
  16477. end;
  16478. //------------------------------------------------------------------------------
  16479. procedure TMainForm.actOpenMainFormExecute(Sender: TObject);
  16480. begin
  16481. //if FHidden then ZoomEffect(Self, zaMaximize);
  16482. Show;
  16483. ShowWindow(Handle, SW_SHOW);
  16484. ForceForeGroundWindow(Handle);
  16485. FHidden := False;
  16486. if FMainFormHidden then
  16487. begin
  16488. FDblClickedTrayIcon := True;
  16489. TimerForShowMainForm.Enabled := False;
  16490. //TimerForShowMainForm.Enabled := True;
  16491. SetForegroundWindow(TrueHiddenMainForm.Handle);
  16492. ShowMainForm;
  16493. end
  16494. else
  16495. HideMainForm;
  16496. end;
  16497. //------------------------------------------------------------------------------
  16498. procedure TMainForm.actOpenRecvFileDirExecute(Sender: TObject);
  16499. begin
  16500. ShellExecute(handle, 'open', PChar('"' + RecvFileDir + '"'), '', '', SW_SHOWNORMAL);
  16501. end;
  16502. //------------------------------------------------------------------------------
  16503. procedure TMainForm.actOptionsExecute(Sender: TObject);
  16504. begin
  16505. if OptionsForm <> nil then
  16506. Exit;
  16507. OptionsForm := TOptionsForm.Create(Self);
  16508. try
  16509. OptionsForm.ShowModal;
  16510. finally
  16511. FreeAndNil(OptionsForm);
  16512. end;
  16513. end;
  16514. //------------------------------------------------------------------------------
  16515. procedure TMainForm.actPersonalSetExecute(Sender: TObject);
  16516. var
  16517. AForm: IUIForm;
  16518. begin
  16519. // AForm := TViewManager.Current.GetView('TSettingViewForm');
  16520. // AForm.SetFormInfo('{"center":true, "unsizeable":true}');
  16521. // AForm.Show;
  16522. if OptionsForm <> nil then
  16523. Exit;
  16524. OptionsForm := TOptionsForm.Create(Self);
  16525. try
  16526. OptionsForm.PageIndex := 0;
  16527. OptionsForm.ShowModal;
  16528. finally
  16529. FreeAndNil(OptionsForm);
  16530. end;
  16531. end;
  16532. procedure TMainForm.actQuitExecute(Sender: TObject);
  16533. var
  16534. iWaitTimes: Integer;
  16535. begin
  16536. if RealICQClient.Connected then
  16537. begin
  16538. if GetTalkingFormCount > 0 then
  16539. begin
  16540. if MessageBox(Handle, '确实要退出吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  16541. Exit;
  16542. if Showing then
  16543. Close;
  16544. CloseAllTalkingForm;
  16545. iWaitTimes := 0;
  16546. while GetTalkingFormCount > 0 do
  16547. begin
  16548. Sleep(100);
  16549. Inc(iWaitTimes);
  16550. if iWaitTimes > 100 then
  16551. Break;
  16552. Application.ProcessMessages;
  16553. end;
  16554. end;
  16555. RealICQClient.Logout;
  16556. TTeamsAdapter.Stop;
  16557. end;
  16558. if Showing then
  16559. Close;
  16560. MainForm.OnClose := nil;
  16561. MainForm.Close;
  16562. TrueHiddenMainForm.Close;
  16563. end;
  16564. //------------------------------------------------------------------------------
  16565. procedure TMainForm.actConnectSetExecute(Sender: TObject);
  16566. begin
  16567. if OptionsForm <> nil then
  16568. Exit;
  16569. OptionsForm := TOptionsForm.Create(Self);
  16570. try
  16571. OptionsForm.PageIndex := 6;
  16572. OptionsForm.ShowModal;
  16573. finally
  16574. FreeAndNil(OptionsForm);
  16575. end;
  16576. end;
  16577. //------------------------------------------------------------------------------
  16578. procedure TMainForm.actCreateTeamExecute(Sender: TObject);
  16579. //var
  16580. // iLoop: Integer;
  16581. // Team: TRealICQTeam;
  16582. begin
  16583. // for iLoop := 0 to RealICQClient.Teams.Count - 1 do
  16584. // begin
  16585. // Team := RealICQClient.Teams.Objects[iLoop] as TRealICQTeam;
  16586. // if (not Team.IsTempTeam) and AnsiSameText(Team.TeamCreater, RealICQClient.LoginName) then
  16587. // begin
  16588. // MessageBox(Handle, '抱歉,您已经创建了一个群组了!', '提示', MB_ICONINFORMATION);
  16589. // Exit;
  16590. // end;
  16591. // end;
  16592. //if CreateTeamForm = nil then CreateTeamForm := TCreateTeamForm.Create(Self);
  16593. //CreateTeamForm.Show;
  16594. try
  16595. CreateTeamForm := TCreateTeamForm.Create(Self);
  16596. try
  16597. CreateTeamForm.ShowModal;
  16598. finally
  16599. FreeAndNil(CreateTeamForm);
  16600. end;
  16601. except
  16602. end;
  16603. end;
  16604. //------------------------------------------------------------------------------
  16605. procedure TMainForm.actCustomFacesManagerExecute(Sender: TObject);
  16606. begin
  16607. if CustomFacesManagerForm = nil then
  16608. CustomFacesManagerForm := TCustomFacesManagerForm.Create(Application);
  16609. CustomFacesManagerForm.Show;
  16610. end;
  16611. //------------------------------------------------------------------------------
  16612. procedure TMainForm.actAVSetExecute(Sender: TObject);
  16613. begin
  16614. WinExec(PChar('"' + ExtractFilePath(Application.ExeName) + AVSetExeFile + '" "' + ExtractFilePath(Application.ExeName) + 'Languages\' + MainForm.Language + '.ini' + '"'), SW_SHOWNORMAL);
  16615. end;
  16616. //------------------------------------------------------------------------------
  16617. procedure TMainForm.actChangePassExecute(Sender: TObject);
  16618. begin
  16619. if ChangePassForm <> nil then
  16620. Exit;
  16621. ChangePassForm := TChangePassForm.Create(Self);
  16622. try
  16623. ChangePassForm.ShowModal;
  16624. finally
  16625. FreeAndNil(ChangePassForm);
  16626. end;
  16627. end;
  16628. //------------------------------------------------------------------------------
  16629. procedure TMainForm.actCloseExecute(Sender: TObject);
  16630. begin
  16631. Close;
  16632. end;
  16633. //--------------------------------------------------------------
  16634. procedure ClearFileMissions;
  16635. var
  16636. iLoop, jLoop: Integer;
  16637. UploadMission: TUploadMission;
  16638. DownloadMission: TDownloadMission;
  16639. Missions: TStringList;
  16640. begin
  16641. for iLoop := FUploadMissions.Count - 1 downto 0 do
  16642. begin
  16643. UploadMission := FUploadMissions.Objects[iLoop] as TUploadMission;
  16644. try
  16645. FreeAndNil(UploadMission);
  16646. except
  16647. end;
  16648. end;
  16649. FUploadMissions.Clear;
  16650. for iLoop := FSavedUploadMissions.Count - 1 downto 0 do
  16651. begin
  16652. Missions := TStringList(FSavedUploadMissions[iLoop]);
  16653. for jLoop := Missions.Count - 1 downto 0 do
  16654. begin
  16655. UploadMission := Missions.Objects[jLoop] as TUploadMission;
  16656. try
  16657. FreeAndNil(UploadMission);
  16658. except
  16659. end;
  16660. end;
  16661. Missions.Clear;
  16662. FreeAndNil(Missions);
  16663. end;
  16664. FSavedUploadMissions.Clear;
  16665. for iLoop := FSavedDownloadMissions.Count - 1 downto 0 do
  16666. begin
  16667. Missions := TStringList(FSavedDownloadMissions[iLoop]);
  16668. for jLoop := Missions.Count - 1 downto 0 do
  16669. begin
  16670. DownloadMission := Missions.Objects[jLoop] as TDownloadMission;
  16671. try
  16672. FreeAndNil(DownloadMission);
  16673. except
  16674. end;
  16675. end;
  16676. Missions.Clear;
  16677. FreeAndNil(Missions);
  16678. end;
  16679. FSavedDownloadMissions.Clear;
  16680. for iLoop := FDownloadMissions.Count - 1 downto 0 do
  16681. begin
  16682. DownloadMission := FDownloadMissions.Objects[iLoop] as TDownloadMission;
  16683. try
  16684. FreeAndNil(DownloadMission);
  16685. except
  16686. end;
  16687. end;
  16688. FDownloadMissions.Clear;
  16689. end;
  16690. //---退出主程序-----------------------------------------------------
  16691. procedure TMainForm.QuitWindows;
  16692. var
  16693. iWaitTimes: Integer;
  16694. begin
  16695. RealICQClient.OnLoginFailed := nil;
  16696. if RealICQClient.Connected then
  16697. begin
  16698. if GetTalkingFormCount > 0 then
  16699. begin
  16700. if Showing then
  16701. Close;
  16702. CloseAllTalkingForm;
  16703. iWaitTimes := 0;
  16704. while GetTalkingFormCount > 0 do
  16705. begin
  16706. Sleep(100);
  16707. Inc(iWaitTimes);
  16708. if iWaitTimes > 100 then
  16709. Break;
  16710. Application.ProcessMessages;
  16711. end;
  16712. end;
  16713. RealICQClient.Logout;
  16714. end;
  16715. if Showing then
  16716. Close;
  16717. MainForm.OnClose := nil;
  16718. MainForm.Close;
  16719. TrueHiddenMainForm.Close;
  16720. end;
  16721. //-----获的天气信息--------------------------------------------------------
  16722. procedure TMainForm.GetWeather(City, Weatheren, Weather: string);
  16723. var
  16724. Data: CopyDataStruct;
  16725. Args: PChar;
  16726. weatherImgPath: string;
  16727. WeatherList: TStringList;
  16728. WeatherPanelWidth: Integer;
  16729. begin
  16730. lblWeatherCity.Caption := City;
  16731. lblWeatheren.Caption := Weatheren;
  16732. lblWeather.Caption := Weather;
  16733. weatherImgPath := ExtractFilePath(paramstr(0)) + 'Images\Weather\' + GetWeatherImgName(lblWeather.Caption);
  16734. if fileexists(weatherImgPath) then
  16735. imgWeather.Picture.LoadFromFile(weatherImgPath);
  16736. WeatherPanelWidth := lblWeatherCity.Left + lblWeatherCity.Width + 5 + imgWeather.Width + 5 + lblWeather.Width + 5 + lblWeatheren.Width;
  16737. if pnlWebSearch.Width - spbAddFriend.Left >= WeatherPanelWidth then
  16738. lblWeatherCity.Left := spbAddFriend.Left
  16739. else
  16740. lblWeatherCity.Left := btMainMenu.Left + btMainMenu.Width + 5;
  16741. imgWeather.Left := lblWeatherCity.Left + lblWeatherCity.Width + 5;
  16742. lblWeather.Left := imgWeather.Left + imgWeather.Width + 5;
  16743. lblWeatheren.Left := lblWeather.Left + lblWeather.Width + 5;
  16744. end;
  16745. procedure TMainForm.SetGetMoreUserEvent;
  16746. begin
  16747. RealICQClient.OnGettedMoreBranchList := RealICQClientGettedMoreBranchList;
  16748. RealICQClient.OnGettedMoreUserList := RealICQClientGettedMoreUserList;
  16749. if (MessageBoxForm <> nil) then
  16750. begin
  16751. FreeAndNil(MessageBoxForm);
  16752. MessageBoxForm := nil;
  16753. end;
  16754. end;
  16755. //------------------------------------------------------------------------------
  16756. procedure TMainForm.OpenWebTab(TabSheet: TTabSheet; WebPanel: TWebPanel; AcountIndex: Integer);
  16757. var
  16758. Panel, PanelForIE: TPanel;
  16759. WebBrowser: TWebBrowser;
  16760. begin
  16761. TabAcountIndex := AcountIndex;
  16762. Panel := TPanel.Create(TabSheet);
  16763. Panel.Parent := TabSheet;
  16764. Panel.DoubleBuffered := True;
  16765. Panel.Font.Color := spbDisplayName.Font.Color;
  16766. Panel.Caption := '页面加载中...';
  16767. Panel.Color := clWhite;
  16768. Panel.Align := alClient;
  16769. Panel.BevelInner := bvNone;
  16770. Panel.BevelOuter := bvNone;
  16771. Panel.Visible := True;
  16772. Application.ProcessMessages;
  16773. PanelForIE := TPanel.Create(Panel);
  16774. PanelForIE.Parent := Panel;
  16775. PanelForIE.Tag := TabSheet.Tag;
  16776. PanelForIE.DoubleBuffered := True;
  16777. PanelForIE.Color := clWhite;
  16778. PanelForIE.Align := alClient;
  16779. PanelForIE.BevelInner := bvNone;
  16780. PanelForIE.BevelOuter := bvNone;
  16781. PanelForIE.Visible := True;
  16782. Application.ProcessMessages;
  16783. WebBrowser := TWebBrowser.Create(PanelForIE);
  16784. WebBrowser.DoubleBuffered := True;
  16785. WebBrowser.ParentWindow := PanelForIE.Handle;
  16786. WebBrowser.Align := alClient;
  16787. WebBrowser.Visible := True;
  16788. WebBrowser.Tag := TabSheet.Tag;
  16789. WebBrowser.RegisterAsBrowser := True;
  16790. WebBrowser.RegisterAsDropTarget := True;
  16791. //WebBrowser.OnBeforeNavigate2 := WebBrowserRightBeforeNavigate2;
  16792. if WebPanel.FNavigateType = ntFill then
  16793. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentCompleteForPost
  16794. else
  16795. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16796. PanelForIE.InsertControl(WebBrowser);
  16797. Application.ProcessMessages;
  16798. if DisplayWebs then
  16799. begin
  16800. if WebPanel.FNavigateType = ntFill then
  16801. WebBrowser.Navigate(WebPanel.FURL)
  16802. else
  16803. WebBrowser.Navigate('about:blank');
  16804. end;
  16805. end;
  16806. //-------------------------------------------------------
  16807. procedure TMainForm.LoadMainTabImage;
  16808. begin
  16809. MyContactersIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '1.bmp');
  16810. SysMsgIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '2.bmp');
  16811. MyFriendIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '3.bmp');
  16812. MyTeamIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '4.bmp');
  16813. LatestsIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '5.bmp');
  16814. end;
  16815. //------------------------------------------------------------------------------
  16816. //下载升级配置文件
  16817. //------------------------------------------------------------------------------
  16818. procedure TMainForm.DownLoadUpdateConfig;
  16819. var
  16820. TempDir: string;
  16821. begin
  16822. TempDir := GetMyDocument + '\Update';
  16823. if not DirectoryExists(TempDir) then
  16824. ForceDirectories(TempDir);
  16825. if FileExists(GetMyDocument + '\Update\Update.dat') then
  16826. begin
  16827. SetFileAttributes(pchar(GetMyDocument + '\Update\Update.dat'), file_attribute_normal);
  16828. DeleteFile(GetMyDocument + '\Update\Update.dat');
  16829. end;
  16830. FDownFile.ThreadDownFile('http://' + MainForm.RealICQClient.RemoteAddress + '/Update/Update.dat', TempDir + '\Update.dat');
  16831. end;
  16832. //------------------------------------------------------------------------------
  16833. //文件下载完成事件处理函数
  16834. //-----------------------------------------------------------------------------=
  16835. procedure TMainForm.DownFaceFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  16836. begin
  16837. ShowGettedFace(Dest_file);
  16838. end;
  16839. procedure TMainForm.DownFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  16840. var
  16841. OldVersion, Version: string;
  16842. F: Textfile;
  16843. City, Weatheren, Weather: string;
  16844. function GetVersionFromIniFile(FileName: string): string;
  16845. var
  16846. IniFile: TIniFile;
  16847. begin
  16848. IniFile := TIniFile.Create(ExtractFilePath(paramstr(0)) + 'Update.dat');
  16849. try
  16850. OldVersion := IniFile.ReadString('Version', 'Version', '1.0.0.0');
  16851. finally
  16852. IniFile.Free;
  16853. end;
  16854. end;
  16855. begin
  16856. if FileExists(Dest_file) then
  16857. begin
  16858. if UpperCase(ExtractFileExt(Dest_file)) = '.DAT' then
  16859. begin
  16860. OldVersion := '1.0.0.0';
  16861. if FileExists(ExtractFilePath(paramstr(0)) + 'Update.dat') then
  16862. OldVersion := GetVersionFromIniFile(ExtractFilePath(paramstr(0)) + 'Update.dat');
  16863. if FileExists(GetMyDocument + '\Update\Update.dat') then
  16864. Version := GetVersionFromIniFile(GetMyDocument + '\Update\Update.dat');
  16865. if trim(OldVersion) <> trim(Version) then
  16866. WinExec('Update.exe', SW_SHOW);
  16867. end
  16868. else
  16869. begin
  16870. AssignFile(F, Dest_file);
  16871. try
  16872. Reset(F);
  16873. Readln(F, City);
  16874. Readln(F, Weatheren);
  16875. Readln(F, Weather);
  16876. GetWeather(City, Weatheren, Weather);
  16877. finally
  16878. Closefile(F); {关闭文件 F}
  16879. end;
  16880. end;
  16881. end;
  16882. end;
  16883. //------------------------------------------------------------------------------
  16884. //
  16885. //------------------------------------------------------------------------------
  16886. procedure TMainForm.RealICQClientGettedSysMsgInterfaces(Sender: TObject);
  16887. begin
  16888. //
  16889. end;
  16890. //------------------------------------------------------------------------------
  16891. function TMainForm.GetBranchName(LoginName: string): string;
  16892. var
  16893. ItemIndex: Integer;
  16894. Branch: TRealICQBranch;
  16895. Employee: TRealICQEmployee;
  16896. Node: TTreeNode;
  16897. RealICQContacterTreeView: TRealICQContacterTreeView;
  16898. begin
  16899. Result := '';
  16900. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  16901. begin
  16902. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  16903. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  16904. end
  16905. else
  16906. begin
  16907. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMyContacters);
  16908. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  16909. end;
  16910. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  16911. if (Employee = nil) then
  16912. Exit;
  16913. Node := Employee.Node.Parent;
  16914. Result := Node.Text;
  16915. while Node.Parent <> nil do
  16916. begin
  16917. Node := Node.Parent;
  16918. if Node = nil then
  16919. Break;
  16920. if Node.Parent <> nil then
  16921. Result := Node.Text + '/' + Result;
  16922. end;
  16923. end;
  16924. //------------------------------------------------------------------------------
  16925. function TMainForm.GetCompany: string;
  16926. var
  16927. iIndex: Integer;
  16928. ServerInfo: TServerInfo;
  16929. begin
  16930. Result := '';
  16931. if (FServerInfoList.IndexOf(MainForm.CurrentServerID) < 0) or (FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID) < 0) then
  16932. Exit;
  16933. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  16934. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.CurrentServerID)] as (TServerInfo)
  16935. else
  16936. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID)] as (TServerInfo);
  16937. if Assigned(ServerInfo) then
  16938. Result := ServerInfo.ServerName;
  16939. end;
  16940. //------------------------------------------------------------------------------
  16941. //用post方式提交XML文件到服务器
  16942. //------------------------------------------------------------------------------
  16943. procedure TMainForm.PostUpdateLog;
  16944. function ReadUpdateLog: string;
  16945. var
  16946. XMLFile: string;
  16947. ConfigNode: IXMLNode;
  16948. XMLDocument: TXMLDocument;
  16949. begin
  16950. Result := '';
  16951. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  16952. XMLDocument := TXMLDocument.Create(Self);
  16953. try
  16954. try
  16955. if FileExists(XMLFile) then
  16956. begin
  16957. XMLDocument.Active := True;
  16958. XMLDocument.LoadFromFile(XMLFile);
  16959. ConfigNode := XMLDocument.DocumentElement;
  16960. if ConfigNode.ChildNodes.FindNode('product').Attributes['status'] then
  16961. begin
  16962. Result := XMLDocument.XML.Text;
  16963. end;
  16964. end;
  16965. except
  16966. on E: EXception do
  16967. end;
  16968. finally
  16969. XMLDocument.Free;
  16970. end;
  16971. end;
  16972. var
  16973. XMLStr, Url: string;
  16974. begin
  16975. Url := GetUpdateLogPostUrl(ExtractFilePath(paramstr(0)) + 'Online.ini');
  16976. if Url = '' then
  16977. Url := DefaultUpdateLogPostUrl;
  16978. Url := Url + '?LoginName=' + RealICQClient.LoginName + '&DisplayName=' + HttpEncode(AnsiToUtf8(RealICQClient.Me.DisplayName)) + '&ServerName=' + HttpEncode(AnsiToUtf8(edServerList.Text));
  16979. XMLStr := ReadUpdateLog;
  16980. if XMLStr <> '' then
  16981. begin
  16982. TThreadPost.Create(Url, XMLStr);
  16983. end;
  16984. end;
  16985. //------------------------------------------------------------------------------
  16986. procedure TMainForm.UpdatePostLogState(Status: Boolean);
  16987. var
  16988. XMLFile: string;
  16989. ConfigNode: IXMLNode;
  16990. XMLDocument: TXMLDocument;
  16991. begin
  16992. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  16993. XMLDocument := TXMLDocument.Create(Self);
  16994. try
  16995. try
  16996. if FileExists(XMLFile) then
  16997. begin
  16998. XMLDocument.Active := True;
  16999. XMLDocument.LoadFromFile(XMLFile);
  17000. ConfigNode := XMLDocument.DocumentElement;
  17001. ConfigNode.ChildNodes.FindNode('product').Attributes['status'] := Status;
  17002. XMLDocument.SaveToFile(XMLFile);
  17003. end;
  17004. except
  17005. end;
  17006. finally
  17007. XMLDocument.Free;
  17008. end;
  17009. end;
  17010. constructor TThreadPost.Create(URL, Content: string);
  17011. begin
  17012. inherited Create(True);
  17013. FURL := URL;
  17014. FContent := Content;
  17015. FreeOnTerminate := True;
  17016. Resume;
  17017. end;
  17018. procedure TThreadPost.Execute;
  17019. var
  17020. IdHttp: TIdHTTP;
  17021. Sends: TStrings;
  17022. begin
  17023. IdHttp := TIdHTTP.Create(nil);
  17024. Sends := TStringList.Create;
  17025. try
  17026. IdHttp.Request.ContentType := 'application/x-www-form-urlencoded';
  17027. Sends.Add('XmlStr=' + StrToBase64(FContent));
  17028. IdHttp.Post(FUrl, Sends);
  17029. MainForm.UpdatePostLogState(False);
  17030. finally
  17031. FreeAndNil(IdHttp);
  17032. Sends.Free;
  17033. end;
  17034. end;
  17035. //---------------检测指定的进程是否运行-----------------------------------------
  17036. constructor TCheckRunProcessThread.Create(AProgramName, AProcessPath: string);
  17037. begin
  17038. inherited Create(True);
  17039. ProgramName := AProgramName;
  17040. ProcessPath := AProcessPath;
  17041. FreeOnTerminate := True;
  17042. Resume;
  17043. end;
  17044. //------------得到进程的执行路径------------------------------------------------
  17045. function TCheckRunProcessThread.GetProcessPath(ProcessID: DWORD): string;
  17046. var
  17047. Hand: THandle;
  17048. ModName: array[0..Max_Path - 1] of Char;
  17049. hMod: HModule;
  17050. n: DWORD;
  17051. begin
  17052. Result := '';
  17053. Hand := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, ProcessID);
  17054. if Hand > 0 then
  17055. try
  17056. ENumProcessModules(Hand, @hMod, Sizeof(hMod), n);
  17057. if GetModuleFileNameEx(Hand, hMod, ModName, Sizeof(ModName)) > 0 then
  17058. Result := ModName; //得到路径和文见名
  17059. except
  17060. end;
  17061. end;
  17062. //根据可执行文件名称查找进程列表,以判断程序是否正在运行。
  17063. function TCheckRunProcessThread.FindProcess(AFileName: string): boolean;
  17064. var
  17065. hSnapshot: THandle; //用于获得进程列表
  17066. lppe: TProcessEntry32; //用于查找进程
  17067. Found: Boolean; //用于判断进程遍历是否完成
  17068. ProcessPath: string;
  17069. begin
  17070. Result := False;
  17071. hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); //获得系统进程列表
  17072. lppe.dwSize := SizeOf(TProcessEntry32); //在调用Process32First API之前,需要初始化lppe记录的大小
  17073. Found := Process32First(hSnapshot, lppe); //将进程列表的第一个进程信息读入ppe记录中
  17074. while Found do
  17075. begin
  17076. ProcessPath := GetProcessPath(lppe.th32ProcessID);
  17077. if UpperCase(ProcessPath) = UpperCase(AFileName) then
  17078. begin
  17079. Result := True;
  17080. end;
  17081. Found := Process32Next(hSnapshot, lppe); //将进程列表的下一个进程信息读入lppe记录中
  17082. end;
  17083. end;
  17084. //------------------------------------------------------------------------------
  17085. procedure TCheckRunProcessThread.Execute;
  17086. begin
  17087. while FindProcess(ProcessPath) do
  17088. begin
  17089. Sleep(1000);
  17090. end;
  17091. MainForm.PostUpdateLog;
  17092. end;
  17093. procedure TMainForm.btOAClick(Sender: TObject);
  17094. begin
  17095. MessageBox(Handle, '协同办公系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17096. end;
  17097. procedure TMainForm.btSwapClick(Sender: TObject);
  17098. begin
  17099. MessageBox(Handle, '公文交换系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17100. end;
  17101. initialization
  17102. HookID := 0;
  17103. FUploadMissions := TStringList.Create;
  17104. FSavedUploadMissions := TList.Create;
  17105. FDownloadMissions := TStringList.Create;
  17106. FSavedDownloadMissions := TList.Create;
  17107. CoInitialize(nil);
  17108. OleInitialize(nil);
  17109. finalization
  17110. try
  17111. ClearFileMissions;
  17112. FreeAndNil(FSavedDownloadMissions);
  17113. FreeAndNil(FSavedUploadMissions);
  17114. FreeAndNil(FUploadMissions);
  17115. FreeAndNil(FDownloadMissions);
  17116. OleUninitialize;
  17117. CoUninitialize;
  17118. except
  17119. end;
  17120. end.