MainFrm.pas 674 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946
  1. unit MainFrm;
  2. interface
  3. {$INCLUDE LXTalk.inc}
  4. uses
  5. SingleBorderHintWindow, HardwareID, WinSvc, HttpApp, RealICQSkinFrm, MyUtils,
  6. GIFImage, MMSystem, RealICQUtils, RealICQDBHistory, Windows, Messages,
  7. SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus,
  8. ComCtrls, ExtCtrls, ImgList, Buttons, ToolWin, StdCtrls, OleCtrls, SHDocVw,
  9. MSHTML, XMLDoc, XMLIntf, StrUtils, ActiveX, ShellAPI, ActnMan, ActnList,
  10. XPStyleActnCtrls, ActnCtrls, ActnMenus, ActnColorMaps, RealICQNavigater,
  11. RealICQContacterListView, RealICQContacterTreeView, RealICQUIColor,
  12. RealICQPageControl, RealICQColors, MD5, WNDES, FileCtrl, StdActns,
  13. RealICQClient, StdStyleActnCtrls, ExtDlgs, RealICQButton, ActnPopup,
  14. CustomizeDlg, MyInputBoxFrm, RealICQSpeedButton, AppEvnts, xFonts, jpeg,
  15. DateUtils, IniFiles, RealICQMultiLanguage, Math, Types,
  16. RealICQNetWorkDiskClient, Tabs, RealICQSingleImageButton,
  17. RealICQNoBorderPageControl, ResponsionStreamTransmitter,
  18. NetWorkFileTransmitter, TransmitDirection, DESUnit, BitmapButton, Registry,
  19. PsAPI, TLHelp32, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  20. IdHTTP, QueryIpWry, RealICQHoverImage, XXTEA, AddUserFrm, AddGroupFrm,
  21. AddrBookUserFrm, ImportGuideFrm, DownloadFileFromWeb, MessageBoxFrm, aeslib,
  22. pngimage, SuperObject, EncdDecd, IdMultiPartFormData, cefvcl, RealICQModel,
  23. IdScheduler, IdSchedulerOfThread, IdSchedulerOfThreadPool;
  24. const
  25. BaseURL = '/Login.aspx?LoginName=%s&Password=%s&URL=%s';
  26. LoginURL = '';
  27. InBoxURL = ''; //'/widgets/home';
  28. ReadMessageURL = '/Messages/Default.aspx?url=';
  29. GetWeatherMessage = WM_APP + 157;
  30. DefaultUpdateLogPostUrl = 'http://360.myreda.com/Insert.aspx';
  31. MainTabImageDir = 'Images\TabImage\';
  32. SMSURL = '/Messages/SMSManage.aspx';
  33. MiniPageURL = '/Messages/MiniPage.aspx?LoginName=%s';
  34. AddRemarkURL = '/Messages/Default.aspx?url=SMSManage.aspx?url=EditMemorandum.aspx?Contents=%s';
  35. SNSHomePage = '/SNS/Login.aspx?LoginName=%s&Password=%s&DestUser=%s';
  36. ShowSNS = False;
  37. TeamSharePic: string = 'Images\Share.png';
  38. LoginingGif: string = 'Images\Logining.gif';
  39. DefaultIcon: string = 'Images\Small\DefaultIcon.ico';
  40. TeamIcon: string = 'Images\Small\Team.ico';
  41. SystemMessageIcon: string = 'Images\Small\SystemMessage.ico';
  42. SMSMessageIcon: string = 'Images\Small\SMS.ico';
  43. SNSIcon: string = 'Images\Small\SNS.ico';
  44. CancelIcon: string = 'Images\Cancel.ico';
  45. UpBMP: string = 'Images\Upload.png';
  46. DownBMP: string = 'Images\Download.png';
  47. SimpleMessagePicture: string = 'Images\SysMsg\SimpleMessage.bmp';
  48. SystemMessagePicture: string = 'Images\SysMsg\SystemMessage.bmp';
  49. TeamPicture: string = 'Images\Small\Team.bmp';
  50. SearchPicture: string = 'Images\Search.bmp';
  51. Action_Paste_GIF: string = 'Images\action_paste.png';
  52. WorldCamPicture: string = 'Images\worldCam.jpg';
  53. //VideoBorderBig: String = 'Images\VideoBorderBig.bmp';
  54. //VideoBorderMiddle: String = 'Images\VideoBorderMiddle.bmp';
  55. //VideoBorderSmall: String = 'Images\VideoBorderSmall.bmp';
  56. DefaultPictureSecurity: string = 'Images\Small\Security.bmp';
  57. DefaultPicture: string = 'Images\Small\DefaultHeadImage_96.png';
  58. DefaultPictureBig44: string = 'Images\Small\DefaultHeadImage_44.png';
  59. DefaultPictureBig: string = 'Images\Small\DefaultHeadImage_48.png';
  60. DefaultPictureMiddle: string = 'Images\Small\DefaultHeadImage_24.png';
  61. DefaultPictureSmall: string = 'Images\Small\DefaultHeadImage_16.png';
  62. DefaultPictureBigOffline: string = 'Images\Small\DefaultHeadImageOffline_48.png';
  63. DefaultPictureMiddleOffline: string = 'Images\Small\DefaultHeadImageOffline_24.png';
  64. DefaultPictureSmallOffline: string = 'Images\Small\DefaultHeadImageOffline_16.png';
  65. LeavePicture: string = 'Images\Small\Leave.bmp';
  66. CameraIcon: string = 'Images\Small\Camera.ico';
  67. CameraIconBitmap: string = 'Images\Small\Camera.bmp';
  68. SelectedItemBackgroud: string = 'Images\Small\ItemBack.bmp';
  69. AddFriendIcon: string = 'Images\Small\AddFriend.ico';
  70. TelephoneIcon: string = 'Images\Small\Telephone.ico';
  71. MobilePhoneIcon: string = 'Images\Small\MobilePhone.ico';
  72. EmailIcon: string = 'Images\Small\Email.ico';
  73. SMSIcon: string = 'Images\Small\SMS.ico';
  74. SMSBMP: string = 'Images\Small\SMS.bmp';
  75. SMSSendOK: string = 'Images\SMSSendOK.ico';
  76. SMSSending: string = 'Images\SMSSending.gif';
  77. SMSSendError: string = 'Images\SMSSendError.ico';
  78. BranchExpandedPicture: string = 'Images\OpenFolder.ico';
  79. BranchCollapsedPicture: string = 'Images\CloseFolder.ico';
  80. BranchCollapsedBMP: string = 'Images\CloseFolder.png';
  81. BranchClosedButtonPicture: string = 'Images\ClosedButton.bmp';
  82. BranchOpenedButtonPicture: string = 'Images\OpenedButton.bmp';
  83. GroupOpenedButtonPicture: string = 'Images\FriendOpenedButton.bmp';
  84. GroupClosedButtonPicture: string = 'Images\FriendClosedButton.bmp';
  85. ScrollBarBottomButtonPicture: string = 'Images\VScrollBar\ScrollBarBottomButton.bmp';
  86. ScrollBarBottomButtonDownPicture: string = 'Images\VScrollBar\ScrollBarBottomButtonDown.bmp';
  87. ScrollBarBottomButtonHoverPicture: string = 'Images\VScrollBar\ScrollBarBottomButtonHover.bmp';
  88. ScrollBarTopButtonPicture: string = 'Images\VScrollBar\ScrollBarTopButton.bmp';
  89. ScrollBarTopButtonDownPicture: string = 'Images\VScrollBar\ScrollBarTopButtonDown.bmp';
  90. ScrollBarTopButtonHoverPicture: string = 'Images\VScrollBar\ScrollBarTopButtonHover.bmp';
  91. ScrollBarTrackButtonBottomPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottom.bmp';
  92. ScrollBarTrackButtonBottomDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottomDown.bmp';
  93. ScrollBarTrackButtonBottomHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottomHover.bmp';
  94. ScrollBarTrackButtonMiddlePicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddle.bmp';
  95. ScrollBarTrackButtonMiddleDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddleDown.bmp';
  96. ScrollBarTrackButtonMiddleHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddleHover.bmp';
  97. ScrollBarTrackButtonTopPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTop.bmp';
  98. ScrollBarTrackButtonTopDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTopDown.bmp';
  99. ScrollBarTrackButtonTopHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTopHover.bmp';
  100. ScrollBackgroundPicture: string = 'Images\VScrollBar\ScrollBackground.bmp';
  101. ScrollBarButtonPicture: string = 'Images\VScrollBar\MiddleButton.bmp';
  102. ConfigXMLFilePath: string = 'XML\';
  103. UpdateLogXMLFile: string = 'Online.xml';
  104. GroupConfigXMLFile: string = 'GroupConfig.XML';
  105. StyleConfigXMLFile: string = 'StyleConfig.XML';
  106. DefaultConfigXMLFile: string = 'DefaultConfig.XML';
  107. InputConfigXMLFile: string = 'InputConfig.XML';
  108. HintAndSoundConfigXMLFile: string = 'HintAndSoundConfig.XML';
  109. ReceiveFileConfigXMLFile: string = 'ReceiveFileConfig.XML';
  110. SystemMessagesCounterXMLFile: string = 'SystemMessagesCounter.XML';
  111. SafeConfigXMLFile: string = 'SafeConfig.XML';
  112. AutoUpdateConfigXMLFile: string = 'AutoUpdateConfig.XML';
  113. WindowColorsXMLFile: string = 'WindowColors.XML';
  114. BackGroundImagesXMLFile: string = 'BackGroundImages.XML';
  115. HotKeyConfigXMLFile: string = 'HotKeyConfig.XML';
  116. WebPanelsXMLFile: string = 'WebPanels.XML';
  117. OfflineAutoResponseConfigXMLFile: string = 'OfflineAutoResponseConfig.XML';
  118. AddrBookConfig: string = 'AddrBookConfig.XML';
  119. SysMsgInterfaceConfig: string = 'SysMsgInterfaceConfig.XML';
  120. MessageHistoryDBFile: string = 'binary\History.dat';
  121. PersonalMessageHistoryDBFile: string = 'MessageHistory.DAT';
  122. FaceSmallBMP: string = '_SmallBMP';
  123. FacePreviewBMP: string = '_PreviewBMP';
  124. FaceSmallSize: Integer = 28;
  125. FacePreviewSize: Integer = 92;
  126. ShakeWindowSound: string = 'Sound\nudge.wav';
  127. //未读消息类型,未读消息集合(StringList)中的字符串值为以下常量的值时,表示为特殊的系统消息
  128. TeamMessageID: string = '_____________________________________TeamMessage_';
  129. SystemMessageID: string = '___________________________________SystemMessage_';
  130. SMSMessageID: string = '______________________________________SMSMessage_';
  131. AVSetExeFile: string = 'AVSet.EXE';
  132. HelpCHMFile: string = 'HELP.CHM';
  133. SystemFaceGroup: string = '默认表情';
  134. NOFaceCategory: string = '未分组表情';
  135. type
  136. TInvokeDLLForm = function(App: TApplication; hWnd: THandle; pCall: Pointer; AReceiver: PChar; AColor: TColor): TForm; stdcall;
  137. TWebPanel = class;
  138. TSystemMessageType = (smSimple = 1, smSystemMessage = 2);
  139. TRecvFileSafeLevel = (fsHigh = 0, fsMiddle = 1, fsLow = 2);
  140. THidePosition = (hpNone = 0, hpLeft = 1, hpTop = 2, hpRight = 3);
  141. //定义保存通讯录组和用户的数据结构
  142. TManageGroupMessage = class
  143. private
  144. MessageId: string;
  145. FGroupID: string;
  146. FParentID: string;
  147. FGroupName: string;
  148. end;
  149. TManageGroupMemberMessage = class
  150. private
  151. MessageId: string;
  152. FId: string;
  153. FDisplayName: string;
  154. FNickName: string;
  155. FMobile: string;
  156. FTel: string;
  157. FEmail: string;
  158. FRemark: string;
  159. FGroupId: string;
  160. end;
  161. TServerInfo = class
  162. private
  163. ServerId, ServerName: string;
  164. end;
  165. //检测指定的进程是否运行
  166. TCheckRunProcessThread = class(TThread)
  167. private
  168. ProgramName: string;
  169. ProcessPath: string;
  170. protected
  171. function GetProcessPath(ProcessID: DWORD): string;
  172. function FindProcess(AFileName: string): boolean;
  173. procedure Execute; override;
  174. public
  175. constructor Create(AProgramName, AProcessPath: string);
  176. end;
  177. TThreadPost = class(TThread) //以Post方式提交数据到web页面线程类。
  178. private
  179. FUrl: string;
  180. FContent: string;
  181. protected
  182. procedure Execute; override;
  183. public
  184. constructor Create(URL, Content: string); overload;
  185. end;
  186. TUploadMission = class;
  187. TNDMissionType = (mtDir, mtFile);
  188. TMainForm = class(TRealICQSkinForm)
  189. actLoginAs: TAction;
  190. actLogout: TAction;
  191. actPersonalSet: TAction;
  192. actChangePass: TAction;
  193. actClose: TAction;
  194. actOnline: TAction;
  195. actHidden: TAction;
  196. actOffline: TAction;
  197. actBusy: TAction;
  198. actMute: TAction;
  199. actLeave: TAction;
  200. actOtherState: TAction;
  201. actFindUsers: TAction;
  202. actSaveList: TAction;
  203. actLoadList: TAction;
  204. actShowBigHeadImage: TAction;
  205. actShowSmallHeadImage: TAction;
  206. actShowNormalHeadImage: TAction;
  207. actShowLoginName: TAction;
  208. actShowDisplayName: TAction;
  209. actShowAllName: TAction;
  210. actAlwaysOnTop: TAction;
  211. actMsgManager: TAction;
  212. actAVSet: TAction;
  213. actOptions: TAction;
  214. actHelp: TAction;
  215. actAbout: TAction;
  216. ImgLstPageControl: TImageList;
  217. ActionManager: TActionManager;
  218. ColorDialog: TColorDialog;
  219. actQuit: TAction;
  220. RealICQClient: TRealICQClient;
  221. actReg: TAction;
  222. actConnectSet: TAction;
  223. ppUserItemRightMenu: TPopupActionBar;
  224. actSendMessage: TAction;
  225. actDelFriend: TAction;
  226. miSendMessage: TMenuItem;
  227. N1: TMenuItem;
  228. miDelFriend: TMenuItem;
  229. actShowGroup: TAction;
  230. actGroupManager: TAction;
  231. actShowMiddleHeadImage: TAction;
  232. miGroup: TMenuItem;
  233. actRemoveUser: TAction;
  234. miRemoveUser: TMenuItem;
  235. actShowStrangers: TAction;
  236. actShowBlacklists: TAction;
  237. actShowTeams: TAction;
  238. actShowLatests: TAction;
  239. ppChangeStates: TPopupActionBar;
  240. O1: TMenuItem;
  241. H1: TMenuItem;
  242. N3: TMenuItem;
  243. N5: TMenuItem;
  244. N10: TMenuItem;
  245. ImgLstTrayIcon: TImageList;
  246. ppTrayIcon: TPopupActionBar;
  247. MenuItem12: TMenuItem;
  248. REALICQ1: TMenuItem;
  249. X1: TMenuItem;
  250. M1: TMenuItem;
  251. S1: TMenuItem;
  252. I1: TMenuItem;
  253. N19: TMenuItem;
  254. N20: TMenuItem;
  255. actOpenMainForm: TAction;
  256. TimerForCheckDblClick: TTimer;
  257. ppColors: TPopupActionBar;
  258. MenuItem18: TMenuItem;
  259. miMoreColors: TMenuItem;
  260. ImgLstColors: TImageList;
  261. pnlAll: TPanel;
  262. actSeeInformation: TAction;
  263. miSeeUserInformation: TMenuItem;
  264. N21: TMenuItem;
  265. miSkins: TMenuItem;
  266. pnlLogout: TPanel;
  267. pnlWorkArea: TPanel;
  268. pnlMiddle: TPanel;
  269. pnlClient: TPanel;
  270. TrayIcon: TTrayIcon;
  271. actShowGIFInMailForm: TAction;
  272. actShowGIFInTalkingForm: TAction;
  273. TimerForFlashTrayIcon: TTimer;
  274. ImgLstForFlashTrayIcon: TImageList;
  275. ApplicationEvents: TApplicationEvents;
  276. actCustomFacesManager: TAction;
  277. actOpenRecvFileDir: TAction;
  278. actCreateTeam: TAction;
  279. actSendTeamMessage: TAction;
  280. actSeeTeamInformation: TAction;
  281. actQuitTeam: TAction;
  282. actDisbandTeam: TAction;
  283. actQuitOrDisbandTeams: TAction;
  284. pnlAdvertisement: TPanel;
  285. pnlForWebBrowser: TPanel;
  286. WebBrowserForAdvertisement: TWebBrowser;
  287. pnlForHideWebBrowser: TPanel;
  288. TimerForShowSystemMessage: TTimer;
  289. actShowHistory: TAction;
  290. miShowHistory: TMenuItem;
  291. actShowTeamHistory: TAction;
  292. imgLogoutBK: TImage;
  293. imgLogoutBKTop: TImage;
  294. lblLoginNameTitle: TLabel;
  295. spLoginNameBorder: TShape;
  296. edLoginName: TEdit;
  297. lblLoginState: TLabel;
  298. lblPasswordTitle: TLabel;
  299. edPassword: TEdit;
  300. spPasswordBorder: TShape;
  301. lblLoginStateTitle: TLabel;
  302. spbLoginState: TRealICQSpeedButton;
  303. spbSavePassword: TRealICQSpeedButton;
  304. spbAutoLogin: TRealICQSpeedButton;
  305. lblRemoveMyLoginInfo: TLabel;
  306. lblNetworkConfig: TLabel;
  307. lblRegister: TLabel;
  308. ppLoginedUsers: TPopupActionBar;
  309. MenuItem4: TMenuItem;
  310. miClearLoginHistory: TMenuItem;
  311. ImgLstCheckStates: TImageList;
  312. ppLoginStates: TPopupActionBar;
  313. miOnline: TMenuItem;
  314. lblReConnect: TLabel;
  315. actChangeRemark: TAction;
  316. M2: TMenuItem;
  317. actShowRemark: TAction;
  318. TimerForCheckLogoutTimeout: TTimer;
  319. ImgLstForLogining: TImageList;
  320. TimerForLogining: TTimer;
  321. actShowTree: TAction;
  322. pnlWebSearch: TPanel;
  323. pnlWebSearchSplit: TPanel;
  324. ppContacterViewStyle: TPopupActionBar;
  325. Z1: TMenuItem;
  326. A1: TMenuItem;
  327. D1: TMenuItem;
  328. L1: TMenuItem;
  329. P1: TMenuItem;
  330. N22: TMenuItem;
  331. S2: TMenuItem;
  332. M3: TMenuItem;
  333. B1: TMenuItem;
  334. N23: TMenuItem;
  335. S3: TMenuItem;
  336. B2: TMenuItem;
  337. N24: TMenuItem;
  338. G1: TMenuItem;
  339. M4: TMenuItem;
  340. N25: TMenuItem;
  341. N26: TMenuItem;
  342. T1: TMenuItem;
  343. btLogin: TRealICQButton;
  344. ppLanguages: TPopupActionBar;
  345. imgLogo: TImage;
  346. TimerForHideMainForm: TTimer;
  347. TimerForShowMainForm: TTimer;
  348. RealICQNetWorkDiskClient: TRealICQNetWorkDiskClient;
  349. ppNetWorkFile: TPopupActionBar;
  350. miNDNewDir: TMenuItem;
  351. miNDDelete: TMenuItem;
  352. N28: TMenuItem;
  353. miNDRename: TMenuItem;
  354. pnlMiddleClient: TPanel;
  355. pnlMiddleRight: TPanel;
  356. Spl: TSplitter;
  357. pnlMuiltiWeb: TPanel;
  358. pnlMuiltWebStatus: TPanel;
  359. lblIEStatus: TLabel;
  360. pnlMuiltiWebToolbar: TPanel;
  361. spbPrev: TRealICQSpeedButton;
  362. spbNext: TRealICQSpeedButton;
  363. spbStop: TRealICQSpeedButton;
  364. spbRefresh: TRealICQSpeedButton;
  365. spbAddToNA: TRealICQSpeedButton;
  366. Label2: TLabel;
  367. spbGo: TRealICQSingleImageButton;
  368. cbxURLInputer: TComboBoxEx;
  369. TabSetMuiltWeb: TTabSet;
  370. shpWebStatus: TShape;
  371. shpWebLeftBorder: TShape;
  372. UploadFileOpenDialog: TOpenDialog;
  373. ppNetWorkMisson: TPopupActionBar;
  374. miNDCancel: TMenuItem;
  375. DownloadFileSaveDialog: TSaveDialog;
  376. miNDDownload: TMenuItem;
  377. pgcMultiWeb: TRealICQNoBorderPageControl;
  378. ImgLstForShowHideRight: TImageList;
  379. ImgLstForIEAddress: TImageList;
  380. spbWebClose: TRealICQSpeedButton;
  381. imgWebToolBack: TImage;
  382. shpWebRightBorder: TShape;
  383. sbpNewWebTab: TRealICQSpeedButton;
  384. Bevel5: TBevel;
  385. actOfflieAutoResponse: TAction;
  386. L3: TMenuItem;
  387. imgBottomMenu: TImage;
  388. btMainMenu: TBitmapButton;
  389. spbAddFriend: TRealICQSpeedButton;
  390. pgcMainWorkArea: TTRealICQPageControl;
  391. tsContacters: TTabSheet;
  392. tsAddrBook: TTabSheet;
  393. tsNetWorkDisk: TTabSheet;
  394. pnlAddrBook: TPanel;
  395. pnlNDStateBar: TPanel;
  396. lblNDState: TLabel;
  397. lblNDSpaceSize: TLabel;
  398. pnlNDToolBar: TPanel;
  399. imgNDToolbarBack: TImage;
  400. spbNDNewDir: TRealICQSpeedButton;
  401. spbNDDelete: TRealICQSpeedButton;
  402. spbNDMoveUp: TRealICQSpeedButton;
  403. spbNDUpload: TRealICQSpeedButton;
  404. spbNDDownload: TRealICQSpeedButton;
  405. Bevel1: TBevel;
  406. Bevel2: TBevel;
  407. spbNDConnect: TRealICQSpeedButton;
  408. Bevel4: TBevel;
  409. Bevel3: TBevel;
  410. spbNDRefresh: TRealICQSpeedButton;
  411. spbNDCancelAll: TRealICQSpeedButton;
  412. spbNDDisconnect: TRealICQSpeedButton;
  413. pnlNetWorkFiles: TPanel;
  414. shpNDDirBorder: TShape;
  415. edNDDir: TEdit;
  416. pnlNDFiles: TPanel;
  417. SplitterNDMissions: TSplitter;
  418. pnlNDMissions: TPanel;
  419. PageControlNDMission: TRealICQNoBorderPageControl;
  420. tsUploadingFiles: TTabSheet;
  421. tsDownloadingFiles: TTabSheet;
  422. TabSetNDMissions: TTabSet;
  423. pnlTop: TPanel;
  424. imgTitleBackMiddle: TImage;
  425. shpHeadBack: TShape;
  426. imgHead: TImage;
  427. imgLeave: TImage;
  428. spbDisplayName: TRealICQSpeedButton;
  429. spbWatchword: TRealICQSpeedButton;
  430. shpWatchwordBorder: TShape;
  431. imgHeadImageBorder: TImage;
  432. spbSelUIColor: TRealICQSpeedButton;
  433. spbEmail: TRealICQSpeedButton;
  434. sbpSMS: TRealICQSpeedButton;
  435. edWatchword: TEdit;
  436. WebBrowserForEMail: TWebBrowser;
  437. spbHistroyMessage: TRealICQSpeedButton;
  438. imgLstContacterPageCtrl: TImageList;
  439. edFilterKeyword: TEdit;
  440. spbContacterViewStyle: TRealICQSpeedButton;
  441. spbCancelFilter: TRealICQSpeedButton;
  442. imgWeather: TImage;
  443. ppMainMenu: TPopupActionBar;
  444. miOpenRecvFileDir: TMenuItem;
  445. miCustomFacesManager: TMenuItem;
  446. miAVSet: TMenuItem;
  447. N31: TMenuItem;
  448. miShowGroup: TMenuItem;
  449. miGroupManage: TMenuItem;
  450. N27: TMenuItem;
  451. miLoginAs: TMenuItem;
  452. miSet: TMenuItem;
  453. miLogOut: TMenuItem;
  454. miQuit: TMenuItem;
  455. lblWeather: TLabel;
  456. lblWeatheren: TLabel;
  457. shpFilterBorder: TShape;
  458. pnlToolBar: TPanel;
  459. SysMsg: TRealICQHoverImage;
  460. MyContacters: TRealICQHoverImage;
  461. MyTeam: TRealICQHoverImage;
  462. MyFriend: TRealICQHoverImage;
  463. Latests: TRealICQHoverImage;
  464. pnlSearch: TPanel;
  465. ShpLeft: TShape;
  466. ShpRight: TShape;
  467. ShpBottom: TShape;
  468. ScrollBoxSearchUser: TScrollBox;
  469. spbPersonManage: TRealICQSpeedButton;
  470. MyContactersIcon: TRealICQHoverImage;
  471. SysMsgIcon: TRealICQHoverImage;
  472. MyFriendIcon: TRealICQHoverImage;
  473. MyTeamIcon: TRealICQHoverImage;
  474. LatestsIcon: TRealICQHoverImage;
  475. lblSearchResult: TLabel;
  476. lblWeatherCity: TLabel;
  477. tsCustomerService: TTabSheet;
  478. pnlCustomerServiceStatus: TPanel;
  479. lblCustomerServiceStatus: TLabel;
  480. Panel1: TPanel;
  481. ImageForCustomerTop: TImage;
  482. btCustomerLogin: TRealICQSpeedButton;
  483. Bevel8: TBevel;
  484. btCustomerLogout: TRealICQSpeedButton;
  485. btCustomerDisplayName: TRealICQSpeedButton;
  486. ppChangeCustomerState: TPopupActionBar;
  487. MenuItem5: TMenuItem;
  488. MenuItem7: TMenuItem;
  489. MenuItem8: TMenuItem;
  490. MenuItem9: TMenuItem;
  491. MenuItem10: TMenuItem;
  492. MenuItem11: TMenuItem;
  493. MenuItem13: TMenuItem;
  494. MenuItem15: TMenuItem;
  495. MenuItem16: TMenuItem;
  496. MenuItem17: TMenuItem;
  497. MenuItem19: TMenuItem;
  498. MenuItem21: TMenuItem;
  499. MenuItem22: TMenuItem;
  500. tsCustomers: TTabSheet;
  501. pnlCustomer: TPanel;
  502. ppServerList: TPopupActionBar;
  503. MenuItem20: TMenuItem;
  504. spbTelMeeting: TRealICQSpeedButton;
  505. ppSelCallTel: TPopupActionBar;
  506. miCallMobile: TMenuItem;
  507. miCallTel: TMenuItem;
  508. miChangePwd: TMenuItem;
  509. pnlAddrBkStateBar: TPanel;
  510. imgAddrBookToolbarBack: TImage;
  511. spbAddGroupUser: TRealICQSpeedButton;
  512. spbAddGroup: TRealICQSpeedButton;
  513. spbImportGroupUser: TRealICQSpeedButton;
  514. ScrollBoxAddrBook: TScrollBox;
  515. ppAddrBookList: TPopupActionBar;
  516. miAddGroup: TMenuItem;
  517. miUpdateGroup: TMenuItem;
  518. miDelGroup: TMenuItem;
  519. miAddGroupUser: TMenuItem;
  520. miUpdateGroupUser: TMenuItem;
  521. miDelGroupUser: TMenuItem;
  522. miCut: TMenuItem;
  523. miPaste: TMenuItem;
  524. pnlForTopMessage: TPanel;
  525. ShpHint: TShape;
  526. spbShowNotReadMessage: TRealICQSpeedButton;
  527. TimerForGetBranchOnlineStates: TTimer;
  528. TimerForGetBranchUsersOnlineStates: TTimer;
  529. btPrevLog: TRealICQSpeedButton;
  530. btNextLog: TRealICQSpeedButton;
  531. lblLogs: TLabel;
  532. lblLogsTitle: TLabel;
  533. TimerForShowSystemNotices: TTimer;
  534. btShowMiniPage: TRealICQSpeedButton;
  535. miSetRemark: TMenuItem;
  536. N29: TMenuItem;
  537. miImportGroupUser: TMenuItem;
  538. miGoSpace: TMenuItem;
  539. Label3: TLabel;
  540. miManageGroup: TMenuItem;
  541. menuItemShowGroup: TMenuItem;
  542. pnlGroups: TPanel;
  543. pnlMoreUser: TPanel;
  544. ImgLoadingMoreBranchs: TImage;
  545. pnlSelectServer: TPanel;
  546. shpSearchMoreUser: TShape;
  547. spServerListBorder: TShape;
  548. spbSelectServer: TRealICQSpeedButton;
  549. spbRefreshBranchUsers: TRealICQSpeedButton;
  550. edtSearchMoreUser: TEdit;
  551. edServerList: TEdit;
  552. pnlSearchMoreUser: TPanel;
  553. ShpSearchLeft: TShape;
  554. ShpSearchRight: TShape;
  555. ShpSearchBottom: TShape;
  556. LblSearchHint: TLabel;
  557. ImgLogining: TImage;
  558. ScrollBoxSearchMoreUser: TScrollBox;
  559. ScrollBoxMoreUser: TScrollBox;
  560. pnlTeams: TPanel;
  561. spbFindTeam: TRealICQSpeedButton;
  562. spbCreateTeam: TRealICQSpeedButton;
  563. pnlTemp: TPanel;
  564. ScrollBoxContacters: TScrollBox;
  565. ScrollBoxLatests: TScrollBox;
  566. ScrollBoxMyFriend: TScrollBox;
  567. ScrollBoxTeam: TScrollBox;
  568. spbNetworkBackup: TRealICQSpeedButton;
  569. TimerForHideUserCard: TTimer;
  570. TimerForShowUserCard: TTimer;
  571. RealICQHoverImage1: TRealICQHoverImage;
  572. ImageListForStatBig: TImageList;
  573. ImageListForStatSmall: TImageList;
  574. M5: TMenuItem;
  575. actPhone: TAction;
  576. actRepast: TAction;
  577. actMeeting: TAction;
  578. N6: TMenuItem;
  579. N7: TMenuItem;
  580. N8: TMenuItem;
  581. miLeave: TMenuItem;
  582. miBusy: TMenuItem;
  583. miMute: TMenuItem;
  584. miHidden: TMenuItem;
  585. N9: TMenuItem;
  586. N11: TMenuItem;
  587. N12: TMenuItem;
  588. N13: TMenuItem;
  589. N14: TMenuItem;
  590. N15: TMenuItem;
  591. N16: TMenuItem;
  592. N17: TMenuItem;
  593. N18: TMenuItem;
  594. spb360Safe: TRealICQSpeedButton;
  595. spbChangeLoginName: TRealICQSpeedButton;
  596. spbWinMeet: TRealICQSpeedButton;
  597. ppTeamListView: TPopupActionBar;
  598. MenuItem1: TMenuItem;
  599. MenuItem2: TMenuItem;
  600. H3: TMenuItem;
  601. miSendTeamSMS: TMenuItem;
  602. MenuItem3: TMenuItem;
  603. X2: TMenuItem;
  604. R1: TMenuItem;
  605. Q1: TMenuItem;
  606. spb360SD: TRealICQSpeedButton;
  607. WebBrowserForPostWorkOrder: TWebBrowser;
  608. pnlLocked: TPanel;
  609. shp_lock_client: TShape;
  610. img_lock_headimage_border: TImage;
  611. img_lock_HeadPrev: TImage;
  612. img_lockback_top: TImage;
  613. btn_unlock: TRealICQSpeedButton;
  614. btn_lock_DisplayName: TRealICQSpeedButton;
  615. btn_lock: TMenuItem;
  616. miExportGroupUser: TMenuItem;
  617. SD: TSaveDialog;
  618. TimerForreconnectgroup: TTimer;
  619. Image1: TImage;
  620. btnCALogin: TRealICQSpeedButton;
  621. chrmAppCentre: TChromium;
  622. spblock: TRealICQSpeedButton;
  623. procedure SysMsgIconClick(Sender: TObject);
  624. procedure TimerForreconnectgroupTimer(Sender: TObject);
  625. procedure pnlWorkAreaClick(Sender: TObject);
  626. procedure spbExportGroupUserClick(Sender: TObject);
  627. procedure btn_unlockClick(Sender: TObject);
  628. procedure btn_lockClick(Sender: TObject);
  629. procedure WebBrowserForPostWorkOrderDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  630. procedure spb360SDClick(Sender: TObject);
  631. procedure miSendTeamSMSClick(Sender: TObject);
  632. procedure spbWinMeetClick(Sender: TObject);
  633. procedure RealICQClientGettedSendOfflineFileRequest(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  634. procedure spb360SafeClick(Sender: TObject);
  635. procedure RealICQClientGettedPermission(Sender: TObject);
  636. procedure miMuteClick(Sender: TObject);
  637. procedure miBusyClick(Sender: TObject);
  638. procedure miLeaveClick(Sender: TObject);
  639. procedure imgHeadImageBorderMouseLeave(Sender: TObject);
  640. procedure imgHeadImageBorderMouseEnter(Sender: TObject);
  641. procedure pnlToolBarResize(Sender: TObject);
  642. procedure TimerForShowUserCardTimer(Sender: TObject);
  643. procedure TimerForHideUserCardTimer(Sender: TObject);
  644. procedure spbNetworkBackupClick(Sender: TObject);
  645. procedure tsContactersResize(Sender: TObject);
  646. procedure tsContactersShow(Sender: TObject);
  647. procedure RealICQClientReceivedVideoImage(Sender: TObject; ALoginName: string; ABitmap: TBitmap);
  648. procedure spbRefreshBranchUsersClick(Sender: TObject);
  649. procedure RealICQClientChangePasswordResult(Sender: TObject; APassChanged: Boolean; ANewPassword: string);
  650. procedure RealICQClientGetDBProcedureResult(Sender: TObject; DBProcedureName, ArgIn, ArgOut: string);
  651. procedure miGoSpaceClick(Sender: TObject);
  652. procedure miSetRemarkClick(Sender: TObject);
  653. procedure btShowMiniPageClick(Sender: TObject);
  654. procedure RealICQClientGettedMiniPageSets(Sender: TObject);
  655. procedure spbShowNotReadMessageClick(Sender: TObject);
  656. procedure lblLogsClick(Sender: TObject);
  657. procedure TimerForShowSystemNoticesTimer(Sender: TObject);
  658. procedure lblLogsMouseLeave(Sender: TObject);
  659. procedure lblLogsMouseEnter(Sender: TObject);
  660. procedure btNextLogClick(Sender: TObject);
  661. procedure btPrevLogClick(Sender: TObject);
  662. procedure RealICQClientGetSystemNoticesCount(Sender: TObject; iCount: Integer; NoticesRecords: array of TSystemNotices);
  663. procedure RealICQClientGetNotReadMessageCount(Sender: TObject; iCount: Integer);
  664. procedure TimerForGetBranchUsersOnlineStatesTimer(Sender: TObject);
  665. procedure TimerForGetBranchOnlineStatesTimer(Sender: TObject);
  666. procedure TrayIconMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  667. procedure RealICQClientGettedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  668. procedure LblHintClick(Sender: TObject);
  669. procedure btCloseTopMessageClick(Sender: TObject);
  670. procedure spbImportGroupUserClick(Sender: TObject);
  671. procedure miPasteClick(Sender: TObject);
  672. procedure miCutClick(Sender: TObject);
  673. procedure miDelGroupUserClick(Sender: TObject);
  674. procedure miUpdateGroupUserClick(Sender: TObject);
  675. procedure miAddGroupUserClick(Sender: TObject);
  676. procedure miDelGroupClick(Sender: TObject);
  677. procedure miUpdateGroupClick(Sender: TObject);
  678. procedure miAddGroupClick(Sender: TObject);
  679. procedure ppAddrBookListPopup(Sender: TObject);
  680. procedure ppAddrBookListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  681. procedure RealICQClientGettedSendFolderRequest(Sender: TObject; AID, ACount: Cardinal; ALoginName: string; AFilesStream: TStream);
  682. procedure RealICQClientCanceledSendFolder(Sender: TObject; AID: Cardinal; ALoginName: string);
  683. procedure RealICQClientGettedBranchUser(Sender: TObject);
  684. procedure ppSelCallTelGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  685. procedure tsCustomerServiceContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
  686. procedure RealICQClientSearchUserResult(Sender: TObject);
  687. procedure edtSearchMoreUserChange(Sender: TObject);
  688. procedure edtSearchMoreUserExit(Sender: TObject);
  689. procedure edtSearchMoreUserClick(Sender: TObject);
  690. procedure spbTelMeetingClick(Sender: TObject);
  691. procedure RealICQClientGettedWebUrl(Sender: TObject);
  692. procedure RealICQClientReceivedServerList(Sender: TObject; AServerList: string);
  693. procedure spbSelectServerClick(Sender: TObject);
  694. procedure MeasureItem(Sender: TObject; ACanvas: TCanvas; var Width, Height: Integer);
  695. procedure ppServerListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  696. procedure RealICQClientGettedMoreUserList(Sender: TObject);
  697. procedure RealICQClientGettedMoreBranchList(Sender: TObject);
  698. procedure ppChangeCustomerStateGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  699. procedure btCustomerDisplayNameClick(Sender: TObject);
  700. procedure btCustomerLogoutClick(Sender: TObject);
  701. procedure spbPersonManageClick(Sender: TObject);
  702. procedure edFilterKeywordClick(Sender: TObject);
  703. procedure ImageButtonEnter(Sender: TObject);
  704. procedure ImageButtonLeave(Sender: TObject);
  705. procedure ImageButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  706. procedure pgcMainWorkAreaWebPanelButtonClick(Sender: TObject);
  707. procedure ppMainMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  708. procedure btMainMenuClick(Sender: TObject);
  709. procedure tsAddrBookShow(Sender: TObject);
  710. procedure WebBrowserAddrBookDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  711. procedure WebBrowserAddrBookBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  712. procedure RealICQClientGettedCancelRemoteControlTransmite(Sender: TObject; ALoginName: string);
  713. procedure RealICQClientCancelControlRemoteControlTransmite(Sender: TObject; ALoginName: string);
  714. procedure RealICQClientSendedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  715. procedure RealICQClientSendedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  716. procedure RealICQClientGettedStopRemoteControlTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  717. procedure RealICQClientGettedRemoteControlTransmiteScreenSize(Sender: TObject; ALoginName: string; AWidth, AHeight: Integer);
  718. procedure RealICQClientGettedRemoteControlTransmiteScreenImage(Sender: TObject; ALoginName: string; ALeft, ATop, AWidth, AHeight: Integer; AP: TPoint; ABitmap: TBitmap);
  719. procedure RealICQClientGettedRemoteControlTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  720. procedure RealICQClientGettedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  721. procedure RealICQClientGettedRemoteControlTransmiteControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  722. procedure RealICQClientGettedRemoteControlTransmiteConnectted(Sender: TObject; ALoginName: string);
  723. procedure RealICQClientGettedRemoteControlTransmiteBeControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  724. procedure RealICQClientReceivedOfflineFile(Sender: TObject; ASender, AFileName: string; AFileSize: Int64; ASendDateTime: TDateTime);
  725. procedure TimerForLoginingTimer(Sender: TObject);
  726. procedure TimerForCheckLogoutTimeoutTimer(Sender: TObject);
  727. procedure actShowRemarkExecute(Sender: TObject);
  728. procedure actChangeRemarkExecute(Sender: TObject);
  729. procedure actHelpExecute(Sender: TObject);
  730. procedure actAboutExecute(Sender: TObject);
  731. procedure lblReConnectClick(Sender: TObject);
  732. procedure spbAutoLoginClick(Sender: TObject);
  733. procedure spbSavePasswordClick(Sender: TObject);
  734. procedure miOtherStateClick(Sender: TObject);
  735. procedure miMeetingClick(Sender: TObject);
  736. procedure miHiddenClick(Sender: TObject);
  737. procedure miOnlineClick(Sender: TObject);
  738. procedure ppLoginStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  739. procedure ppChangeStatesPopup(Sender: TObject);
  740. procedure spbLoginStateClick(Sender: TObject);
  741. procedure miClearLoginHistoryClick(Sender: TObject);
  742. procedure spbChangeLoginNameClick(Sender: TObject);
  743. procedure ppLoginedUsersPopup(Sender: TObject);
  744. procedure ppLoginedUsersGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  745. procedure edLoginNameChange(Sender: TObject);
  746. procedure lblRegisterMouseLeave(Sender: TObject);
  747. procedure lblRegisterMouseEnter(Sender: TObject);
  748. procedure actShowTeamHistoryExecute(Sender: TObject);
  749. procedure actShowHistoryExecute(Sender: TObject);
  750. procedure actAVSetExecute(Sender: TObject);
  751. procedure actMsgManagerExecute(Sender: TObject);
  752. procedure WebBrowserForAdvertisementBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  753. procedure RealICQClientReceivedSystemMessage(Sender: TObject; ASystemMessage: TRealICQSystemMessage);
  754. procedure TimerForShowSystemMessageTimer(Sender: TObject);
  755. procedure RealICQClientReceivedAdversement(Sender: TObject);
  756. procedure WebBrowserForAdvertisementDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  757. procedure RealICQClientDownloadTeamFace(Sender: TObject; AFileName: string);
  758. procedure RealICQClientPleaseUploadTeamFace(Sender: TObject; MD5String: string; var FileName: string);
  759. procedure RealICQClientReceivedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  760. procedure RealICQClientSendTeamMessageFailed(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  761. procedure RealICQClientSendedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  762. procedure RealICQClientJoinTeamResponse(Sender: TObject; ATeamID: string; ALoginName: string; ATag: string; AAcceptted: Boolean);
  763. procedure RealICQClientJoinTeamRequest(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName, ATag: string);
  764. procedure spbFindTeamClick(Sender: TObject);
  765. procedure RealICQClientTeamQuitted(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName: string);
  766. procedure RealICQClientTeamDisbanded(Sender: TObject; ARealICQTeam: TRealICQTeam);
  767. procedure actQuitOrDisbandTeamsExecute(Sender: TObject);
  768. procedure ppTeamListViewPopup(Sender: TObject);
  769. procedure ppTeamListViewGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  770. procedure actDisbandTeamExecute(Sender: TObject);
  771. procedure actQuitTeamExecute(Sender: TObject);
  772. procedure actSeeTeamInformationExecute(Sender: TObject);
  773. procedure actSendTeamMessageExecute(Sender: TObject);
  774. procedure RealICQClientJoinedTeam(Sender: TObject; ARealICQTeam: TRealICQTeam);
  775. procedure RealICQClientTeamInfoReady(Sender: TObject; ARealICQTeam: TRealICQTeam);
  776. procedure actCreateTeamExecute(Sender: TObject);
  777. procedure RealICQClientGettedCancelVideoTransmite(Sender: TObject; ALoginName: string);
  778. procedure RealICQClientGettedStopVideoTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  779. procedure RealICQClientSendedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  780. procedure RealICQClientGettedVideoTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  781. procedure RealICQClientGettedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  782. procedure RealICQClientGettedVideoTransmiteConnectted(Sender: TObject; ALoginName: string; ASendBigBmp, ARecvBigBmp: Boolean);
  783. procedure RealICQClientGettedAudioTransmiteConnectted(Sender: TObject; ALoginName: string);
  784. procedure RealICQClientGettedStopAudioTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  785. procedure RealICQClientGettedCancelAudioTransmite(Sender: TObject; ALoginName: string);
  786. procedure RealICQClientGettedAudioTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  787. procedure RealICQClientGettedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  788. procedure RealICQClientSendedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  789. procedure RealICQClientInputting(Sender: TObject; ALoginName: string; AInputting: Boolean);
  790. procedure actOpenRecvFileDirExecute(Sender: TObject);
  791. procedure actCustomFacesManagerExecute(Sender: TObject);
  792. procedure RealICQClientPleaseSendFaceToMe(Sender: TObject; ALoginName, AFaceMD5Code: string);
  793. procedure RealICQClientCancelSendFile(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  794. procedure RealICQClientSendedSendFileRequest(Sender, FileTransmitter: TObject);
  795. procedure RealICQClientGettedSendFileRequest(Sender: TObject; SendFileRequestInfo: TSendFileRequestInfo);
  796. procedure ApplicationEventsException(Sender: TObject; E: Exception);
  797. procedure RealICQClientDisconnected(Sender: TObject);
  798. procedure TimerForFlashTrayIconTimer(Sender: TObject);
  799. procedure RealICQClientReceivedMessage(Sender: TObject; RealICQMessage: TRealICQMessage);
  800. procedure RealICQClientSendMessageFailed(Sender: TObject; RealICQMessage: TRealICQMessage);
  801. procedure FormShow(Sender: TObject);
  802. procedure actShowGIFInTalkingFormExecute(Sender: TObject);
  803. procedure actShowGIFInMailFormExecute(Sender: TObject);
  804. procedure RealICQClientUserExInformationChanged(Sender: TObject; RealICQUser: TRealICQUser);
  805. procedure actSendMessageExecute(Sender: TObject);
  806. procedure RealICQClientDownloadFile(Sender: TObject; AFileName: string);
  807. procedure RealICQClientGetWebTabs(Sender: TObject; ATabCount: Integer; WebTabRecords: array of TWebTabRecord);
  808. procedure spbCancelFilterClick(Sender: TObject);
  809. procedure edFilterKeywordChange(Sender: TObject);
  810. procedure edFilterKeywordExit(Sender: TObject);
  811. procedure actSeeInformationExecute(Sender: TObject);
  812. procedure ppColorsPopup(Sender: TObject);
  813. procedure miMoreColorsClick(Sender: TObject);
  814. procedure ppColorsGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  815. procedure TrayIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  816. procedure actCloseExecute(Sender: TObject);
  817. procedure TrayIconClick(Sender: TObject);
  818. procedure TimerForCheckDblClickTimer(Sender: TObject);
  819. procedure ppTrayIconGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  820. procedure TrayIconDblClick(Sender: TObject);
  821. procedure actOpenMainFormExecute(Sender: TObject);
  822. procedure actQuitExecute(Sender: TObject);
  823. procedure FormResize(Sender: TObject);
  824. procedure ppChangeStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  825. procedure spbDisplayNameClick(Sender: TObject);
  826. procedure actAlwaysOnTopExecute(Sender: TObject);
  827. procedure actShowLatestsExecute(Sender: TObject);
  828. procedure actShowTeamsExecute(Sender: TObject);
  829. procedure actShowBlacklistsExecute(Sender: TObject);
  830. procedure actShowStrangersExecute(Sender: TObject);
  831. procedure actRemoveUserExecute(Sender: TObject);
  832. procedure RealICQClientAddedBlacklists(Sender: TObject; ALoginName: string);
  833. procedure RealICQClientGettedBlacklists(Sender: TObject);
  834. procedure actGroupManagerExecute(Sender: TObject);
  835. procedure actShowMiddleHeadImageExecute(Sender: TObject);
  836. procedure actShowGroupExecute(Sender: TObject);
  837. procedure RealICQClientRemovedUser(Sender: TObject; ALoginName: string);
  838. procedure ppUserItemRightMenuPopup(Sender: TObject);
  839. procedure ppUserItemRightMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  840. procedure actDelFriendExecute(Sender: TObject);
  841. procedure RealICQClientReConnectExecute(Sender: TObject; ASeconds: Integer);
  842. procedure btLoginClick(Sender: TObject);
  843. procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  844. procedure spbSelUIColorClick(Sender: TObject);
  845. procedure FormDestroy(Sender: TObject);
  846. procedure FormCreate(Sender: TObject);
  847. procedure RealICQClientLoginResult(Sender: TObject; LoginResultType: TRealICQLoginResultType; ResultMessage: string);
  848. procedure actLoginExecute(Sender: TObject);
  849. procedure actLogoutExecute(Sender: TObject);
  850. procedure actLoginAsExecute(Sender: TObject);
  851. procedure RealICQClientLoginStateChanged(Sender: TObject);
  852. procedure FormClose(Sender: TObject; var Action: TCloseAction);
  853. procedure RealICQClientGettedFriendList(Sender: TObject);
  854. procedure RealICQClientUserInformationReady(Sender: TObject; RealICQUser: TRealICQUser);
  855. procedure actOnlineExecute(Sender: TObject);
  856. procedure actHiddenExecute(Sender: TObject);
  857. procedure actLeaveExecute(Sender: TObject);
  858. procedure actOtherStateExecute(Sender: TObject);
  859. procedure RealICQClientBeDropped(Sender: TObject; Excuse: string);
  860. procedure RealICQClientLoginFailed(Sender: TObject; E: Exception);
  861. procedure actRegExecute(Sender: TObject);
  862. procedure actShowLoginNameExecute(Sender: TObject);
  863. procedure actShowDisplayNameExecute(Sender: TObject);
  864. procedure actShowAllNameExecute(Sender: TObject);
  865. procedure actShowBigHeadImageExecute(Sender: TObject);
  866. procedure actShowSmallHeadImageExecute(Sender: TObject);
  867. procedure actShowNormalHeadImageExecute(Sender: TObject);
  868. procedure actFindUsersExecute(Sender: TObject);
  869. procedure RealICQClientAddFriendRequest(Sender: TObject; ALoginName, ATag: string);
  870. procedure RealICQClientAddFriendResponse(Sender: TObject; ALoginName, ATag: string; AAcceptted: Boolean);
  871. procedure actOptionsExecute(Sender: TObject);
  872. procedure actPersonalSetExecute(Sender: TObject);
  873. procedure actConnectSetExecute(Sender: TObject);
  874. procedure actChangePassExecute(Sender: TObject);
  875. procedure actShowTreeExecute(Sender: TObject);
  876. procedure edWebSearchKeyWordEnter(Sender: TObject);
  877. procedure edWebSearchKeyWordExit(Sender: TObject);
  878. procedure spbWebSearchClick(Sender: TObject);
  879. procedure edWebSearchKeyWordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  880. procedure RealICQClientShakeWindow(Sender: TObject; ALoginName: string);
  881. procedure ppContacterViewStyleGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  882. procedure spbContacterViewStyleClick(Sender: TObject);
  883. procedure spbWatchwordClick(Sender: TObject);
  884. procedure edWatchwordExit(Sender: TObject);
  885. procedure edWatchwordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  886. procedure ApplicationEventsDeactivate(Sender: TObject);
  887. procedure ppLanguagesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  888. procedure ppLanguagesPopup(Sender: TObject);
  889. procedure spbSelLanguageClick(Sender: TObject);
  890. procedure edPasswordEnter(Sender: TObject);
  891. procedure TimerForHideMainFormTimer(Sender: TObject);
  892. procedure TimerForShowMainFormTimer(Sender: TObject);
  893. procedure FormDeactivate(Sender: TObject);
  894. procedure sbpSMSClick(Sender: TObject);
  895. procedure RealICQClientSMSResult(Sender: TObject; AMessageID: Cardinal; AResult: Integer);
  896. procedure RealICQClientReceivedSMS(Sender: TObject; ASMSSender, ASMSContent: string; ASMSDateTime: TDateTime);
  897. procedure RealICQClientReceivedCustomMessage(Sender: TObject; AContent: string);
  898. procedure spbEmailClick(Sender: TObject);
  899. procedure tsNetWorkDiskShow(Sender: TObject);
  900. procedure RealICQNetWorkDiskClientConnectStateChanged(Sender: TObject);
  901. procedure RealICQNetWorkDiskClientLoginFailed(Sender: TObject; E: Exception);
  902. procedure RealICQNetWorkDiskClientLoginResult(Sender: TObject; LoginResultType: Byte);
  903. procedure spbNDConnectClick(Sender: TObject);
  904. procedure RealICQNetWorkDiskClientDirectoryListReady(Sender: TObject);
  905. procedure spbNDMoveUpClick(Sender: TObject);
  906. procedure spbNDNewDirClick(Sender: TObject);
  907. procedure RealICQNetWorkDiskClientNewDirResult(Sender: TObject; Directory: TRealICQNetWorkDiskDirectory);
  908. procedure ppNetWorkFileGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  909. procedure ppNetWorkFilePopup(Sender: TObject);
  910. procedure spbNDDeleteClick(Sender: TObject);
  911. procedure miNDRenameClick(Sender: TObject);
  912. procedure RealICQNetWorkDiskClientRenamedDir(Sender: TObject; ADirectory: TRealICQNetWorkDiskDirectory);
  913. procedure RealICQNetWorkDiskClientRenamedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile);
  914. procedure RealICQNetWorkDiskClientDeleteResult(Sender: TObject; AList: string);
  915. procedure spbNDRefreshClick(Sender: TObject);
  916. procedure spbNDUploadClick(Sender: TObject);
  917. procedure RealICQNetWorkDiskClientUploadedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile; AMissionID: string);
  918. procedure TabSetNDMissionsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
  919. procedure TabSetNDMissionsClick(Sender: TObject);
  920. procedure RealICQNetWorkDiskClientUploadFileAborted(Sender: TObject; AMissionID: string);
  921. procedure RealICQNetWorkDiskClientUploadingFile(Sender: TObject; ATransmitter: TResponsionStreamTransmitter; ATransmittedSize: Int64);
  922. procedure ppNetWorkMissonGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  923. procedure ppNetWorkMissonPopup(Sender: TObject);
  924. procedure miNDCancelClick(Sender: TObject);
  925. procedure RealICQNetWorkDiskClientGettedUsedSpaceSize(Sender: TObject);
  926. procedure spbNDCancelAllClick(Sender: TObject);
  927. procedure RealICQNetWorkDiskClientNoSpace(Sender: TObject);
  928. procedure spbNDDisconnectClick(Sender: TObject);
  929. procedure RealICQNetWorkDiskClientDownloadFileAborted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  930. procedure RealICQNetWorkDiskClientDownloadFileCompleted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  931. procedure spbNDDownloadClick(Sender: TObject);
  932. procedure RealICQNetWorkDiskClientDownloadFileTransmitting(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  933. procedure pgcMainWorkAreaTabChanging(Sender: TObject; NewIndex: Integer; var AllowChanged: Boolean);
  934. procedure TabSetMuiltWebClick(Sender: TObject);
  935. procedure spbShowHideRightClick(Sender: TObject);
  936. procedure cbxURLInputerDropDown(Sender: TObject);
  937. procedure spbGoClick(Sender: TObject);
  938. procedure cbxURLInputerKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  939. procedure cbxURLInputerSelect(Sender: TObject);
  940. procedure spbPrevClick(Sender: TObject);
  941. procedure spbStopClick(Sender: TObject);
  942. procedure spbNextClick(Sender: TObject);
  943. procedure spbRefreshClick(Sender: TObject);
  944. procedure spbAddToNAClick(Sender: TObject);
  945. procedure spbPrintPrevClick(Sender: TObject);
  946. procedure spbWebCloseClick(Sender: TObject);
  947. procedure sbpNewWebTabClick(Sender: TObject);
  948. procedure TabSetMuiltWebGetImageIndex(Sender: TObject; TabIndex: Integer; var ImageIndex: Integer);
  949. procedure ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean);
  950. procedure RealICQClientReceivedOfflineAutoResponseSet(Sender: TObject; AEnabled: Boolean; AText: string);
  951. procedure actOfflieAutoResponseExecute(Sender: TObject);
  952. procedure RealICQClientUsersBranchReady(Sender: TObject);
  953. procedure WebBrowserForContactersBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  954. procedure RealICQClientGettedSysMsgInterfaces(Sender: TObject);
  955. procedure RealICQClientGettedCanSendSMSCount(Sender: TObject);
  956. procedure ImgQrCodeClick(Sender: TObject);
  957. procedure SysMsgClick(Sender: TObject);
  958. procedure btnCALoginClick(Sender: TObject);
  959. procedure btOAClick(Sender: TObject);
  960. procedure btSwapClick(Sender: TObject);
  961. private
  962. FIsLogout: Boolean;
  963. FLastGetSystemNoticesTicket: Cardinal;
  964. FSystemNoticeIndex: Integer;
  965. FSystemNotices: TList;
  966. FNotAddedEmployeeList: TStringList;
  967. procedure ShowBranchAndUsers(ExpandSelfNode: Boolean = False);
  968. procedure ShowBranchAndFriends;
  969. procedure GetOtherBranchs;
  970. procedure GetBranchUser(Branch: TRealICQBranch);
  971. procedure ShowSystemNotices;
  972. procedure OpenNewWorkDisk(Path: string);
  973. private
  974. FCurrentServerID: string;
  975. FTopSystemMessage: TRealICQSystemMessage;
  976. FServerInfoList: TStringList;
  977. FWebPanels: TStringList;
  978. FAutoHide: Boolean;
  979. FAutoShowRequestMessage: Boolean;
  980. FMovingMainForm: Boolean;
  981. FDblClickedTrayIcon: Boolean;
  982. FMainFormHidden: Boolean;
  983. FHidePosition: THidePosition;
  984. FConfirmReplaceResult: Integer;
  985. FLastDownloadDirectory: string;
  986. FAddrBookURL: string;
  987. // FPCAMessage:TPCAMessage;
  988. FGroupAddress: string;
  989. FGroupPort: Integer;
  990. FGroupImagePort: Integer;
  991. FGroupShareAddress: string;
  992. FGroupSharePort: Integer;
  993. procedure PostUpdateLog;
  994. procedure GetWeather(City, Weatheren, Weather: string);
  995. procedure WMMoving(var Msg: TMessage); message WM_MOVING;
  996. procedure WMSizing(var Msg: TMessage); message WM_SIZING;
  997. procedure WMSize(var Msg: TMessage); message WM_SIZE;
  998. procedure WMMove(var Msg: TMessage); message WM_MOVE;
  999. procedure AddUploadMission(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string; CheckMission: Boolean = True);
  1000. procedure CheckUploadMissions;
  1001. procedure GoNextLevelUploadMissions(UploadMission: TUploadMission);
  1002. procedure CheckNDControlState;
  1003. procedure AddDownloadMission(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = ''; CheckMission: Boolean = True);
  1004. procedure CheckDownloadMissions;
  1005. procedure ShowNetWorkDiskSpaceInfo;
  1006. procedure WebBrowserRightStatusTextChange(ASender: TObject; const Text: WideString);
  1007. procedure WebBrowserRightTitleChange(ASender: TObject; const Text: WideString);
  1008. procedure WebBrowserRightDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  1009. procedure WebBrowserRightDocumentCompleteForPost(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  1010. procedure WebBrowserRightNewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
  1011. procedure WebBrowserRightWindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
  1012. public
  1013. MessageBoxForm: TMessageBoxForm;
  1014. property WebPanels: TStringList read FWebPanels;
  1015. procedure LoadWebPanelsFromXML;
  1016. procedure SaveWebPanelsToXML;
  1017. procedure ShowWebTabs;
  1018. procedure HideMainForm;
  1019. procedure ShowMainForm;
  1020. function AddWebBrowserToPageControl(AUrl: string; WebPanelTag: Integer = -1): TWebBrowser;
  1021. procedure OpenNotReadMessage(iIndex: Integer);
  1022. procedure SaveBranchUserDataToXML(FileName: string);
  1023. procedure UpdatePostLogState(Status: Boolean);
  1024. procedure ShowOrHideMuiltiWeb;
  1025. private
  1026. FDownFile: TDownFile;
  1027. {通讯录}
  1028. FCutNode: TTreeNode;
  1029. FManageGroupMsgList: TStringList;
  1030. FManageGroupMemberMsgList: TStringList;
  1031. {通讯录}
  1032. FGetUsersTask: TStringList;
  1033. FHintWindow: TSingleBorderHintWindow;
  1034. ActiveButtonTag: Integer;
  1035. FToolBarButtonList: TStringList;
  1036. FToolBarButtonIconList: TStringList;
  1037. FFriendInfo: TStringList; //存储从好友列表移动到黑名单的好友信息
  1038. FLoginAsSavePassword, FSavePassword, FAutoLogin: Boolean;
  1039. FLoginState: TRealICQLoginState;
  1040. FLeaveMessage: string;
  1041. FCanAlert, FHidden: Boolean;
  1042. FUIMainColor: TColor;
  1043. FShowGroup: Boolean;
  1044. FGroups: TStringList;
  1045. FLVSelectedItemBorderColor: TColor;
  1046. FLVSelectedItemBorderInnerColor: TColor;
  1047. FLVSelectedItemBackColor: TColor;
  1048. FLVHeadImageBorderColor: TColor;
  1049. FLVHeadImageBackColor: TColor;
  1050. FLVStyle: TRealICQContacterListItemStyle;
  1051. FLVCaptionStyle: TRealICQContacterListItemCaptionStyle;
  1052. FShowTree: Boolean; //是否以树型方式组织联系人列表
  1053. FShowStrangers: Boolean;
  1054. FShowBlacklists: Boolean;
  1055. FShowTeams: Boolean;
  1056. FShowLatests: Boolean;
  1057. FShowGIFInMailForm: Boolean;
  1058. FShowGIFInTalkingForm: Boolean;
  1059. FFlashTrayIconIndex: Integer;
  1060. FFlashTrayIconIndexAtLogining: Integer;
  1061. FAlwaysOnTop: Boolean;
  1062. FTalkingFormAlwaysOnTop: Boolean;
  1063. FCtrlEnterSendMessage: Boolean;
  1064. FCopyScreenHideTalkForm: Boolean;
  1065. FReadMessageHotKey: string; // Cardinal;
  1066. FCopyScreenHotKey: string; // Cardinal;
  1067. FMainFormLeft: Integer;
  1068. FMainFormTop: Integer;
  1069. FMainFormWidth: Integer;
  1070. FMainFormHeight: Integer;
  1071. FTalkingFormLeft: Integer;
  1072. FTalkingFormTop: Integer;
  1073. FTalkingFormWidth: Integer;
  1074. FTalkingFormHeight: Integer;
  1075. FSMSFormLeft, FSMSFormTop, FSMSFormWidth, FSMSFormHeight: Integer;
  1076. FConfirmSendOfflineFile: Boolean;
  1077. FShowMainFormOnStart: Boolean;
  1078. FCursorPosX: Integer;
  1079. FCursorPosY: Integer;
  1080. FLastDBlClickTicket: Cardinal;
  1081. FNeedShowUserCardLoginName: string;
  1082. FShowUserCardTargetTop: Integer;
  1083. FWebTabs: TList;
  1084. //未处理的系统消息集合
  1085. FSystemMessages: TList;
  1086. FLastSearchKeyWord: string;
  1087. // FLastActiveIndex: Integer;
  1088. FSearchListViewInVisible: Boolean;
  1089. FSearchListView: TRealICQContacterListView;
  1090. FSearchMoreUserListView: TRealICQContacterListView;
  1091. //显示系统消息的ListView
  1092. FLVSystemMessage: TRealICQContacterListView;
  1093. //显示群组列表的ListView
  1094. FLVTeams: TRealICQContacterListView;
  1095. //显示最近联系人列表的ListView
  1096. FLVNetWorkDisk: TRealICQContacterListView;
  1097. FLVNetWorkDiskUploadingFiles: TRealICQContacterListView;
  1098. FLVNetWorkDiskDownloadingFiles: TRealICQContacterListView;
  1099. //客服最近联系列表w
  1100. FTVCustomerLatests: TRealICQContacterTreeView;
  1101. FLVCustomers: TRealICQContacterListView;
  1102. FContacterListViews: TStringList;
  1103. FContacterTreeViews: TStringList;
  1104. FTrayIconRect: TRect;
  1105. FGettedTrayIconRect: Boolean;
  1106. FInputFont: TFont;
  1107. FSystemFaceCount: Integer;
  1108. FFaceList, FTempFaceList, FFaceCategory: TStringList;
  1109. FShowHintOnOnline: Boolean;
  1110. FShowHintOnOffline: Boolean;
  1111. FDontShowHintOnBusy: Boolean;
  1112. FPlaySoundOnOnline: Boolean;
  1113. FPlaySoundOnOffline: Boolean;
  1114. FPlaySoundOnGetMessage: Boolean;
  1115. FPlaySoundOnGetSystemMessage: Boolean;
  1116. FFlashCaptionOnOnline: Boolean;
  1117. FFlashImageOnGetMessage: Boolean;
  1118. FShowShakeWindow: Boolean;
  1119. FShowCustomMessage: Boolean;
  1120. FShowFileTransCompleted: Boolean;
  1121. FOnlineEventSound: string;
  1122. FOfflineEventSound: string;
  1123. FMessageEventSound: string;
  1124. FSystemMessageEventSound: string;
  1125. FRecvFileSafeLevel: TRecvFileSafeLevel;
  1126. FAllowURL: Boolean;
  1127. FAutoSaveMessage: Boolean;
  1128. FShowHistoryInNewWindow: Boolean;
  1129. FAutoUpdate: Boolean;
  1130. FRecvFileDir: string;
  1131. FUseCacheDir: Boolean;
  1132. FCacheDir: string;
  1133. FLimitCacheDirSize: Boolean;
  1134. FMaxCacheDirSize: Integer;
  1135. FAudoDeleteCacheFile: Boolean;
  1136. FAudoDeleteCacheFileDate: Integer;
  1137. FScanVirus: Boolean;
  1138. FScanVirusProgram: string;
  1139. FDontUseCacheFileOnBigFile: Boolean;
  1140. FDontUseCacheFileOnBigFileSize: Integer;
  1141. //读取/保存历史记录的对象
  1142. FDBHistory: TRealICQDBHistory;
  1143. FOfflineAutoResponseTexts: TStringList;
  1144. CLOSEWINDOWS: UINT; //接收别的进程发送的退出程序的消息
  1145. procedure DownFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  1146. procedure DownFaceFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  1147. procedure QuitWindows();
  1148. procedure ShowFriendLists;
  1149. procedure ShowBlacklists;
  1150. procedure CheckCacheDir;
  1151. procedure LoadOfflineAutoResponseSets;
  1152. //读取最近的联系人列表
  1153. procedure LoadLatests;
  1154. procedure AddMessageHistory(ASystemMessageType: TSystemMessageType; ASimpleMessage: string; ASystemMessage: TRealICQSystemMessage);
  1155. function GetSelectedLoginName: string;
  1156. procedure SetTalkingFormAlwaysOnTop(Value: Boolean);
  1157. procedure SetCtrlEnterSendMessage(Value: Boolean);
  1158. procedure SetCopyScreenHideTalkForm(Value: Boolean);
  1159. procedure SetSearchListViewVisible(AShow: Boolean);
  1160. procedure SetUIState;
  1161. procedure SetLoginControlsVisible(Value: Boolean);
  1162. procedure SetLoginStateControlState;
  1163. procedure LoadMainTabImage;
  1164. procedure LoadHintAndSoundConfigs;
  1165. procedure LoadReceiveFileConfigs;
  1166. procedure LoadSafeConfigs;
  1167. procedure LoadGroupConfigs;
  1168. procedure SaveIfShowGroupConfig;
  1169. procedure ShowGroupInterface;
  1170. procedure LoadStyleConfigs;
  1171. procedure SaveStyleConfigs;
  1172. procedure LoadHotKeyConfigs;
  1173. procedure SaveHotKeyConfigs;
  1174. procedure SetReadMessageHotKey(Value: string);
  1175. procedure SetCopyScreenHotKey(Value: string);
  1176. procedure LoadDefaultConfigs;
  1177. procedure LoadAutoUpdateConfigs;
  1178. procedure LoadInputConfigs;
  1179. procedure SaveInputFontConfig;
  1180. procedure LoadGroupConfig;
  1181. function GetSystemMessageCounter(AMessageID: Integer): Integer;
  1182. procedure IncSystemMessageCounter(AMessageID: Integer);
  1183. procedure SetInputFont(Value: TFont);
  1184. procedure SetShowGroup(Value: Boolean);
  1185. function GetListViewByLoginName(ALoginName: string; AOnlyInGroups: Boolean = False): TRealICQContacterListView;
  1186. procedure SetFlashCaptionOnOnlineValue(Value: Boolean);
  1187. procedure ShowNavBarNumeric;
  1188. procedure SetLoginStateMenuChecked;
  1189. procedure SetStyleMenuChecked;
  1190. procedure miChangeLoginNameClick(Sender: TObject);
  1191. procedure miChangeServerClick(Sender: TObject);
  1192. procedure miMoveGroupClick(Sender: TObject);
  1193. procedure miMoveToBlacklistsClick(Sender: TObject);
  1194. procedure miMoveToStrangersClick(Sender: TObject);
  1195. procedure ItemShowHint(Sender: TObject; Item: TRealICQContacterListItem; var HintStr: string);
  1196. procedure NDItemDoubleClick(Item: TRealICQContacterListItem);
  1197. procedure NDSelectItemChanged(Item: TRealICQContacterListItem);
  1198. procedure NDMissionItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1199. procedure NDMissionDropFiles(Sender: TObject; var Message: TMessage);
  1200. procedure NDItemMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1201. procedure NodeBranchClick(Sender: TObject; Branch: TRealICQBranch);
  1202. procedure NodeOnline(Employee: TRealICQEmployee);
  1203. procedure NodeOffline(Employee: TRealICQEmployee);
  1204. procedure NodeDoubleClick(Employee: TRealICQEmployee);
  1205. procedure NodeIconButtonClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  1206. procedure NodeIconButtonDblClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  1207. procedure NodeOnMouseEnter(Employee: TRealICQEmployee);
  1208. procedure NodeOnMouseLeave(Employee: TRealICQEmployee);
  1209. {通讯录}
  1210. procedure NodeGroupClick(Sender: TObject; Group: TRealICQBranch);
  1211. procedure GetChildsGroupId(GroupId: string; var Groups: string);
  1212. procedure GettedAddrBookUsers(Sender: TObject);
  1213. procedure GettedAddrBookUsers1(Sender: TObject);
  1214. procedure GettedAddrBookGroups(Sender: TObject);
  1215. procedure LoadAddrBook(ExpandGroupId: string);
  1216. procedure GettedManageAddrBookResult(Sender: TObject; OperatModal: Integer; OperatCommand: Integer; RetValue, MessageId: Cardinal);
  1217. function GetGroupUsers(GroupId: string): Integer;
  1218. function GetAddrBookUserIndex(GroupId, LoginName: string): Integer;
  1219. function GetAddrBookUser(GroupId, LoginName: string): TRealICQUser;
  1220. {通讯录}
  1221. procedure miSkinClick(Sender: TObject);
  1222. procedure miColorClick(Sender: TObject);
  1223. procedure WebTabShow(Sender: TObject);
  1224. procedure miLanguageClick(Sender: TObject);
  1225. private
  1226. FCheckedUpdate: Boolean;
  1227. TabAcountIndex: Integer;
  1228. FNotReadMessages: TStringList; {未读消息}
  1229. HotKeyID_ReadMessage: Integer;
  1230. HotKeyID_CopyScreen: Integer;
  1231. procedure WMHotKeyHandle(var Msg: TWMHotKey); message WM_HotKey;
  1232. procedure ShowRealICQMessage(RealICQMessage: TRealICQMessage; ShowSendFailed: Boolean; ARealICQClient: TRealICQClient);
  1233. procedure ShowSystemMessage(ASystemMessage: TRealICQSystemMessage);
  1234. procedure SetShowMainFormOnStart(Value: Boolean);
  1235. procedure SaveWindowState;
  1236. function GetBitmapFromFileExt(AFileName: string): string;
  1237. protected
  1238. procedure ChangeLanguage(ALanguageIniFile: string); override;
  1239. procedure Post(stURL, stPostData: string; var wbWebBrowser: TWebBrowser);
  1240. procedure WMQueryEndSession(var message: TWMQUERYENDSESSION); message WM_QUERYENDSESSION;
  1241. procedure WMPowerBroadcast(var message: TMessage); message WM_POWERBROADCAST;
  1242. procedure CMWininichange(var Message: TWMWinIniChange); message CM_WININICHANGE;
  1243. procedure WndProc(var Message: TMessage); override;
  1244. procedure CreateParams(var Params: TCreateParams); override;
  1245. public
  1246. FLVLatests: TRealICQContacterListView;
  1247. constructor Create(AOwner: TComponent); override;
  1248. procedure ChangeUIColor(AColor: TColor); override;
  1249. procedure ChangePPMenuColorMap(PopupMenuEx: TCustomActionPopupMenuEx);
  1250. procedure NodeOnHeadImageMouseEnter(Employee: TRealICQEmployee);
  1251. procedure NodeOnHeadImageMouseLeave(Employee: TRealICQEmployee);
  1252. procedure ShowMeInformation;
  1253. procedure ShowUserCardForm(ALoginName: string; ATargetTop: Integer);
  1254. procedure HideUserCardForm;
  1255. procedure UpdateAddrBookInfo(RealICQUser: TRealICQUser);
  1256. function GetDefaultBrowser: string; //获取默认浏览器
  1257. procedure ShowRealICQTeamMessage(RealICQTeamMessage: TRealICQTeamMessage; ShowSendFailed: Boolean);
  1258. procedure WebSocketRemoveTeamResponse(aTeamID: string);
  1259. procedure WebSocketQuitTeam(aTeamID: string);
  1260. procedure WebSocketSendReadTeamInfo(aTeamID: string);
  1261. procedure WebSocketRecivedbroadcastmesssage(aID, aGroupID, aSayer, aStyle, aMsg: string; aTimesTamp: TDateTime);
  1262. procedure WebSocketJionTeamRequest(TeamID, ALoginName, ATag: string);
  1263. procedure DownLoadUpdateConfig;
  1264. procedure OpenWebTab(TabSheet: TTabSheet; WebPanel: TWebPanel; AcountIndex: Integer);
  1265. procedure UploadWebTabAccounts;
  1266. procedure GetBranchEmpOnlineAndSum(Branchs: TStringList; BranchInfo: TRealICQBranchInfo; var OnlineEmployee, EmployeeCount: Integer);
  1267. function GetBranchName(LoginName: string): string;
  1268. function GetCompany: string;
  1269. procedure StopHeadImageFlash(AID: string);
  1270. {通讯录}
  1271. function GetGroupUserCount: Integer;
  1272. procedure SaveContacter(Name, Mobile, Tel, Email, Remark, BranchId: string);
  1273. procedure GetParentGroupNameList(BranchInfo: TRealICQBranchInfo; var Groups: string);
  1274. procedure CreateManageGroupMessage(GroupId, GroupName, ParentId, MessageId: string);
  1275. procedure CreateManageGroupMemberMessage(ID, DisplayName, NickName, Mobile, Tel, Email, Remark, GroupId, MessageId: string);
  1276. {通讯录}
  1277. procedure ItemOnline(Item: TRealICQContacterListItem);
  1278. procedure ItemOffline(Item: TRealICQContacterListItem);
  1279. procedure ItemDoubleClick(Item: TRealICQContacterListItem);
  1280. procedure ItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1281. procedure ItemIconButtonDblClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1282. procedure ItemOnMouseEnter(Item: TRealICQContacterListItem);
  1283. procedure ItemOnMouseLeave(Item: TRealICQContacterListItem);
  1284. procedure ItemOnHeadImageEnter(Item: TRealICQContacterListItem);
  1285. procedure ItemOnHeadImageLeave(Item: TRealICQContacterListItem);
  1286. procedure SetToolBarState(Sender: TObject);
  1287. function GetActiveTabSheetName: string;
  1288. function AddFriendTreeView(AOwner: TWinControl; GroupName: string): Integer;
  1289. function AddContacterListView(AOwner: TWinControl; GroupName: string): Integer;
  1290. function AddContacterTreeView(AOwner: TWinControl; GroupName: string): Integer;
  1291. procedure UpdateContacterListView(RealICQContacterListView: TRealICQContacterListView);
  1292. procedure CheckWindowPositon;
  1293. procedure BindUserDataToItem(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean = True);
  1294. procedure BindUserDataToItemForGroup(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AGroupAlias: string; AShowNavBarNumeric: Boolean = True);
  1295. procedure UpdateEmployeeNode(Employee: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  1296. procedure UpdateFriendNode(Friend: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  1297. procedure StopFlash(ALoginName: string);
  1298. procedure StopFlashTeam(ATeamID: string);
  1299. procedure SetGetMoreUserEvent;
  1300. procedure SaveDefaultConfigs;
  1301. // procedure LoadSysMsgInterfaceConfig;
  1302. // procedure SaveSysMsgInterfaceConfig;
  1303. procedure SaveGroupConfigs;
  1304. procedure SaveHintAndSoundConfigs;
  1305. procedure SaveCustomFaceConfig;
  1306. procedure SaveReceiveFileConfigs;
  1307. procedure SaveSafeConfigs;
  1308. procedure SaveAutoUpdateConfigs;
  1309. procedure SaveOfflineAutoResponseSets;
  1310. procedure SetDOMStyle(Doc: IHTMLDocument2);
  1311. procedure OpenMessagesManagerForm;
  1312. property ContacterListViews: TStringList read FContacterListViews;
  1313. property ContacterTreeViews: TStringList read FContacterTreeViews;
  1314. property ListViewLatests: TRealICQContacterListView read FLVLatests;
  1315. property CurrentServerID: string read FCurrentServerID;
  1316. property UIMainColor: TColor read FUIMainColor;
  1317. property CanAlert: Boolean read FCanAlert;
  1318. property OfflineAutoResponseTexts: TStringList read FOfflineAutoResponseTexts write FOfflineAutoResponseTexts;
  1319. property ShowGroup: Boolean read FShowGroup write SetShowGroup;
  1320. property Groups: TStringList read FGroups write FGroups;
  1321. property TalkingFormAlwaysOnTop: Boolean read FTalkingFormAlwaysOnTop write SetTalkingFormAlwaysOnTop;
  1322. property CtrlEnterSendMessage: Boolean read FCtrlEnterSendMessage write SetCtrlEnterSendMessage;
  1323. property CopyScreenHideTalkForm: Boolean read FCopyScreenHideTalkForm write SetCopyScreenHideTalkForm;
  1324. property InputFont: TFont read FInputFont write SetInputFont;
  1325. property FaceList: TStringList read FFaceList;
  1326. property TempFaceList: TStringList read FTempFaceList;
  1327. property FaceCategory: TStringList read FFaceCategory;
  1328. property SystemFaceCount: Integer read FSystemFaceCount;
  1329. property ShowGIFInMailForm: Boolean read FShowGIFInMailForm;
  1330. property ShowGIFInTalkingForm: Boolean read FShowGIFInTalkingForm;
  1331. property NotReadMessages: TStringList read FNotReadMessages;
  1332. property TalkingFormLeft: Integer read FTalkingFormLeft write FTalkingFormLeft;
  1333. property TalkingFormTop: Integer read FTalkingFormTop write FTalkingFormTop;
  1334. property TalkingFormWidth: Integer read FTalkingFormWidth write FTalkingFormWidth;
  1335. property TalkingFormHeight: Integer read FTalkingFormHeight write FTalkingFormHeight;
  1336. property SMSFormLeft: Integer read FSMSFormLeft write FSMSFormLeft;
  1337. property SMSFormTop: Integer read FSMSFormTop write FSMSFormTop;
  1338. property SMSFormWidth: Integer read FSMSFormWidth write FSMSFormWidth;
  1339. property SMSFormHeight: Integer read FSMSFormHeight write FSMSFormHeight;
  1340. property ShowMainFormOnStart: Boolean read FShowMainFormOnStart write SetShowMainFormOnStart;
  1341. property ConfirmSendOfflineFile: Boolean read FConfirmSendOfflineFile write FConfirmSendOfflineFile;
  1342. property AlwaysOnTop: Boolean read FAlwaysOnTop write FAlwaysOnTop;
  1343. property AutoHide: Boolean read FAutoHide write FAutoHide;
  1344. property AutoShowRequestMessage: Boolean read FAutoShowRequestMessage write FAutoShowRequestMessage;
  1345. property ShowHintOnOnline: Boolean read FShowHintOnOnline write FShowHintOnOnline;
  1346. property ShowHintOnOffline: Boolean read FShowHintOnOffline write FShowHintOnOffline;
  1347. property DontShowHintOnBusy: Boolean read FDontShowHintOnBusy write FDontShowHintOnBusy;
  1348. property PlaySoundOnOnline: Boolean read FPlaySoundOnOnline write FPlaySoundOnOnline;
  1349. property PlaySoundOnOffline: Boolean read FPlaySoundOnOffline write FPlaySoundOnOffline;
  1350. property PlaySoundOnGetMessage: Boolean read FPlaySoundOnGetMessage write FPlaySoundOnGetMessage;
  1351. property PlaySoundOnGetSystemMessage: Boolean read FPlaySoundOnGetSystemMessage write FPlaySoundOnGetSystemMessage;
  1352. property FlashCaptionOnOnline: Boolean read FFlashCaptionOnOnline write FFlashCaptionOnOnline;
  1353. property FlashImageOnGetMessage: Boolean read FFlashImageOnGetMessage write FFlashImageOnGetMessage;
  1354. property ShowShakeWindow: Boolean read FShowShakeWindow write FShowShakeWindow;
  1355. property ShowCustomMessage: Boolean read FShowCustomMessage write FShowCustomMessage;
  1356. property ShowFileTransCompleted: Boolean read FShowFileTransCompleted write FShowFileTransCompleted;
  1357. property OnlineEventSound: string read FOnlineEventSound write FOnlineEventSound;
  1358. property OfflineEventSound: string read FOfflineEventSound write FOfflineEventSound;
  1359. property MessageEventSound: string read FMessageEventSound write FMessageEventSound;
  1360. property SystemMessageEventSound: string read FSystemMessageEventSound write FSystemMessageEventSound;
  1361. property RecvFileDir: string read FRecvFileDir write FRecvFileDir;
  1362. property UseCacheDir: Boolean read FUseCacheDir write FUseCacheDir;
  1363. property CacheDir: string read FCacheDir write FCacheDir;
  1364. property LimitCacheDirSize: Boolean read FLimitCacheDirSize write FLimitCacheDirSize;
  1365. property MaxCacheDirSize: Integer read FMaxCacheDirSize write FMaxCacheDirSize;
  1366. property AudoDeleteCacheFile: Boolean read FAudoDeleteCacheFile write FAudoDeleteCacheFile;
  1367. property AudoDeleteCacheFileDate: Integer read FAudoDeleteCacheFileDate write FAudoDeleteCacheFileDate;
  1368. property ScanVirus: Boolean read FScanVirus write FScanVirus;
  1369. property ScanVirusProgram: string read FScanVirusProgram write FScanVirusProgram;
  1370. property DontUseCacheFileOnBigFile: Boolean read FDontUseCacheFileOnBigFile write FDontUseCacheFileOnBigFile;
  1371. property DontUseCacheFileOnBigFileSize: Integer read FDontUseCacheFileOnBigFileSize write FDontUseCacheFileOnBigFileSize;
  1372. property RecvFileSafeLevel: TRecvFileSafeLevel read FRecvFileSafeLevel write FRecvFileSafeLevel;
  1373. property AllowURL: Boolean read FAllowURL write FAllowURL;
  1374. property AutoSaveMessage: Boolean read FAutoSaveMessage write FAutoSaveMessage;
  1375. property ShowHistoryInNewWindow: Boolean read FShowHistoryInNewWindow write FShowHistoryInNewWindow;
  1376. property ReadMessageHotKey: string read FReadMessageHotKey write SetReadMessageHotKey;
  1377. property CopyScreenHotKey: string read FCopyScreenHotKey write SetCopyScreenHotKey;
  1378. property AutoUpdate: Boolean read FAutoUpdate write FAutoUpdate;
  1379. property AddrBookURL: string read FAddrBookURL write FAddrBookURL;
  1380. property DBHistory: TRealICQDBHistory read FDBHistory;
  1381. property GroupAddress: string read FGroupAddress write FGroupAddress;
  1382. property GroupPort: Integer read FGroupPort write FGroupPort;
  1383. property GroupImagePort: Integer read FGroupImagePort write FGroupImagePort;
  1384. property GroupShareAddress: string read FGroupShareAddress write FGroupShareAddress;
  1385. property GroupSharePort: Integer read FGroupSharePort write FGroupSharePort;
  1386. end;
  1387. TUploadMission = class
  1388. private
  1389. FID: string;
  1390. FUploadMissionType: TNDMissionType;
  1391. FDirectoryID: Integer;
  1392. FName: string;
  1393. public
  1394. constructor Create(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string);
  1395. destructor Destroy; override;
  1396. property ID: string read FID;
  1397. property UploadMissionType: TNDMissionType read FUploadMissionType;
  1398. property DirectoryID: Integer read FDirectoryID;
  1399. property Name: string read FName;
  1400. end;
  1401. TDownloadMission = class
  1402. FID: string;
  1403. FDownloadMissionType: TNDMissionType;
  1404. FFileID: Integer;
  1405. FFileName: string;
  1406. FDirectoryName: string;
  1407. public
  1408. constructor Create(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = '');
  1409. destructor Destroy; override;
  1410. property ID: string read FID;
  1411. property DownloadMissionType: TNDMissionType read FDownloadMissionType;
  1412. property FileID: Integer read FFileID;
  1413. property FileName: string read FFileName;
  1414. property DirectoryName: string read FDirectoryName;
  1415. end;
  1416. TNavigateType = (ntGET, ntPOST, ntFill);
  1417. //WEB标签面版数据
  1418. TWebPanel = class
  1419. private
  1420. FMustShow: Boolean;
  1421. FShow: Boolean;
  1422. FID, FName, FURL, FImage: string;
  1423. FNavigateType: TNavigateType;
  1424. FPostFields: string;
  1425. FUserIMLoginName: Boolean;
  1426. FUserIMPassword: Boolean;
  1427. FCustomLoginName, FCustomPassword: string;
  1428. FContent: string;
  1429. FAcounts: TList;
  1430. public
  1431. constructor Create();
  1432. destructor Destroy; override;
  1433. property MustShow: Boolean read FMustShow write FMustShow;
  1434. property Show: Boolean read FShow write FShow;
  1435. property ID: string read FID write FID;
  1436. property Name: string read FName write FName;
  1437. property URL: string read FURL write FURL;
  1438. property Image: string read FImage write FImage;
  1439. property NavigateType: TNavigateType read FNavigateType write FNavigateType;
  1440. property PostFields: string read FPostFields write FPostFields;
  1441. property UserIMLoginName: Boolean read FUserIMLoginName write FUserIMLoginName;
  1442. property UserIMPassword: Boolean read FUserIMPassword write FUserIMPassword;
  1443. property CustomLoginName: string read FCustomLoginName write FCustomLoginName;
  1444. property CustomPassword: string read FCustomPassword write FCustomPassword;
  1445. property Content: string read FContent write FContent;
  1446. property Acounts: TList read FAcounts write FAcounts;
  1447. end;
  1448. //未读消息(文字消息)
  1449. TNotReadMessage = class
  1450. private
  1451. FRealICQMessage: TRealICQMessage;
  1452. FShowSendFailed: Boolean;
  1453. FRealICQClient: TRealICQClient;
  1454. public
  1455. destructor Destroy; override;
  1456. property RealICQMessage: TRealICQMessage read FRealICQMessage write FRealICQMessage;
  1457. property ShowSendFailed: Boolean read FShowSendFailed;
  1458. end;
  1459. //未读消息(文字消息)
  1460. TNotReadTeamMessage = class
  1461. private
  1462. FRealICQTeamMessage: TRealICQTeamMessage;
  1463. FShowSendFailed: Boolean;
  1464. public
  1465. destructor Destroy; override;
  1466. property RealICQTeamMessage: TRealICQTeamMessage read FRealICQTeamMessage write FRealICQTeamMessage;
  1467. property ShowSendFailed: Boolean read FShowSendFailed;
  1468. end;
  1469. //未读消息(手机短消息)
  1470. TNotReadSMSMessage = class
  1471. private
  1472. FSMSSender, FSMSContent: string;
  1473. FSMSDateTime: TDateTime;
  1474. public
  1475. property SMSSender: string read FSMSSender;
  1476. property SMSContent: string read FSMSContent;
  1477. property SMSDateTime: TDateTime read FSMSDateTime;
  1478. end;
  1479. TWebTabAcount = class
  1480. private
  1481. FWebTabID: Integer;
  1482. FTitle: string;
  1483. FLoginName: string;
  1484. FPassword: string;
  1485. FExplain: string;
  1486. public
  1487. published
  1488. property WebTabID: Integer read FWebTabID write FWebTabID;
  1489. property Title: string read FTitle write FTitle;
  1490. property LoginName: string read FLoginName write FLoginName;
  1491. property Password: string read FPassword write FPassword;
  1492. property Explain: string read FExplain write FExplain;
  1493. end;
  1494. //添加表示用户状态的图标至指定的 ImageList 中
  1495. procedure AddUserStatePictureToImageList(ImageList: TImageList);
  1496. procedure ClearFileMissions;
  1497. var
  1498. MainForm: TMainForm;
  1499. DisplayWebs: Boolean;
  1500. LVSystemMessage, LVMyContacters, LVFriends, LVStrangers, LVBlacklists, LVLatests, LVTeams, LVMoreUsers, LVAddrbook, LVSearch: string;
  1501. CsvLines, CommaStr: TStringList;
  1502. implementation
  1503. uses
  1504. RegFrm, SearchFrm, AddFriendRequestFrm, AddFriendFrm, OptionsFrm,
  1505. ChangePassFrm, GroupManagerFrm, OnlineOfflineAlertFrm, UserCardDetailView,
  1506. TalkingFrm, TrueHiddenMainFrm, SelFaceFrm, CustomFacesManagerFrm, AddFaceFrm,
  1507. CreateTeamFrm, PtoPFileTransmitter, FileTransmitterObjective, NotifyAlertFrm,
  1508. TeamOptionsFrm, SearchTeamFrm, SystemMessageFrm, MessagesManagerFrm,
  1509. UserCardFrm, VideoFrm, ShareUtils, CopyScreenFrm, SMSFrm,
  1510. ConfirmReplaceNDFileFrm, RemoteControlFrm, ReceiveFolderRequestFrm,
  1511. NotReadMessageBoxFrm, AddWebTabFrm, SelWebTabAcountsFrm, QRCodeFrm,
  1512. LoggerImport, TeamsAdapter, MainFormContrller, Authority, FileTransmitAdapter,
  1513. DataProviderImport, BranchService, UsersService, FriendsService,
  1514. WorkmatesService, MessagesHander, CAImport, InterfaceCA, UserRemarkService,
  1515. GroupConfig, ConditionConfig, PerlRegEx, LimitCondition, UserCardView,
  1516. AboutFrm, SettingView, TextMessageService, ViewManager, InterfaceUI, GuideView;
  1517. var
  1518. HookID: THandle;
  1519. FUploadMissions, FDownloadMissions: TStringList;
  1520. FSavedUploadMissions, FSavedDownloadMissions: TList;
  1521. //------------------------------------------------------------------------------
  1522. procedure AddUserStatePictureToImageList(ImageList: TImageList);
  1523. var
  1524. Bitmap: TBitmap;
  1525. //BitmapLeave: TBitmap;
  1526. //png: TPNGObject;
  1527. //Icon: TIcon;
  1528. begin
  1529. Bitmap := TBitmap.Create;
  1530. //Icon := TIcon.Create;
  1531. //BitmapLeave := TBitmap.Create;
  1532. //png := TPNGObject.Create;
  1533. try
  1534. // try
  1535. // Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1536. // except
  1537. // end;
  1538. // ImageList.Add(Bitmap, nil);
  1539. //
  1540. // Grayscale(Bitmap);
  1541. // ImageList.Insert(0, Bitmap, nil);
  1542. //
  1543. // try
  1544. // Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1545. // BitmapLeave.LoadFromFile(LeavePicture);
  1546. // Bitmap.Canvas.Draw(0, 8, BitmapLeave);
  1547. // except
  1548. // end;
  1549. // ImageList.Add(Bitmap, nil);
  1550. //-----------------------------------------------
  1551. //png.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1552. //Image1.Picture.Bitmap.Assign(png);
  1553. //
  1554. //
  1555. //
  1556. // try
  1557. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1558. // except
  1559. // end;
  1560. // ImageList.AddIcon(Icon);
  1561. //
  1562. // try
  1563. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1564. // except
  1565. // end;
  1566. // ImageList.AddIcon(Icon);
  1567. //
  1568. // try
  1569. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1570. // except
  1571. // end;
  1572. // ImageList.AddIcon(Icon);
  1573. try
  1574. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImageOffline_16.bmp');
  1575. except
  1576. end;
  1577. ImageList.Add(Bitmap, nil);
  1578. try
  1579. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImage_16.bmp');
  1580. except
  1581. end;
  1582. ImageList.Add(Bitmap, nil);
  1583. try
  1584. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImage_leave_16.bmp');
  1585. except
  1586. end;
  1587. ImageList.Add(Bitmap, nil);
  1588. try
  1589. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\OpenFolder.bmp');
  1590. except
  1591. end;
  1592. ImageList.Add(Bitmap, nil);
  1593. try
  1594. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CloseFolder.bmp');
  1595. except
  1596. end;
  1597. ImageList.Add(Bitmap, nil);
  1598. try
  1599. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  1600. except
  1601. end;
  1602. ImageList.Add(Bitmap, nil);
  1603. try
  1604. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  1605. except
  1606. end;
  1607. ImageList.Add(Bitmap, nil);
  1608. try
  1609. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SearchPicture);
  1610. except
  1611. end;
  1612. ImageList.Add(Bitmap, nil);
  1613. try
  1614. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSBMP);
  1615. except
  1616. end;
  1617. ImageList.Add(Bitmap, nil);
  1618. finally
  1619. //BitmapLeave.Free;
  1620. Bitmap.Free;
  1621. //Icon.Free;
  1622. //png.Free;
  1623. end;
  1624. end;
  1625. //------------------------------------------------------------------------------
  1626. function MouseProc(nCode: Integer; wParam, lParam: Longint): Longint; stdcall;
  1627. var
  1628. szClassName: array[0..255] of Char;
  1629. const
  1630. ie_name = 'Internet Explorer_Server';
  1631. begin
  1632. case nCode < 0 of
  1633. True:
  1634. Result := CallNextHookEx(HookID, nCode, wParam, lParam) else
  1635. case wParam of
  1636. WM_RBUTTONDOWN, WM_RBUTTONUP:
  1637. begin
  1638. GetClassName(PMOUSEHOOKSTRUCT(lParam)^.HWND, szClassName, SizeOf(szClassName));
  1639. 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
  1640. begin
  1641. Result := HC_SKIP {屏蔽WebBrowser上的右键}
  1642. end
  1643. else
  1644. begin
  1645. Result := CallNextHookEx(HookID, nCode, wParam, lParam);
  1646. end;
  1647. end
  1648. else
  1649. Result := CallNextHookEx(HookID, nCode, wParam, lParam);
  1650. end;
  1651. end;
  1652. end;
  1653. {$R *.dfm}
  1654. {TWebPanel}
  1655. constructor TWebPanel.Create();
  1656. begin
  1657. FAcounts := TList.Create;
  1658. end;
  1659. destructor TWebPanel.Destroy;
  1660. var
  1661. WebTabAcount: TWebTabAcount;
  1662. begin
  1663. try
  1664. while FAcounts.Count > 0 do
  1665. begin
  1666. WebTabAcount := FAcounts[0];
  1667. FAcounts.Delete(0);
  1668. try
  1669. FreeAndNil(WebTabAcount);
  1670. except
  1671. end;
  1672. end;
  1673. try
  1674. FreeAndNil(FAcounts);
  1675. except
  1676. end;
  1677. finally
  1678. inherited Destroy;
  1679. end;
  1680. end;
  1681. {TDownloadMission}
  1682. //------------------------------------------------------------------------------
  1683. constructor TDownloadMission.Create(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = '');
  1684. begin
  1685. FDownloadMissionType := ADownloadMissionType;
  1686. FDirectoryName := ADirectoryName;
  1687. FFileID := AFileID;
  1688. FFileName := AFileName;
  1689. FID := IntToStr(GetTickCount);
  1690. while FDownloadMissions.IndexOf(FID) >= 0 do
  1691. begin
  1692. FID := IntToStr(GetTickCount);
  1693. Sleep(10);
  1694. Application.ProcessMessages;
  1695. end;
  1696. FDownloadMissions.AddObject(FID, Self);
  1697. end;
  1698. //------------------------------------------------------------------------------
  1699. destructor TDownloadMission.Destroy;
  1700. begin
  1701. try
  1702. try
  1703. FDownloadMissions.Delete(FDownloadMissions.IndexOf(FID));
  1704. except
  1705. end;
  1706. finally
  1707. inherited Destroy;
  1708. end;
  1709. end;
  1710. {TUploadMission}
  1711. //------------------------------------------------------------------------------
  1712. constructor TUploadMission.Create(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string);
  1713. begin
  1714. FUploadMissionType := AUploadMissionType;
  1715. FDirectoryID := ADirectoryID;
  1716. FName := AName;
  1717. FID := IntToStr(Integer(FUploadMissionType)) + IntToStr(FDirectoryID) + FName;
  1718. end;
  1719. //------------------------------------------------------------------------------
  1720. destructor TUploadMission.Destroy;
  1721. begin
  1722. try
  1723. try
  1724. FUploadMissions.Delete(FUploadMissions.IndexOf(FID));
  1725. except
  1726. end;
  1727. finally
  1728. inherited Destroy;
  1729. end;
  1730. end;
  1731. {TNotReadMessage}
  1732. //------------------------------------------------------------------------------
  1733. destructor TNotReadMessage.Destroy;
  1734. begin
  1735. try
  1736. FreeAndNil(FRealICQMessage);
  1737. finally
  1738. inherited Destroy;
  1739. end;
  1740. end;
  1741. {TNotReadTeamMessage}
  1742. //------------------------------------------------------------------------------
  1743. destructor TNotReadTeamMessage.Destroy;
  1744. begin
  1745. try
  1746. FreeAndNil(FRealICQTeamMessage);
  1747. finally
  1748. inherited Destroy;
  1749. end;
  1750. end;
  1751. {TMainForm}
  1752. function TMainForm.GetBitmapFromFileExt(AFileName: string): string;
  1753. var
  1754. FileExt, IconTempFileName, FFileExtImage: string;
  1755. TempFile: array[0..MAX_PATH] of char;
  1756. SHFI: TSHFileInfo;
  1757. Bitmap: TBitmap;
  1758. begin
  1759. try
  1760. FileExt := ExtractFileExt(AFileName);
  1761. FFileExtImage := TRealICQClient.GetFileExtImagesDir + Copy(FileExt, 2, Length(FileExt) - 1) + '.BMP';
  1762. if not FileExists(FFileExtImage) then
  1763. begin
  1764. GetTempPath(MAX_PATH, TempFile);
  1765. GetTempFileName(TempFile, PChar(FileExt), GetTickCount, TempFile);
  1766. IconTempFileName := ReplaceStr(TempFile, ExtractFileExt(TempFile), FileExt);
  1767. TFileStream.Create(IconTempFileName, fmCreate).Free;
  1768. SHGetFileInfo(PChar(IconTempFileName), 0, SHFI, SizeOf(SHFI), SHGFI_ICON or SHGFI_SMALLICON);
  1769. DeleteFile(PChar(IconTempFileName));
  1770. Bitmap := TBitmap.Create;
  1771. try
  1772. Bitmap.Width := 16;
  1773. Bitmap.Height := 16;
  1774. DrawIconEx(Bitmap.Canvas.Handle, 0, 0, SHFI.hIcon, 16, 16, 0, 0, DI_NORMAL);
  1775. Bitmap.SaveToFile(FFileExtImage);
  1776. finally
  1777. FreeAndNil(Bitmap);
  1778. end;
  1779. end;
  1780. Result := FFileExtImage;
  1781. except
  1782. end;
  1783. end;
  1784. //------------------------------------------------------------------------------
  1785. procedure TMainForm.SetShowMainFormOnStart(Value: Boolean);
  1786. begin
  1787. if FShowMainFormOnStart = Value then
  1788. Exit;
  1789. FShowMainFormOnStart := Value;
  1790. SaveDefaultConfigs;
  1791. end;
  1792. //------------------------------------------------------------------------------
  1793. procedure TMainForm.SetTalkingFormAlwaysOnTop(Value: Boolean);
  1794. begin
  1795. FTalkingFormAlwaysOnTop := Value;
  1796. SaveStyleConfigs;
  1797. end;
  1798. //------------------------------------------------------------------------------
  1799. procedure TMainForm.SetCtrlEnterSendMessage(Value: Boolean);
  1800. begin
  1801. FCtrlEnterSendMessage := Value;
  1802. SaveStyleConfigs;
  1803. end;
  1804. procedure TMainForm.SetCopyScreenHideTalkForm(Value: Boolean);
  1805. begin
  1806. FCopyScreenHideTalkForm := Value;
  1807. SaveStyleConfigs;
  1808. end;
  1809. procedure TMainForm.SetShowGroup(Value: Boolean);
  1810. begin
  1811. FShowGroup := Value;
  1812. ShowGroupInterface;
  1813. end;
  1814. procedure TMainForm.SaveIfShowGroupConfig;
  1815. var
  1816. XMLFile: string;
  1817. XMLDocument: TXMLDocument;
  1818. GroupConfigNode: IXMLNode;
  1819. begin
  1820. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  1821. XMLDocument := TXMLDocument.Create(Self);
  1822. try
  1823. XMLDocument.Active := True;
  1824. if not FileExists(XMLFile) then
  1825. begin
  1826. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  1827. XMLDocument.Active := True;
  1828. end;
  1829. XMLDocument.LoadFromFile(XMLFile);
  1830. GroupConfigNode := XMLDocument.DocumentElement;
  1831. GroupConfigNode.ChildNodes.FindNode('ShowGroup').Attributes['Value'] := FShowGroup;
  1832. XMLDocument.SaveToFile();
  1833. finally
  1834. XMLDocument.Free;
  1835. end;
  1836. end;
  1837. //------------------------------------------------------------------------------
  1838. procedure TMainForm.SaveGroupConfigs;
  1839. var
  1840. XMLFile: string;
  1841. XMLDocument: TXMLDocument;
  1842. GroupConfigNode, GroupListNode, GroupNode: IXMLNode;
  1843. GroupMembers: TStringList;
  1844. iLoop, jLoop: Integer;
  1845. begin
  1846. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  1847. XMLDocument := TXMLDocument.Create(Self);
  1848. try
  1849. XMLDocument.Active := True;
  1850. if not FileExists(XMLFile) then
  1851. begin
  1852. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  1853. XMLDocument.Active := True;
  1854. end;
  1855. XMLDocument.LoadFromFile(XMLFile);
  1856. GroupConfigNode := XMLDocument.DocumentElement;
  1857. GroupListNode := GroupConfigNode.ChildNodes.FindNode('Groups');
  1858. for iLoop := 0 to GroupListNode.ChildNodes.Count - 1 do
  1859. begin
  1860. GroupNode := GroupListNode.ChildNodes[iLoop];
  1861. GroupNode.ChildNodes.Clear;
  1862. end;
  1863. GroupListNode.ChildNodes.Clear;
  1864. for iLoop := 0 to FGroups.Count - 1 do
  1865. begin
  1866. GroupNode := GroupListNode.AddChild('Group');
  1867. GroupNode.Attributes['Name'] := FGroups[iLoop];
  1868. GroupNode.Attributes['Position'] := iLoop;
  1869. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  1870. for jLoop := 0 to GroupMembers.Count - 1 do
  1871. begin
  1872. if (not TFriendsService.GetService.IsFriend(GroupMembers[jLoop])) and (not TWorkmatesService.GetService.IsWorkmate(GroupMembers[jLoop])) then
  1873. continue;
  1874. if (AnsiSameText(RealICQClient.LoginName, GroupMembers[jLoop]) and (RealICQClient.WorkingMode = wmPublic)) then
  1875. continue;
  1876. GroupNode.AddChild('GroupMember').Text := GroupMembers[jLoop];
  1877. end;
  1878. end;
  1879. XMLDocument.SaveToFile();
  1880. finally
  1881. XMLDocument.Free;
  1882. end;
  1883. end;
  1884. //------------------------------------------------------------------------------
  1885. procedure TMainForm.SetInputFont(Value: TFont);
  1886. begin
  1887. FInputFont.Assign(Value);
  1888. SaveInputFontConfig;
  1889. end;
  1890. //------------------------------------------------------------------------------
  1891. function TMainForm.GetSystemMessageCounter(AMessageID: Integer): Integer;
  1892. var
  1893. XMLFile: string;
  1894. XMLDocument: TXMLDocument;
  1895. CountersNode, CounterNode: IXMLNode;
  1896. iLoop: Integer;
  1897. CountersDate: TDateTime;
  1898. begin
  1899. Result := 0;
  1900. XMLFile := TRealICQClient.GetUserDir + SystemMessagesCounterXMLFile;
  1901. XMLDocument := TXMLDocument.Create(Self);
  1902. try
  1903. try
  1904. XMLDocument.Active := True;
  1905. if not FileExists(XMLFile) then
  1906. begin
  1907. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SystemMessagesCounterXMLFile), PChar(XMLFile), False);
  1908. XMLDocument.Active := True;
  1909. end;
  1910. XMLDocument.LoadFromFile(XMLFile);
  1911. CountersNode := XMLDocument.DocumentElement;
  1912. try
  1913. CountersDate := StrToDate(CountersNode.Attributes['Date']);
  1914. except
  1915. CountersDate := StrToDate(AnsiReplaceStr(CountersNode.Attributes['Date'], '-', '/'));
  1916. end;
  1917. if CompareDate(CountersDate, Now) <> 0 then
  1918. begin
  1919. CountersNode.Attributes['Date'] := DateToStr(Now);
  1920. CountersNode.ChildNodes.Clear;
  1921. XMLDocument.SaveToFile();
  1922. Exit;
  1923. end;
  1924. for iLoop := 0 to CountersNode.ChildNodes.Count - 1 do
  1925. begin
  1926. CounterNode := CountersNode.ChildNodes[iLoop];
  1927. if StrToInt(CounterNode.Attributes['ID']) = AMessageID then
  1928. begin
  1929. Result := StrToInt(CounterNode.Attributes['Counter']);
  1930. Exit;
  1931. end;
  1932. end;
  1933. finally
  1934. XMLDocument.Free;
  1935. end;
  1936. except
  1937. try
  1938. DeleteFile(XMLFile);
  1939. except
  1940. end;
  1941. Result := 0;
  1942. end;
  1943. end;
  1944. //------------------------------------------------------------------------------
  1945. procedure TMainForm.ImgQrCodeClick(Sender: TObject);
  1946. begin
  1947. QRCodeForm := TQRCodeForm.Create(Self);
  1948. try
  1949. QRCodeForm.ShowModal;
  1950. finally
  1951. FreeAndNil(QRCodeForm);
  1952. end;
  1953. end;
  1954. procedure TMainForm.IncSystemMessageCounter(AMessageID: Integer);
  1955. var
  1956. XMLFile: string;
  1957. XMLDocument: TXMLDocument;
  1958. CountersNode, CounterNode: IXMLNode;
  1959. iLoop: Integer;
  1960. Finded: Boolean;
  1961. CountersDate: TDateTime;
  1962. begin
  1963. XMLFile := TRealICQClient.GetUserDir + SystemMessagesCounterXMLFile;
  1964. XMLDocument := TXMLDocument.Create(Self);
  1965. try
  1966. XMLDocument.Active := True;
  1967. if not FileExists(XMLFile) then
  1968. begin
  1969. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SystemMessagesCounterXMLFile), PChar(XMLFile), False);
  1970. XMLDocument.Active := True;
  1971. end;
  1972. XMLDocument.LoadFromFile(XMLFile);
  1973. CountersNode := XMLDocument.DocumentElement;
  1974. try
  1975. CountersDate := StrToDate(CountersNode.Attributes['Date']);
  1976. except
  1977. CountersDate := StrToDate(AnsiReplaceStr(CountersNode.Attributes['Date'], '-', '/'));
  1978. end;
  1979. if CompareDate(CountersDate, Now) <> 0 then
  1980. begin
  1981. CountersNode.Attributes['Date'] := DateToStr(Now);
  1982. CountersNode.ChildNodes.Clear;
  1983. end;
  1984. Finded := False;
  1985. for iLoop := 0 to CountersNode.ChildNodes.Count - 1 do
  1986. begin
  1987. CounterNode := CountersNode.ChildNodes[iLoop];
  1988. if StrToInt(CounterNode.Attributes['ID']) = AMessageID then
  1989. begin
  1990. CounterNode.Attributes['Counter'] := IntToStr(StrToInt(CounterNode.Attributes['Counter']) + 1);
  1991. Finded := True;
  1992. Break;
  1993. end;
  1994. end;
  1995. if not Finded then
  1996. begin
  1997. CounterNode := CountersNode.AddChild('SystemMessage');
  1998. CounterNode.Attributes['ID'] := IntToStr(AMessageID);
  1999. CounterNode.Attributes['Counter'] := '1';
  2000. end;
  2001. XMLDocument.SaveToFile();
  2002. finally
  2003. XMLDocument.Free;
  2004. end;
  2005. end;
  2006. //------------------------------------------------------------------------------
  2007. procedure TMainForm.SaveCustomFaceConfig;
  2008. var
  2009. XMLFile, FaceCategorys: string;
  2010. XMLDocument: TXMLDocument;
  2011. InputConfigNode, FacesNode, FaceNode: IXMLNode;
  2012. iLoop, jLoop: Integer;
  2013. Face: TFace;
  2014. begin
  2015. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2016. XMLDocument := TXMLDocument.Create(Self);
  2017. try
  2018. XMLDocument.Active := True;
  2019. if not FileExists(XMLFile) then
  2020. begin
  2021. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2022. XMLDocument.Active := True;
  2023. //删除系统表情
  2024. XMLDocument.LoadFromFile(XMLFile);
  2025. InputConfigNode := XMLDocument.DocumentElement;
  2026. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2027. FacesNode.ChildNodes.Clear;
  2028. XMLDocument.SaveToFile();
  2029. XMLDocument.Active := False;
  2030. end;
  2031. XMLDocument.Active := True;
  2032. XMLDocument.LoadFromFile(XMLFile);
  2033. InputConfigNode := XMLDocument.DocumentElement;
  2034. if InputConfigNode.ChildNodes.FindNode('FaceCategory') = nil then
  2035. begin
  2036. InputConfigNode.AddChild('FaceCategory').Text := '';
  2037. XMLDocument.SaveToFile();
  2038. end;
  2039. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2040. FacesNode.ChildNodes.Clear;
  2041. FaceCategorys := '';
  2042. for iLoop := 0 to FFaceCategory.Count - 1 do
  2043. begin
  2044. for jLoop := FSystemFaceCount to FaceList.Count - 1 do
  2045. begin
  2046. Face := FaceList.Objects[jLoop] as TFace;
  2047. if AnsiSameText(Face.Category, FFaceCategory[iLoop]) then
  2048. begin
  2049. FaceNode := FacesNode.AddChild('Face');
  2050. FaceNode.Text := ExtractFileName(Face.FileName);
  2051. FaceNode.Attributes['ShortCut'] := Face.ShortCut;
  2052. FaceNode.Attributes['Name'] := Face.Name;
  2053. FaceNode.Attributes['MD5Code'] := Face.MD5Code;
  2054. FaceNode.Attributes['Category'] := Face.Category;
  2055. end;
  2056. end;
  2057. if iLoop < FFaceCategory.Count - 1 then
  2058. FaceCategorys := FaceCategorys + FFaceCategory[iLoop] + ','
  2059. else
  2060. FaceCategorys := FaceCategorys + FFaceCategory[iLoop];
  2061. end;
  2062. InputConfigNode.ChildNodes.FindNode('FaceCategory').Text := FaceCategorys;
  2063. if SelFaceForm <> nil then
  2064. SelFaceForm.ReDrawFaces;
  2065. XMLDocument.SaveToFile();
  2066. finally
  2067. XMLDocument.Free;
  2068. end;
  2069. end;
  2070. //------------------------------------------------------------------------------
  2071. procedure TMainForm.SaveInputFontConfig;
  2072. var
  2073. XMLFile: string;
  2074. XMLDocument: TXMLDocument;
  2075. InputConfigNode, FacesNode: IXMLNode;
  2076. begin
  2077. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2078. XMLDocument := TXMLDocument.Create(Self);
  2079. try
  2080. XMLDocument.Active := True;
  2081. if not FileExists(XMLFile) then
  2082. begin
  2083. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2084. XMLDocument.Active := True;
  2085. //删除系统表情
  2086. XMLDocument.LoadFromFile(XMLFile);
  2087. InputConfigNode := XMLDocument.DocumentElement;
  2088. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2089. FacesNode.ChildNodes.Clear;
  2090. XMLDocument.SaveToFile();
  2091. XMLDocument.Active := False;
  2092. end;
  2093. XMLDocument.Active := True;
  2094. XMLDocument.LoadFromFile(XMLFile);
  2095. InputConfigNode := XMLDocument.DocumentElement;
  2096. try
  2097. InputConfigNode.ChildNodes.FindNode('Font').Text := FontToString(FInputFont);
  2098. except
  2099. InputConfigNode.ChildNodes.FindNode('Font').Text := FontToString(Font);
  2100. end;
  2101. XMLDocument.SaveToFile();
  2102. finally
  2103. XMLDocument.Free;
  2104. end;
  2105. end;
  2106. //------------------------------------------------------------------------------
  2107. procedure TMainForm.LoadInputConfigs;
  2108. var
  2109. XMLFile: string;
  2110. XMLDocument: TXMLDocument;
  2111. InputConfigNode, FacesNode, FaceNode: IXMLNode;
  2112. Face: TFace;
  2113. iLoop: Integer;
  2114. Category: string;
  2115. begin
  2116. FInputFont.Assign(Font);
  2117. {$region '删除前一个用户的表情'}
  2118. while FFaceList.Count > 0 do
  2119. begin
  2120. FFaceList.Objects[0].Free;
  2121. FFaceList.Delete(0);
  2122. end;
  2123. FFaceList.Clear;
  2124. while FTempFaceList.Count > 0 do
  2125. begin
  2126. FTempFaceList.Objects[0].Free;
  2127. FTempFaceList.Delete(0);
  2128. end;
  2129. FTempFaceList.Clear;
  2130. FFaceCategory.Clear;
  2131. FSystemFaceCount := 0;
  2132. {$endregion}
  2133. {$region '读取系统表情'}
  2134. FFaceCategory.Add(SystemFaceGroup);
  2135. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile;
  2136. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2137. XMLDocument := TXMLDocument.Create(Self);
  2138. try
  2139. XMLDocument.Active := True;
  2140. XMLDocument.LoadFromFile(XMLFile);
  2141. InputConfigNode := XMLDocument.DocumentElement;
  2142. try
  2143. StringToFont(InputConfigNode.ChildNodes.FindNode('Font').Text, FInputFont);
  2144. except
  2145. FInputFont.Assign(Font);
  2146. end;
  2147. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2148. for iLoop := 0 to FacesNode.ChildNodes.Count - 1 do
  2149. begin
  2150. FaceNode := FacesNode.ChildNodes[iLoop];
  2151. Face := TFace.Create(ExtractFilePath(paramstr(0)) + FaceNode.Text, FaceNode.Attributes['ShortCut'], FaceNode.Attributes['Name'], '', SystemFaceGroup);
  2152. FFaceList.AddObject(Face.ShortCut, Face);
  2153. Inc(FSystemFaceCount);
  2154. end;
  2155. finally
  2156. XMLDocument.Free;
  2157. end;
  2158. {$endregion}
  2159. {$region '读取自定义表情'}
  2160. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2161. XMLDocument := TXMLDocument.Create(Self);
  2162. try
  2163. XMLDocument.Active := True;
  2164. if not FileExists(XMLFile) then
  2165. begin
  2166. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2167. XMLDocument.Active := True;
  2168. //删除系统表情
  2169. XMLDocument.LoadFromFile(XMLFile);
  2170. InputConfigNode := XMLDocument.DocumentElement;
  2171. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2172. FacesNode.ChildNodes.Clear;
  2173. XMLDocument.SaveToFile();
  2174. XMLDocument.Active := False;
  2175. end;
  2176. XMLDocument.Active := True;
  2177. XMLDocument.LoadFromFile(XMLFile);
  2178. InputConfigNode := XMLDocument.DocumentElement;
  2179. try
  2180. StringToFont(InputConfigNode.ChildNodes.FindNode('Font').Text, FInputFont);
  2181. except
  2182. FInputFont.Assign(Font);
  2183. end;
  2184. if InputConfigNode.ChildNodes.FindNode('FaceCategory') = nil then
  2185. begin
  2186. InputConfigNode.AddChild('FaceCategory').Text := '';
  2187. XMLDocument.SaveToFile();
  2188. end;
  2189. FreeAndNil(FFaceCategory);
  2190. FFaceCategory := SplitString(InputConfigNode.ChildNodes.FindNode('FaceCategory').Text, ',');
  2191. if FFaceCategory.IndexOf('') >= 0 then
  2192. FFaceCategory.Delete(FFaceCategory.IndexOf(''));
  2193. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2194. for iLoop := 0 to FacesNode.ChildNodes.Count - 1 do
  2195. begin
  2196. FaceNode := FacesNode.ChildNodes[iLoop];
  2197. try
  2198. Category := FaceNode.Attributes['Category'];
  2199. except
  2200. Category := NOFaceCategory;
  2201. end;
  2202. if FFaceCategory.IndexOf(Category) = -1 then
  2203. begin
  2204. if AnsiSameText(Category, NOFaceCategory) then
  2205. FFaceCategory.Insert(0, Category)
  2206. else
  2207. FFaceCategory.Add(Category);
  2208. end;
  2209. Face := TFace.Create(TRealICQClient.GetCustomFaceDir + FaceNode.Text, FaceNode.Attributes['ShortCut'], FaceNode.Attributes['Name'], FaceNode.Attributes['MD5Code'], Category);
  2210. FFaceList.AddObject(Face.MD5Code, Face);
  2211. end;
  2212. finally
  2213. XMLDocument.Free;
  2214. end;
  2215. {$endregion}
  2216. end;
  2217. //------------------------------------------------------------------------------
  2218. procedure TMainForm.LoadSafeConfigs;
  2219. var
  2220. XMLFile: string;
  2221. XMLDocument: TXMLDocument;
  2222. SafeConfigNode: IXMLNode;
  2223. begin
  2224. XMLFile := TRealICQClient.GetUserDir + SafeConfigXMLFile;
  2225. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2226. XMLDocument := TXMLDocument.Create(Self);
  2227. try
  2228. XMLDocument.Active := True;
  2229. if not FileExists(XMLFile) then
  2230. begin
  2231. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SafeConfigXMLFile), PChar(XMLFile), False);
  2232. XMLDocument.Active := True;
  2233. end;
  2234. XMLDocument.LoadFromFile(XMLFile);
  2235. SafeConfigNode := XMLDocument.DocumentElement;
  2236. FRecvFileSafeLevel := TRecvFileSafeLevel(Integer(SafeConfigNode.ChildNodes.FindNode('RecvFileSafeLevel').Attributes['Value']));
  2237. FAllowURL := SafeConfigNode.ChildNodes.FindNode('AllowURL').Attributes['Value'];
  2238. FShowHistoryInNewWindow := SafeConfigNode.ChildNodes.FindNode('ShowHistoryInNewWindow').Attributes['Value'];
  2239. FAutoSaveMessage := SafeConfigNode.ChildNodes.FindNode('AutoSaveMessage').Attributes['Value'];
  2240. finally
  2241. XMLDocument.Free;
  2242. end;
  2243. end;
  2244. //------------------------------------------------------------------------------
  2245. procedure TMainForm.SaveSafeConfigs;
  2246. var
  2247. XMLFile: string;
  2248. XMLDocument: TXMLDocument;
  2249. SafeConfigNode: IXMLNode;
  2250. begin
  2251. XMLFile := TRealICQClient.GetUserDir + SafeConfigXMLFile;
  2252. XMLDocument := TXMLDocument.Create(Self);
  2253. try
  2254. XMLDocument.Active := True;
  2255. if not FileExists(XMLFile) then
  2256. begin
  2257. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SafeConfigXMLFile), PChar(XMLFile), False);
  2258. XMLDocument.Active := True;
  2259. end;
  2260. XMLDocument.LoadFromFile(XMLFile);
  2261. SafeConfigNode := XMLDocument.DocumentElement;
  2262. SafeConfigNode.ChildNodes.FindNode('RecvFileSafeLevel').Attributes['Value'] := Integer(FRecvFileSafeLevel);
  2263. SafeConfigNode.ChildNodes.FindNode('AllowURL').Attributes['Value'] := FAllowURL;
  2264. SafeConfigNode.ChildNodes.FindNode('ShowHistoryInNewWindow').Attributes['Value'] := FShowHistoryInNewWindow;
  2265. SafeConfigNode.ChildNodes.FindNode('AutoSaveMessage').Attributes['Value'] := FAutoSaveMessage;
  2266. XMLDocument.SaveToFile();
  2267. finally
  2268. XMLDocument.Free;
  2269. end;
  2270. end;
  2271. //------------------------------------------------------------------------------
  2272. procedure TMainForm.LoadWebPanelsFromXML;
  2273. var
  2274. ADesKey: string;
  2275. iLoop: Integer;
  2276. XMLFile: string;
  2277. XMLDocument: TXMLDocument;
  2278. WebPanelsNode, WebPanelNode: IXMLNode;
  2279. WebPanel: TWebPanel;
  2280. begin
  2281. XMLFile := TRealICQClient.GetUserDir + WebPanelsXMLFile;
  2282. XMLDocument := TXMLDocument.Create(Self);
  2283. try
  2284. try
  2285. XMLDocument.Active := True;
  2286. if not FileExists(XMLFile) then
  2287. begin
  2288. XMLDocument.XML.Text := '<?xml version="1.0"?>' + '<WebPanels>' + '</WebPanels>';
  2289. XMLDocument.Active := True;
  2290. XMLDocument.SaveToFile(XMLFile);
  2291. end
  2292. else
  2293. begin
  2294. XMLDocument.LoadFromFile(XMLFile);
  2295. end;
  2296. WebPanelsNode := XMLDocument.DocumentElement;
  2297. while FWebPanels.Count > 0 do
  2298. begin
  2299. FWebPanels.Objects[0].Free;
  2300. FWebPanels.Delete(0);
  2301. end;
  2302. FWebPanels.Clear;
  2303. ADesKey := MD5En(RealICQClient.LoginName);
  2304. for iLoop := WebPanelsNode.ChildNodes.Count - 1 downto 0 do
  2305. begin
  2306. WebPanelNode := WebPanelsNode.ChildNodes[iLoop];
  2307. WebPanel := TWebPanel.Create;
  2308. try
  2309. WebPanel.FMustShow := WebPanelNode.Attributes['MustShow'];
  2310. except
  2311. WebPanel.FMustShow := False;
  2312. end;
  2313. try
  2314. WebPanel.FShow := WebPanelNode.Attributes['Show'];
  2315. except
  2316. WebPanel.FShow := False;
  2317. end;
  2318. try
  2319. WebPanel.FID := WebPanelNode.Attributes['ID'];
  2320. except
  2321. WebPanel.FID := '';
  2322. end;
  2323. WebPanel.FName := DESryStrHex(WebPanelNode.Attributes['Name'], ADesKey);
  2324. WebPanel.FURL := DESryStrHex(WebPanelNode.Attributes['URL'], ADesKey);
  2325. WebPanel.FImage := DESryStrHex(WebPanelNode.Attributes['Image'], ADesKey);
  2326. WebPanel.FNavigateType := WebPanelNode.Attributes['NavigateType'];
  2327. WebPanel.FPostFields := DESryStrHex(WebPanelNode.Attributes['PostFields'], ADesKey);
  2328. WebPanel.FUserIMLoginName := WebPanelNode.Attributes['UserIMLoginName'];
  2329. WebPanel.FUserIMPassword := WebPanelNode.Attributes['UserIMPassword'];
  2330. WebPanel.FCustomLoginName := DESryStrHex(WebPanelNode.Attributes['CustomLoginName'], ADesKey);
  2331. WebPanel.FCustomPassword := DESryStrHex(WebPanelNode.Attributes['CustomPassword'], ADesKey);
  2332. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  2333. end;
  2334. except
  2335. end;
  2336. finally
  2337. XMLDocument.Free;
  2338. end;
  2339. end;
  2340. //------------------------------------------------------------------------------
  2341. procedure TMainForm.SaveWebPanelsToXML;
  2342. var
  2343. ADesKey: string;
  2344. iLoop: Integer;
  2345. XMLFile: string;
  2346. XMLDocument: TXMLDocument;
  2347. WebPanelsNode, WebPanelNode: IXMLNode;
  2348. WebPanel: TWebPanel;
  2349. begin
  2350. XMLFile := TRealICQClient.GetUserDir + WebPanelsXMLFile;
  2351. XMLDocument := TXMLDocument.Create(Self);
  2352. try
  2353. try
  2354. XMLDocument.Active := True;
  2355. if not FileExists(XMLFile) then
  2356. begin
  2357. XMLDocument.XML.Text := '<?xml version="1.0"?>' + '<WebPanels>' + '</WebPanels>';
  2358. XMLDocument.Active := True;
  2359. end
  2360. else
  2361. begin
  2362. XMLDocument.LoadFromFile(XMLFile);
  2363. end;
  2364. WebPanelsNode := XMLDocument.DocumentElement;
  2365. ADesKey := MD5En(RealICQClient.LoginName);
  2366. WebPanelsNode.ChildNodes.Clear;
  2367. for iLoop := 0 to FWebPanels.Count - 1 do
  2368. begin
  2369. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  2370. WebPanelNode := WebPanelsNode.AddChild('WebPanel');
  2371. WebPanelNode.Attributes['MustShow'] := WebPanel.FMustShow;
  2372. WebPanelNode.Attributes['Show'] := WebPanel.FShow;
  2373. WebPanelNode.Attributes['ID'] := WebPanel.FID;
  2374. WebPanelNode.Attributes['Name'] := EncryStrHex(WebPanel.FName, ADesKey);
  2375. WebPanelNode.Attributes['URL'] := EncryStrHex(WebPanel.FURL, ADesKey);
  2376. WebPanelNode.Attributes['Image'] := EncryStrHex(WebPanel.FImage, ADesKey);
  2377. WebPanelNode.Attributes['NavigateType'] := WebPanel.FNavigateType;
  2378. WebPanelNode.Attributes['PostFields'] := EncryStrHex(WebPanel.FPostFields, ADesKey);
  2379. WebPanelNode.Attributes['UserIMLoginName'] := WebPanel.FUserIMLoginName;
  2380. WebPanelNode.Attributes['UserIMPassword'] := WebPanel.FUserIMPassword;
  2381. WebPanelNode.Attributes['CustomLoginName'] := EncryStrHex(WebPanel.FCustomLoginName, ADesKey);
  2382. WebPanelNode.Attributes['CustomPassword'] := EncryStrHex(WebPanel.FCustomPassword, ADesKey);
  2383. end;
  2384. XMLDocument.SaveToFile(XMLFile);
  2385. except
  2386. end;
  2387. finally
  2388. XMLDocument.Free;
  2389. end;
  2390. end;
  2391. {
  2392. //----------------------------------------------------------
  2393. procedure TMainForm.LoadSysMsgInterfaceConfig;
  2394. var
  2395. XMLFile: String;
  2396. XMLDocument: TXMLDocument;
  2397. ConfigNodes,ConfigNode: IXMLNode;
  2398. iLoop:Integer;
  2399. SysMsgInterface:TSysMsgInterface;
  2400. MsgIID:String;
  2401. begin
  2402. XMLFile := TRealICQClient.GetUserDir+SysMsgInterfaceConfig;
  2403. XMLDocument := TXMLDocument.Create(Self);
  2404. try
  2405. try
  2406. XMLDocument.Active := True;
  2407. if not FileExists(XMLFile) then
  2408. begin
  2409. XMLDocument.XML.Text := '<?xml version="1.0"?>' +
  2410. '<SysMsgInterfaces>' +
  2411. '</SysMsgInterfaces>';
  2412. XMLDocument.Active := True;
  2413. XMLDocument.SaveToFile(XMLFile);
  2414. end
  2415. else
  2416. begin
  2417. XMLDocument.LoadFromFile(XMLFile);
  2418. end;
  2419. ConfigNodes := XMLDocument.DocumentElement;
  2420. for iLoop := 0 to ConfigNodes.ChildNodes.Count - 1 do
  2421. begin
  2422. ConfigNode:=ConfigNodes.ChildNodes[iLoop];
  2423. MsgIID:=ConfigNode.Attributes['MsgIID'];
  2424. if MainForm.RealICQClient.SysMsgInterfaces.IndexOf(MsgIID)>=0 then
  2425. begin
  2426. SysMsgInterface:=MainForm.RealICQClient.SysMsgInterfaces.Objects[MainForm.RealICQClient.SysMsgInterfaces.IndexOf(MsgIID)] as TSysMsgInterface;
  2427. SysMsgInterface.ShowMsg:=ConfigNode.Attributes['ShowMsg'];
  2428. end;
  2429. end;
  2430. except
  2431. //
  2432. end;
  2433. finally
  2434. XMLDocument.Free;
  2435. end;
  2436. end; }
  2437. {
  2438. //-----------------------------------------------------------
  2439. procedure TMainForm.SaveSysMsgInterfaceConfig;
  2440. var
  2441. XMLFile: String;
  2442. XMLDocument: TXMLDocument;
  2443. ConfigNodes,ConfigNode: IXMLNode;
  2444. iLoop:Integer;
  2445. SysMsgInterface:TSysMsgInterface;
  2446. begin
  2447. XMLFile := TRealICQClient.GetUserDir+SysMsgInterfaceConfig;
  2448. XMLDocument := TXMLDocument.Create(Self);
  2449. try
  2450. try
  2451. XMLDocument.Active := True;
  2452. if not FileExists(XMLFile) then
  2453. begin
  2454. XMLDocument.XML.Text := '<?xml version="1.0"?>' +
  2455. '<SysMsgInterfaces>' +
  2456. '</SysMsgInterfaces>';
  2457. XMLDocument.Active := True;
  2458. end
  2459. else
  2460. begin
  2461. XMLDocument.LoadFromFile(XMLFile);
  2462. end;
  2463. ConfigNodes := XMLDocument.DocumentElement;
  2464. ConfigNodes.ChildNodes.Clear;
  2465. for iLoop := 0 to MainForm.RealICQClient.SysMsgInterfaces.Count - 1 do
  2466. begin
  2467. SysMsgInterface:=MainForm.RealICQClient.SysMsgInterfaces.Objects[iLoop] as TSysMsgInterface;
  2468. ConfigNode:=ConfigNodes.AddChild('SysMsgInterface');
  2469. ConfigNode.Attributes['MsgIID']:=SysMsgInterface.MsgIID;
  2470. ConfigNode.Attributes['ShowMsg']:=SysMsgInterface.ShowMsg;
  2471. end;
  2472. XMLDocument.SaveToFile(XMLFile);
  2473. except
  2474. end;
  2475. finally
  2476. XMLDocument.Free;
  2477. end;
  2478. end; }
  2479. //------------------------------------------------------------------------------
  2480. procedure TMainForm.LoadReceiveFileConfigs;
  2481. var
  2482. XMLFile: string;
  2483. XMLDocument: TXMLDocument;
  2484. ReceiveFileConfigNode: IXMLNode;
  2485. begin
  2486. XMLFile := TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile;
  2487. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2488. XMLDocument := TXMLDocument.Create(Self);
  2489. try
  2490. XMLDocument.Active := True;
  2491. if not FileExists(XMLFile) then
  2492. begin
  2493. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + ReceiveFileConfigXMLFile), PChar(XMLFile), False);
  2494. XMLDocument.Active := True;
  2495. end;
  2496. XMLDocument.LoadFromFile(XMLFile);
  2497. ReceiveFileConfigNode := XMLDocument.DocumentElement;
  2498. FRecvFileDir := ReceiveFileConfigNode.ChildNodes.FindNode('RecvFileDir').Attributes['Value'];
  2499. FUseCacheDir := ReceiveFileConfigNode.ChildNodes.FindNode('UseCacheDir').Attributes['Value'];
  2500. FCacheDir := ReceiveFileConfigNode.ChildNodes.FindNode('CacheDir').Attributes['Value'];
  2501. FLimitCacheDirSize := ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['Value'];
  2502. FMaxCacheDirSize := ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['MaxSize'];
  2503. FAudoDeleteCacheFile := ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Value'];
  2504. FAudoDeleteCacheFileDate := ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Date'];
  2505. FScanVirus := ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Value'];
  2506. FScanVirusProgram := ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Program'];
  2507. FDontUseCacheFileOnBigFile := ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Value'];
  2508. FDontUseCacheFileOnBigFileSize := ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Size'];
  2509. if not DirectoryExists(FRecvFileDir) then
  2510. begin
  2511. FRecvFileDir := RealICQClient.GetUserDir + '我接收到的文件\';
  2512. if not DirectoryExists(FRecvFileDir) then
  2513. CreateDir(FRecvFileDir);
  2514. end;
  2515. if (not DirectoryExists(FCacheDir)) and FUseCacheDir then
  2516. begin
  2517. FCacheDir := RealICQClient.GetUserDir + 'CacheFiles\';
  2518. if not DirectoryExists(FCacheDir) then
  2519. CreateDir(FCacheDir);
  2520. end;
  2521. finally
  2522. XMLDocument.Free;
  2523. end;
  2524. end;
  2525. //------------------------------------------------------------------------------
  2526. procedure TMainForm.SaveReceiveFileConfigs;
  2527. var
  2528. XMLFile: string;
  2529. XMLDocument: TXMLDocument;
  2530. ReceiveFileConfigNode: IXMLNode;
  2531. begin
  2532. XMLFile := TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile;
  2533. XMLDocument := TXMLDocument.Create(Self);
  2534. try
  2535. XMLDocument.Active := True;
  2536. if not FileExists(XMLFile) then
  2537. begin
  2538. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + ReceiveFileConfigXMLFile), PChar(XMLFile), False);
  2539. XMLDocument.Active := True;
  2540. end;
  2541. XMLDocument.LoadFromFile(XMLFile);
  2542. ReceiveFileConfigNode := XMLDocument.DocumentElement;
  2543. ReceiveFileConfigNode.ChildNodes.FindNode('RecvFileDir').Attributes['Value'] := FRecvFileDir;
  2544. ReceiveFileConfigNode.ChildNodes.FindNode('UseCacheDir').Attributes['Value'] := FUseCacheDir;
  2545. ReceiveFileConfigNode.ChildNodes.FindNode('CacheDir').Attributes['Value'] := FCacheDir;
  2546. ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['Value'] := FLimitCacheDirSize;
  2547. ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['MaxSize'] := FMaxCacheDirSize;
  2548. ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Value'] := FAudoDeleteCacheFile;
  2549. ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Date'] := FAudoDeleteCacheFileDate;
  2550. ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Value'] := FScanVirus;
  2551. ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Program'] := FScanVirusProgram;
  2552. ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Value'] := FDontUseCacheFileOnBigFile;
  2553. ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Size'] := FDontUseCacheFileOnBigFileSize;
  2554. XMLDocument.SaveToFile();
  2555. finally
  2556. XMLDocument.Free;
  2557. end;
  2558. end;
  2559. //------------------------------------------------------------------------------
  2560. procedure TMainForm.LoadOfflineAutoResponseSets;
  2561. var
  2562. XMLFile: string;
  2563. XMLDocument: TXMLDocument;
  2564. OfflineAutoResponseConfigNode, TextNode: IXMLNode;
  2565. iLoop: Integer;
  2566. begin
  2567. XMLFile := TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile;
  2568. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2569. XMLDocument := TXMLDocument.Create(Self);
  2570. try
  2571. XMLDocument.Active := True;
  2572. if not FileExists(XMLFile) then
  2573. begin
  2574. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + OfflineAutoResponseConfigXMLFile), PChar(XMLFile), False);
  2575. XMLDocument.Active := True;
  2576. end;
  2577. XMLDocument.LoadFromFile(XMLFile);
  2578. OfflineAutoResponseConfigNode := XMLDocument.DocumentElement;
  2579. FOfflineAutoResponseTexts.Clear;
  2580. for iLoop := 0 to OfflineAutoResponseConfigNode.ChildNodes.Count - 1 do
  2581. begin
  2582. TextNode := OfflineAutoResponseConfigNode.ChildNodes[iLoop];
  2583. FOfflineAutoResponseTexts.Add(TextNode.Text);
  2584. end;
  2585. finally
  2586. XMLDocument.Free;
  2587. end;
  2588. end;
  2589. //------------------------------------------------------------------------------
  2590. procedure TMainForm.SaveOfflineAutoResponseSets;
  2591. var
  2592. XMLFile: string;
  2593. XMLDocument: TXMLDocument;
  2594. OfflineAutoResponseConfigNode: IXMLNode;
  2595. iLoop: Integer;
  2596. begin
  2597. XMLFile := TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile;
  2598. XMLDocument := TXMLDocument.Create(Self);
  2599. try
  2600. XMLDocument.Active := True;
  2601. if not FileExists(XMLFile) then
  2602. begin
  2603. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + OfflineAutoResponseConfigXMLFile), PChar(XMLFile), False);
  2604. XMLDocument.Active := True;
  2605. end;
  2606. XMLDocument.LoadFromFile(XMLFile);
  2607. OfflineAutoResponseConfigNode := XMLDocument.DocumentElement;
  2608. OfflineAutoResponseConfigNode.ChildNodes.Clear;
  2609. for iLoop := 0 to FOfflineAutoResponseTexts.Count - 1 do
  2610. begin
  2611. OfflineAutoResponseConfigNode.AddChild('Text').Text := FOfflineAutoResponseTexts.Strings[iLoop];
  2612. end;
  2613. finally
  2614. XMLDocument.SaveToFile();
  2615. XMLDocument.Free;
  2616. end;
  2617. end;
  2618. //------------------------------------------------------------------------------
  2619. procedure TMainForm.LoadHintAndSoundConfigs;
  2620. var
  2621. XMLFile: string;
  2622. XMLDocument: TXMLDocument;
  2623. HintAndSoundConfigNode: IXMLNode;
  2624. begin
  2625. XMLFile := TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile;
  2626. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2627. XMLDocument := TXMLDocument.Create(Self);
  2628. try
  2629. XMLDocument.Active := True;
  2630. if not FileExists(XMLFile) then
  2631. begin
  2632. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HintAndSoundConfigXMLFile), PChar(XMLFile), False);
  2633. XMLDocument.Active := True;
  2634. end;
  2635. XMLDocument.LoadFromFile(XMLFile);
  2636. HintAndSoundConfigNode := XMLDocument.DocumentElement;
  2637. FFlashCaptionOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('FlashCaptionOnOnline').Attributes['Value'];
  2638. FFlashCaptionOnOnline := False;
  2639. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  2640. FShowHintOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOnline').Attributes['Value'];
  2641. FShowHintOnOffline := HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOffline').Attributes['Value'];
  2642. FDontShowHintOnBusy := HintAndSoundConfigNode.ChildNodes.FindNode('DontShowHintOnBusy').Attributes['Value'];
  2643. FPlaySoundOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['Value'];
  2644. FPlaySoundOnOffline := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['Value'];
  2645. FPlaySoundOnGetMessage := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['Value'];
  2646. FPlaySoundOnGetSystemMessage := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['Value'];
  2647. FFlashImageOnGetMessage := HintAndSoundConfigNode.ChildNodes.FindNode('FlashImageOnGetMessage').Attributes['Value'];
  2648. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow')) then
  2649. begin
  2650. HintAndSoundConfigNode.AddChild('ShowShakeWindow').Attributes['Value'] := True;
  2651. XMLDocument.SaveToFile();
  2652. end;
  2653. FShowShakeWindow := HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow').Attributes['Value'];
  2654. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage')) then
  2655. begin
  2656. HintAndSoundConfigNode.AddChild('ShowCustomMessage').Attributes['Value'] := True;
  2657. XMLDocument.SaveToFile();
  2658. end;
  2659. FShowCustomMessage := HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage').Attributes['Value'];
  2660. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted')) then
  2661. begin
  2662. HintAndSoundConfigNode.AddChild('ShowFileTransCompleted').Attributes['Value'] := True;
  2663. XMLDocument.SaveToFile();
  2664. end;
  2665. FShowFileTransCompleted := HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted').Attributes['Value'];
  2666. FOnlineEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['File'];
  2667. FOfflineEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['File'];
  2668. FMessageEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['File'];
  2669. FSystemMessageEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['File'];
  2670. if AnsiSameText(Copy(FOnlineEventSound, 1, 5), 'Sound') then
  2671. FOnlineEventSound := ExtractFilePath(paramstr(0)) + FOnlineEventSound;
  2672. if AnsiSameText(Copy(FOfflineEventSound, 1, 5), 'Sound') then
  2673. FOfflineEventSound := ExtractFilePath(paramstr(0)) + FOfflineEventSound;
  2674. if AnsiSameText(Copy(FMessageEventSound, 1, 5), 'Sound') then
  2675. FMessageEventSound := ExtractFilePath(paramstr(0)) + FMessageEventSound;
  2676. if AnsiSameText(Copy(FSystemMessageEventSound, 1, 5), 'Sound') then
  2677. FSystemMessageEventSound := ExtractFilePath(paramstr(0)) + FSystemMessageEventSound;
  2678. finally
  2679. XMLDocument.Free;
  2680. end;
  2681. end;
  2682. //------------------------------------------------------------------------------
  2683. procedure TMainForm.SaveHintAndSoundConfigs;
  2684. var
  2685. XMLFile: string;
  2686. XMLDocument: TXMLDocument;
  2687. HintAndSoundConfigNode: IXMLNode;
  2688. begin
  2689. XMLFile := TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile;
  2690. XMLDocument := TXMLDocument.Create(Self);
  2691. try
  2692. XMLDocument.Active := True;
  2693. if not FileExists(XMLFile) then
  2694. begin
  2695. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HintAndSoundConfigXMLFile), PChar(XMLFile), False);
  2696. XMLDocument.Active := True;
  2697. end;
  2698. XMLDocument.LoadFromFile(XMLFile);
  2699. HintAndSoundConfigNode := XMLDocument.DocumentElement;
  2700. HintAndSoundConfigNode.ChildNodes.FindNode('FlashCaptionOnOnline').Attributes['Value'] := FFlashCaptionOnOnline;
  2701. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  2702. HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOnline').Attributes['Value'] := FShowHintOnOnline;
  2703. HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOffline').Attributes['Value'] := FShowHintOnOffline;
  2704. HintAndSoundConfigNode.ChildNodes.FindNode('DontShowHintOnBusy').Attributes['Value'] := FDontShowHintOnBusy;
  2705. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['Value'] := FPlaySoundOnOnline;
  2706. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['Value'] := FPlaySoundOnOffline;
  2707. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['Value'] := FPlaySoundOnGetMessage;
  2708. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['Value'] := FPlaySoundOnGetSystemMessage;
  2709. HintAndSoundConfigNode.ChildNodes.FindNode('FlashImageOnGetMessage').Attributes['Value'] := FFlashImageOnGetMessage;
  2710. HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow').Attributes['Value'] := FShowShakeWindow;
  2711. HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage').Attributes['Value'] := FShowCustomMessage;
  2712. HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted').Attributes['Value'] := FShowFileTransCompleted;
  2713. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['File'] := FOnlineEventSound;
  2714. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['File'] := FOfflineEventSound;
  2715. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['File'] := FMessageEventSound;
  2716. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['File'] := FSystemMessageEventSound;
  2717. XMLDocument.SaveToFile();
  2718. finally
  2719. XMLDocument.Free;
  2720. end;
  2721. end;
  2722. //------------------------------------------------------------------------------
  2723. procedure TMainForm.LoadHotKeyConfigs;
  2724. var
  2725. XMLFile: string;
  2726. XMLDocument: TXMLDocument;
  2727. HotKeyConfigNode: IXMLNode;
  2728. begin
  2729. XMLFile := TRealICQClient.GetUserDir + HotKeyConfigXMLFile;
  2730. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2731. XMLDocument := TXMLDocument.Create(Self);
  2732. try
  2733. XMLDocument.Active := True;
  2734. if not FileExists(XMLFile) then
  2735. begin
  2736. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HotKeyConfigXMLFile), PChar(XMLFile), False);
  2737. XMLDocument.Active := True;
  2738. end;
  2739. XMLDocument.LoadFromFile(XMLFile);
  2740. HotKeyConfigNode := XMLDocument.DocumentElement;
  2741. ReadMessageHotKey := HotKeyConfigNode.ChildNodes.FindNode('ReadMessage').Attributes['Key'];
  2742. CopyScreenHotKey := HotKeyConfigNode.ChildNodes.FindNode('CopyScreen').Attributes['Key'];
  2743. finally
  2744. XMLDocument.Free;
  2745. end;
  2746. end;
  2747. //------------------------------------------------------------------------------
  2748. procedure TMainForm.SaveHotKeyConfigs;
  2749. var
  2750. XMLFile: string;
  2751. XMLDocument: TXMLDocument;
  2752. HotKeyConfigNode: IXMLNode;
  2753. begin
  2754. XMLFile := TRealICQClient.GetUserDir + HotKeyConfigXMLFile;
  2755. XMLDocument := TXMLDocument.Create(Self);
  2756. try
  2757. XMLDocument.Active := True;
  2758. if not FileExists(XMLFile) then
  2759. begin
  2760. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HotKeyConfigXMLFile), PChar(XMLFile), False);
  2761. XMLDocument.Active := True;
  2762. end;
  2763. XMLDocument.LoadFromFile(XMLFile);
  2764. HotKeyConfigNode := XMLDocument.DocumentElement;
  2765. HotKeyConfigNode.ChildNodes.FindNode('ReadMessage').Attributes['Key'] := FReadMessageHotKey;
  2766. HotKeyConfigNode.ChildNodes.FindNode('CopyScreen').Attributes['Key'] := FCopyScreenHotKey;
  2767. XMLDocument.SaveToFile();
  2768. finally
  2769. XMLDocument.Free;
  2770. end;
  2771. end;
  2772. procedure TMainForm.SetCopyScreenHotKey(Value: string);
  2773. var
  2774. HotKeyStr: string;
  2775. HotKey, ModKey: Cardinal;
  2776. begin
  2777. if FCopyScreenHotKey = Value then
  2778. Exit;
  2779. FCopyScreenHotKey := Value;
  2780. if AnsiPos('+', FCopyScreenHotKey) <= 0 then
  2781. FCopyScreenHotKey := 'CTRL+ALT+S';
  2782. HotKeyStr := CutOffString(trim(FCopyScreenHotKey), '+');
  2783. if AnsiPos('+', HotKeyStr) > 0 then
  2784. HotKeyStr := CutOffString(HotKeyStr, '+');
  2785. HotKey := Ord(PChar(UpperCase(HotKeyStr))[0]);
  2786. if HotKeyID_CopyScreen <> 0 then
  2787. begin
  2788. UnregisterHotKey(Handle, HotKeyID_CopyScreen);
  2789. DeleteAtom(HotKeyID_CopyScreen);
  2790. end;
  2791. if (FindAtom('FCopyScreenHotKey') = 0) and (HotKey > 0) then
  2792. begin
  2793. HotKeyID_CopyScreen := GlobalAddAtom(pchar('FCopyScreenHotKey')) - $C000;
  2794. ModKey := GetModKey(FCopyScreenHotKey);
  2795. if (not RegisterHotkey(Handle, HotKeyID_CopyScreen, ModKey, HotKey)) then
  2796. begin
  2797. FCanAlert := True;
  2798. ShowNotifyAlertForm('热键 ' + FCopyScreenHotKey + ' 冲突!');
  2799. FCanAlert := False;
  2800. end;
  2801. //MessageBox(Handle, PChar('热键 '+ FCopyScreenHotKey + ' 已被其它程序注册,请选择其它热键!'), '提示', MB_ICONERROR);
  2802. end;
  2803. SaveHotKeyConfigs;
  2804. end;
  2805. //------------------------------------------------------------------------------
  2806. procedure TMainForm.SetReadMessageHotKey(Value: string);
  2807. var
  2808. HotKeyStr: string;
  2809. HotKey, ModKey: Cardinal;
  2810. begin
  2811. if FReadMessageHotKey = Value then
  2812. Exit;
  2813. FReadMessageHotKey := Value;
  2814. if AnsiPos('+', FReadMessageHotKey) <= 0 then
  2815. FReadMessageHotKey := 'CTRL+ALT+X';
  2816. HotKeyStr := CutOffString(trim(FReadMessageHotKey), '+');
  2817. if AnsiPos('+', HotKeyStr) > 0 then
  2818. HotKeyStr := CutOffString(HotKeyStr, '+');
  2819. HotKey := Ord(PChar(UpperCase(HotKeyStr))[0]);
  2820. if HotKeyID_ReadMessage <> 0 then
  2821. begin
  2822. UnregisterHotKey(Handle, HotKeyID_ReadMessage);
  2823. DeleteAtom(HotKeyID_ReadMessage);
  2824. end;
  2825. if (FindAtom('FReadMessageHotKey') = 0) and (HotKey > 0) then
  2826. begin
  2827. HotKeyID_ReadMessage := GlobalAddAtom(pchar('FReadMessageHotKey')) - $C000;
  2828. ModKey := GetModKey(FReadMessageHotKey);
  2829. if (not RegisterHotkey(Handle, HotKeyID_ReadMessage, ModKey, HotKey)) then
  2830. begin
  2831. FCanAlert := True;
  2832. ShowNotifyAlertForm('热键 ' + FReadMessageHotKey + ' 冲突!');
  2833. FCanAlert := False;
  2834. end;
  2835. //MessageBox(Handle, PChar('热键 ' + FReadMessageHotKey + ' 已被其它程序注册,请选择其它热键!'), '提示', MB_ICONERROR);
  2836. end;
  2837. SaveHotKeyConfigs;
  2838. end;
  2839. //------------------------------------------------------------------------------
  2840. procedure TMainForm.LoadStyleConfigs;
  2841. var
  2842. XMLFile: string;
  2843. XMLDocument: TXMLDocument;
  2844. StyleConfigNode: IXMLNode;
  2845. iLoop: Integer;
  2846. RealICQContacterListView: TRealICQContacterListView;
  2847. RealICQContacterTreeView: TRealICQContacterTreeView;
  2848. AUIMainColor: TColor;
  2849. ALVStyle: TRealICQContacterListItemStyle;
  2850. ALVCaptionStyle: TRealICQContacterListItemCaptionStyle;
  2851. AShowTree: Boolean;
  2852. ASkinName, OldSkinName: string;
  2853. begin
  2854. XMLFile := TRealICQClient.GetUserDir + StyleConfigXMLFile;
  2855. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2856. XMLDocument := TXMLDocument.Create(Self);
  2857. try
  2858. XMLDocument.Active := True;
  2859. if not FileExists(XMLFile) then
  2860. begin
  2861. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + StyleConfigXMLFile), PChar(XMLFile), False);
  2862. XMLDocument.Active := True;
  2863. end;
  2864. XMLDocument.LoadFromFile(XMLFile);
  2865. StyleConfigNode := XMLDocument.DocumentElement;
  2866. OldSkinName := SkinName;
  2867. try
  2868. ASkinName := StyleConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'];
  2869. if ASkinName <> SkinName then
  2870. begin
  2871. SkinName := ASkinName;
  2872. SaveDefaultConfigs;
  2873. ChangeUIColor(UIMainColor);
  2874. end;
  2875. except
  2876. SkinName := OldSkinName;
  2877. end;
  2878. AUIMainColor := StyleConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'];
  2879. ChangeUIColor(FUIMainColor);
  2880. FUIMainColor := AUIMainColor;
  2881. SaveDefaultConfigs;
  2882. if not Assigned(StyleConfigNode.ChildNodes.FindNode('ShowTree')) then
  2883. begin
  2884. StyleConfigNode.AddChild('ShowTree').Attributes['Value'] := True;
  2885. XMLDocument.SaveToFile();
  2886. end;
  2887. AShowTree := StyleConfigNode.ChildNodes.FindNode('ShowTree').Attributes['Value'];
  2888. FShowTree := AShowTree;
  2889. actShowTree.Checked := FShowTree;
  2890. ALVStyle := StyleConfigNode.ChildNodes.FindNode('LVStyle').Attributes['Value'];
  2891. if (RealICQClient.WorkingMode = wmCorporation) or FShowTree then
  2892. begin
  2893. if ALVStyle <> lsNoHeadImage then
  2894. ALVStyle := lsSmallHeadImage;
  2895. end;
  2896. if ALVStyle <> FLVStyle then
  2897. begin
  2898. FLVStyle := ALVStyle;
  2899. for iLoop := 0 to FContacterListViews.Count - 1 do
  2900. begin
  2901. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  2902. RealICQContacterListView.Style := FLVStyle;
  2903. end;
  2904. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  2905. begin
  2906. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  2907. RealICQContacterTreeView.Style := FLVStyle;
  2908. end;
  2909. end;
  2910. ALVCaptionStyle := StyleConfigNode.ChildNodes.FindNode('LVCaptionStyle').Attributes['Value'];
  2911. if ALVCaptionStyle <> FLVCaptionStyle then
  2912. begin
  2913. FLVCaptionStyle := ALVCaptionStyle;
  2914. for iLoop := 0 to FContacterListViews.Count - 1 do
  2915. begin
  2916. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  2917. RealICQContacterListView.CaptionStyle := FLVCaptionStyle;
  2918. end;
  2919. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  2920. begin
  2921. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  2922. RealICQContacterTreeView.CaptionStyle := FLVCaptionStyle;
  2923. end;
  2924. end;
  2925. FShowGIFInMailForm := StyleConfigNode.ChildNodes.FindNode('ShowGIFInMailForm').Attributes['Value'];
  2926. actShowGIFInMailForm.Checked := FShowGIFInMailForm;
  2927. FShowGIFInTalkingForm := StyleConfigNode.ChildNodes.FindNode('ShowGIFInTalkingForm').Attributes['Value'];
  2928. actShowGIFInTalkingForm.Checked := FShowGIFInTalkingForm;
  2929. FShowStrangers := not StyleConfigNode.ChildNodes.FindNode('ShowStrangers').Attributes['Value'];
  2930. if (RealICQClient.WorkingMode = wmCorporation) then
  2931. FShowStrangers := True;
  2932. actShowStrangers.Enabled := True;
  2933. actShowStrangers.Execute;
  2934. FShowBlacklists := not StyleConfigNode.ChildNodes.FindNode('ShowBlacklists').Attributes['Value'];
  2935. if (RealICQClient.WorkingMode = wmCorporation) then
  2936. FShowBlacklists := True;
  2937. actShowBlacklists.Enabled := True;
  2938. actShowBlacklists.Execute;
  2939. FShowTeams := not StyleConfigNode.ChildNodes.FindNode('ShowTeams').Attributes['Value'];
  2940. actShowTeams.Enabled := True;
  2941. actShowTeams.Execute;
  2942. FShowLatests := not StyleConfigNode.ChildNodes.FindNode('ShowLatests').Attributes['Value'];
  2943. actShowLatests.Enabled := True;
  2944. actShowLatests.Execute;
  2945. FTalkingFormAlwaysOnTop := StyleConfigNode.ChildNodes.FindNode('TalkingFormAlwaysOnTop').Attributes['Value'];
  2946. FCtrlEnterSendMessage := StyleConfigNode.ChildNodes.FindNode('CtrlEnterSendMessage').Attributes['Value'];
  2947. if not Assigned(StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm')) then
  2948. begin
  2949. StyleConfigNode.AddChild('CopyScreenHideTalkForm').Attributes['Value'] := False;
  2950. XMLDocument.SaveToFile();
  2951. end;
  2952. FCopyScreenHideTalkForm := StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm').Attributes['Value'];
  2953. finally
  2954. XMLDocument.Free;
  2955. end;
  2956. end;
  2957. //------------------------------------------------------------------------------
  2958. procedure TMainForm.SaveStyleConfigs;
  2959. var
  2960. XMLFile: string;
  2961. XMLDocument: TXMLDocument;
  2962. StyleConfigNode: IXMLNode;
  2963. begin
  2964. XMLFile := TRealICQClient.GetUserDir + StyleConfigXMLFile;
  2965. XMLDocument := TXMLDocument.Create(Self);
  2966. try
  2967. XMLDocument.Active := True;
  2968. if not FileExists(XMLFile) then
  2969. begin
  2970. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + StyleConfigXMLFile), PChar(XMLFile), False);
  2971. XMLDocument.Active := True;
  2972. end;
  2973. XMLDocument.LoadFromFile(XMLFile);
  2974. StyleConfigNode := XMLDocument.DocumentElement;
  2975. StyleConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'] := SkinName;
  2976. StyleConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'] := FUIMainColor;
  2977. StyleConfigNode.ChildNodes.FindNode('ShowTree').Attributes['Value'] := FShowTree;
  2978. StyleConfigNode.ChildNodes.FindNode('LVStyle').Attributes['Value'] := FLVStyle;
  2979. StyleConfigNode.ChildNodes.FindNode('LVCaptionStyle').Attributes['Value'] := FLVCaptionStyle;
  2980. StyleConfigNode.ChildNodes.FindNode('ShowStrangers').Attributes['Value'] := FShowStrangers;
  2981. StyleConfigNode.ChildNodes.FindNode('ShowBlacklists').Attributes['Value'] := FShowBlacklists;
  2982. StyleConfigNode.ChildNodes.FindNode('ShowTeams').Attributes['Value'] := FShowTeams;
  2983. StyleConfigNode.ChildNodes.FindNode('ShowLatests').Attributes['Value'] := FShowLatests;
  2984. StyleConfigNode.ChildNodes.FindNode('ShowGIFInMailForm').Attributes['Value'] := FShowGIFInMailForm;
  2985. StyleConfigNode.ChildNodes.FindNode('ShowGIFInTalkingForm').Attributes['Value'] := FShowGIFInTalkingForm;
  2986. StyleConfigNode.ChildNodes.FindNode('TalkingFormAlwaysOnTop').Attributes['Value'] := False;
  2987. StyleConfigNode.ChildNodes.FindNode('CtrlEnterSendMessage').Attributes['Value'] := FCtrlEnterSendMessage;
  2988. StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm').Attributes['Value'] := FCopyScreenHideTalkForm;
  2989. XMLDocument.SaveToFile();
  2990. finally
  2991. XMLDocument.Free;
  2992. end;
  2993. end;
  2994. //------------------------------------------------------------------------------
  2995. procedure TMainForm.LoadAutoUpdateConfigs;
  2996. var
  2997. XMLFile: string;
  2998. XMLDocument: TXMLDocument;
  2999. AutoUpdateConfigNode: IXMLNode;
  3000. begin
  3001. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + AutoUpdateConfigXMLFile;
  3002. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3003. XMLDocument := TXMLDocument.Create(Self);
  3004. try
  3005. XMLDocument.Active := True;
  3006. XMLDocument.LoadFromFile(XMLFile);
  3007. AutoUpdateConfigNode := XMLDocument.DocumentElement;
  3008. FAutoUpdate := AutoUpdateConfigNode.ChildNodes.FindNode('AutoUpdate').Attributes['Value'];
  3009. finally
  3010. XMLDocument.Free;
  3011. end;
  3012. end;
  3013. //------------------------------------------------------------------------------
  3014. procedure TMainForm.SaveAutoUpdateConfigs;
  3015. var
  3016. XMLFile: string;
  3017. XMLDocument: TXMLDocument;
  3018. AutoUpdateConfigNode: IXMLNode;
  3019. begin
  3020. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + AutoUpdateConfigXMLFile;
  3021. XMLDocument := TXMLDocument.Create(Self);
  3022. try
  3023. XMLDocument.Active := True;
  3024. XMLDocument.LoadFromFile(XMLFile);
  3025. AutoUpdateConfigNode := XMLDocument.DocumentElement;
  3026. AutoUpdateConfigNode.ChildNodes.FindNode('AutoUpdate').Attributes['Value'] := FAutoUpdate;
  3027. XMLDocument.SaveToFile();
  3028. finally
  3029. XMLDocument.Free;
  3030. end;
  3031. end;
  3032. //------------------------------------------------------------------------------
  3033. procedure TMainForm.LoadDefaultConfigs;
  3034. var
  3035. XMLFile: string;
  3036. XMLDocument: TXMLDocument;
  3037. DefaultConfigNode: IXMLNode;
  3038. OldSkinName: string;
  3039. BaseTop, BaseLeft: Integer;
  3040. begin
  3041. BaseTop := (Height - ClientHeight) div 2;
  3042. BaseLeft := (Width - ClientWidth) div 2;
  3043. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + DefaultConfigXMLFile;
  3044. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3045. XMLDocument := TXMLDocument.Create(Self);
  3046. try
  3047. XMLDocument.Active := True;
  3048. XMLDocument.LoadFromFile(XMLFile);
  3049. DefaultConfigNode := XMLDocument.DocumentElement;
  3050. FUIMainColor := DefaultConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'];
  3051. OldSkinName := SkinName;
  3052. try
  3053. SkinName := DefaultConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'];
  3054. except
  3055. SkinName := OldSkinName;
  3056. end;
  3057. FShowMainFormOnStart := True; //DefaultConfigNode.ChildNodes.FindNode('ShowMainFormOnStart').Attributes['Value'];
  3058. FMainFormLeft := DefaultConfigNode.ChildNodes.FindNode('MainFormLeft').Attributes['Value'];
  3059. FMainFormTop := DefaultConfigNode.ChildNodes.FindNode('MainFormTop').Attributes['Value'];
  3060. FMainFormWidth := DefaultConfigNode.ChildNodes.FindNode('MainFormWidth').Attributes['Value'];
  3061. FMainFormHeight := DefaultConfigNode.ChildNodes.FindNode('MainFormHeight').Attributes['Value'];
  3062. FTalkingFormLeft := DefaultConfigNode.ChildNodes.FindNode('TalkingFormLeft').Attributes['Value'];
  3063. FTalkingFormTop := DefaultConfigNode.ChildNodes.FindNode('TalkingFormTop').Attributes['Value'];
  3064. FTalkingFormWidth := DefaultConfigNode.ChildNodes.FindNode('TalkingFormWidth').Attributes['Value'];
  3065. FTalkingFormHeight := DefaultConfigNode.ChildNodes.FindNode('TalkingFormHeight').Attributes['Value'];
  3066. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft')) then
  3067. begin
  3068. DefaultConfigNode.AddChild('SMSFormLeft').Attributes['Value'] := -1;
  3069. XMLDocument.SaveToFile();
  3070. end;
  3071. FSMSFormLeft := DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft').Attributes['Value'];
  3072. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormTop')) then
  3073. begin
  3074. DefaultConfigNode.AddChild('SMSFormTop').Attributes['Value'] := -1;
  3075. XMLDocument.SaveToFile();
  3076. end;
  3077. FSMSFormTop := DefaultConfigNode.ChildNodes.FindNode('SMSFormTop').Attributes['Value'];
  3078. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth')) then
  3079. begin
  3080. DefaultConfigNode.AddChild('SMSFormWidth').Attributes['Value'] := -1;
  3081. XMLDocument.SaveToFile();
  3082. end;
  3083. FSMSFormWidth := DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth').Attributes['Value'];
  3084. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight')) then
  3085. begin
  3086. DefaultConfigNode.AddChild('SMSFormHeight').Attributes['Value'] := -1;
  3087. XMLDocument.SaveToFile();
  3088. end;
  3089. FSMSFormHeight := DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight').Attributes['Value'];
  3090. if FMainFormHeight <= 0 then
  3091. FMainFormHeight := Round(Screen.WorkAreaHeight * 0.8);
  3092. if FMainFormWidth <= 0 then
  3093. FMainFormWidth := 258;
  3094. if (FMainFormLeft + FMainFormWidth - BaseLeft < 2) then
  3095. FMainFormLeft := 0;
  3096. if (FMainFormLeft - BaseLeft > Screen.WorkAreaWidth - 2) then
  3097. FMainFormLeft := Screen.WorkAreaWidth - FMainFormWidth;
  3098. if (FMainFormTop + FMainFormHeight - BaseTop < 2) then
  3099. FMainFormTop := 0;
  3100. if (FMainFormTop > Screen.WorkAreaHeight) then
  3101. FMainFormTop := 0;
  3102. if FTalkingFormHeight <= 0 then
  3103. FTalkingFormHeight := Round(Screen.WorkAreaHeight * 0.6);
  3104. if FTalkingFormWidth <= 0 then
  3105. FTalkingFormWidth := Round(Screen.WorkAreaWidth * 0.6);
  3106. if (FTalkingFormLeft < 0) or (FTalkingFormLeft > Screen.WorkAreaWidth) then
  3107. FTalkingFormLeft := (Screen.WorkAreaWidth - FTalkingFormWidth) div 2;
  3108. if (FTalkingFormTop < 0) or (FTalkingFormTop > Screen.WorkAreaHeight) then
  3109. FTalkingFormTop := (Screen.WorkAreaHeight - FTalkingFormHeight) div 2;
  3110. if FSMSFormHeight <= 0 then
  3111. FSMSFormHeight := 410;
  3112. if FSMSFormWidth <= 0 then
  3113. FSMSFormWidth := 460;
  3114. if (FSMSFormLeft < 0) or (FSMSFormLeft > Screen.WorkAreaWidth) then
  3115. FSMSFormLeft := (Screen.WorkAreaWidth - FSMSFormWidth) div 2;
  3116. if (FSMSFormTop < 0) or (FSMSFormTop > Screen.WorkAreaHeight) then
  3117. FSMSFormTop := (Screen.WorkAreaHeight - FSMSFormHeight) div 2;
  3118. Left := FMainFormLeft;
  3119. Top := FMainFormTop;
  3120. Width := FMainFormWidth;
  3121. Height := FMainFormHeight;
  3122. FAlwaysOnTop := not DefaultConfigNode.ChildNodes.FindNode('AlwaysOnTop').Attributes['Value'];
  3123. actAlwaysOnTop.Enabled := True;
  3124. actAlwaysOnTop.Execute;
  3125. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm')) then
  3126. begin
  3127. DefaultConfigNode.AddChild('AutoHideMainForm').Attributes['Value'] := True;
  3128. XMLDocument.SaveToFile();
  3129. end;
  3130. FAutoHide := DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm').Attributes['Value'];
  3131. CheckWindowPositon;
  3132. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage')) then
  3133. begin
  3134. DefaultConfigNode.AddChild('AutoShowRequestMessage').Attributes['Value'] := False;
  3135. XMLDocument.SaveToFile();
  3136. end;
  3137. FAutoShowRequestMessage := DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage').Attributes['Value'];
  3138. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile')) then
  3139. begin
  3140. DefaultConfigNode.AddChild('ConfirmSendOfflineFile').Attributes['Value'] := True;
  3141. XMLDocument.SaveToFile();
  3142. end;
  3143. FConfirmSendOfflineFile := DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile').Attributes['Value'];
  3144. finally
  3145. XMLDocument.Free;
  3146. end;
  3147. end;
  3148. procedure TMainForm.CheckWindowPositon;
  3149. var
  3150. BaseTop, BaseLeft: Integer;
  3151. begin
  3152. BaseTop := (Height - ClientHeight) div 2;
  3153. BaseLeft := (Width - ClientWidth) div 2;
  3154. if (Left <= -BaseLeft) then
  3155. begin
  3156. FHidePosition := hpLeft;
  3157. Top := -BaseTop;
  3158. Left := -BaseLeft;
  3159. Height := Screen.WorkAreaHeight + BaseTop * 2;
  3160. end
  3161. else if ((Left + Width) >= (Screen.WorkAreaWidth + BaseLeft)) then
  3162. begin
  3163. FHidePosition := hpRight;
  3164. Top := -BaseTop;
  3165. Left := Screen.WorkAreaWidth - Width + BaseLeft;
  3166. Height := Screen.WorkAreaHeight + BaseTop * 2;
  3167. end
  3168. else if (Top <= -BaseTop) then
  3169. begin
  3170. FHidePosition := hpTop;
  3171. Top := -BaseTop;
  3172. end
  3173. else if (Top > -BaseTop) and (Left > -BaseLeft) and ((Left + Width) < (Screen.WorkAreaWidth + BaseLeft)) then
  3174. begin
  3175. FHidePosition := hpNone;
  3176. end;
  3177. if TimerForHideMainForm <> nil then
  3178. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  3179. end;
  3180. //------------------------------------------------------------------------------
  3181. procedure TMainForm.SaveDefaultConfigs;
  3182. var
  3183. XMLFile: string;
  3184. XMLDocument: TXMLDocument;
  3185. DefaultConfigNode: IXMLNode;
  3186. begin
  3187. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + DefaultConfigXMLFile;
  3188. XMLDocument := TXMLDocument.Create(Self);
  3189. try
  3190. XMLDocument.Active := True;
  3191. XMLDocument.LoadFromFile(XMLFile);
  3192. DefaultConfigNode := XMLDocument.DocumentElement;
  3193. DefaultConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'] := SkinName;
  3194. DefaultConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'] := FUIMainColor;
  3195. DefaultConfigNode.ChildNodes.FindNode('AlwaysOnTop').Attributes['Value'] := False;
  3196. DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm').Attributes['Value'] := FAutoHide;
  3197. DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage').Attributes['Value'] := FAutoShowRequestMessage;
  3198. DefaultConfigNode.ChildNodes.FindNode('ShowMainFormOnStart').Attributes['Value'] := True;
  3199. try
  3200. DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile').Attributes['Value'] := FConfirmSendOfflineFile;
  3201. except
  3202. end;
  3203. DefaultConfigNode.ChildNodes.FindNode('MainFormLeft').Attributes['Value'] := FMainFormLeft;
  3204. DefaultConfigNode.ChildNodes.FindNode('MainFormTop').Attributes['Value'] := FMainFormTop;
  3205. DefaultConfigNode.ChildNodes.FindNode('MainFormWidth').Attributes['Value'] := FMainFormWidth;
  3206. DefaultConfigNode.ChildNodes.FindNode('MainFormHeight').Attributes['Value'] := FMainFormHeight;
  3207. DefaultConfigNode.ChildNodes.FindNode('TalkingFormLeft').Attributes['Value'] := FTalkingFormLeft;
  3208. DefaultConfigNode.ChildNodes.FindNode('TalkingFormTop').Attributes['Value'] := FTalkingFormTop;
  3209. DefaultConfigNode.ChildNodes.FindNode('TalkingFormWidth').Attributes['Value'] := FTalkingFormWidth;
  3210. DefaultConfigNode.ChildNodes.FindNode('TalkingFormHeight').Attributes['Value'] := FTalkingFormHeight;
  3211. DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft').Attributes['Value'] := FSMSFormLeft;
  3212. DefaultConfigNode.ChildNodes.FindNode('SMSFormTop').Attributes['Value'] := FSMSFormTop;
  3213. DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth').Attributes['Value'] := FSMSFormWidth;
  3214. DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight').Attributes['Value'] := FSMSFormHeight;
  3215. XMLDocument.SaveToFile();
  3216. finally
  3217. XMLDocument.Free;
  3218. end;
  3219. end;
  3220. //------------------------------------------------------------------------------
  3221. procedure TMainForm.LoadGroupConfig;
  3222. var
  3223. XMLDocument: TXMLDocument;
  3224. ServerConfigNode: IXMLNode;
  3225. begin
  3226. XMLDocument := TXMLDocument.Create(Self);
  3227. try
  3228. XMLDocument.Active := True;
  3229. if csDesigning in ComponentState then
  3230. exit;
  3231. XMLDocument.LoadFromFile(ExtractFilePath(Application.ExeName) + ConfigXMLFilePath + 'GroupServerConfig.xml');
  3232. ServerConfigNode := XMLDocument.DocumentElement;
  3233. FGroupAddress := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['Address'];
  3234. FGroupPort := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['Port'];
  3235. FGroupImagePort := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['ImagePort'];
  3236. FGroupShareAddress := ServerConfigNode.ChildNodes.FindNode('GroupShareServer').Attributes['Address'];
  3237. FGroupSharePort := ServerConfigNode.ChildNodes.FindNode('GroupShareServer').Attributes['Port'];
  3238. except
  3239. on E: Exception do
  3240. begin
  3241. Error(E.Message, 'TMainForm.LoadGroupConfig');
  3242. XMLDocument.Free;
  3243. end;
  3244. end;
  3245. XMLDocument.Free;
  3246. end;
  3247. procedure TMainForm.LoadGroupConfigs;
  3248. var
  3249. XMLFile: string;
  3250. XMLDocument: TXMLDocument;
  3251. GroupConfigNode, GroupListNode, GroupNode: IXMLNode;
  3252. GroupMembers: TStringList;
  3253. iLoop, jLoop: Integer;
  3254. begin
  3255. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  3256. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3257. XMLDocument := TXMLDocument.Create(Self);
  3258. try
  3259. XMLDocument.Active := True;
  3260. if not FileExists(XMLFile) then
  3261. begin
  3262. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  3263. XMLDocument.Active := True;
  3264. end;
  3265. XMLDocument.LoadFromFile(XMLFile);
  3266. GroupConfigNode := XMLDocument.DocumentElement;
  3267. FShowGroup := GroupConfigNode.ChildNodes.FindNode('ShowGroup').Attributes['Value'];
  3268. actShowGroup.Checked := FShowGroup;
  3269. GroupListNode := GroupConfigNode.ChildNodes.FindNode('Groups');
  3270. FGroups.Clear;
  3271. for iLoop := 0 to GroupListNode.ChildNodes.Count - 1 do
  3272. begin
  3273. GroupNode := GroupListNode.ChildNodes[iLoop];
  3274. GroupMembers := TStringList.Create;
  3275. for jLoop := 0 to GroupNode.ChildNodes.Count - 1 do
  3276. begin
  3277. GroupMembers.Add(GroupNode.ChildNodes[jLoop].Text);
  3278. end;
  3279. FGroups.InsertObject(GroupNode.Attributes['Position'], GroupNode.Attributes['Name'], GroupMembers);
  3280. end;
  3281. except
  3282. on E: Exception do
  3283. begin
  3284. Error(E.Message, 'TMainForm.LoadGroupConfigs');
  3285. XMLDocument.Free;
  3286. end;
  3287. end;
  3288. XMLDocument.Free;
  3289. end;
  3290. //------------------------------------------------------------------------------
  3291. procedure TMainForm.miMoveToStrangersClick(Sender: TObject);
  3292. {var
  3293. GroupIndex, iLoop: Integer;
  3294. GroupName: String;
  3295. ListView: TRealICQContacterListView;
  3296. ListItem: TRealICQContacterListItem;
  3297. ItemIndex: Integer;
  3298. RealICQContacterTreeView: TRealICQContacterTreeView;
  3299. Employee: TRealICQEmployee; }
  3300. begin
  3301. { if MessageBox(Handle,
  3302. '确实要将选中的用户移至陌生人中吗?',
  3303. '确认',
  3304. MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then Exit;
  3305. GroupName :='陌生人';// navForContacters.Groups[navForContacters.ActiveGroupIndex];
  3306. if (GroupName = lvStrangers)then exit;
  3307. if GroupName = LVMyContacters then
  3308. begin
  3309. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3310. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3311. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  3312. RealICQClient.MoveToStrangers(Employee.LoginName);
  3313. Exit;
  3314. end;
  3315. GroupIndex := FContacterListViews.IndexOf(GroupName);
  3316. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  3317. ListView.DisableAlign;
  3318. try
  3319. for iLoop := ListView.Items.Count - 1 downto 0 do
  3320. begin
  3321. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  3322. if ListItem.Selected then
  3323. begin
  3324. RealICQClient.MoveToStrangers(ListItem.LoginName);
  3325. Sleep(15);
  3326. end;
  3327. end;
  3328. finally
  3329. ListView.EnableAlign;
  3330. end;
  3331. }
  3332. end;
  3333. procedure TMainForm.miMuteClick(Sender: TObject);
  3334. begin
  3335. FLoginState := stMute;
  3336. FLeaveMessage := '勿扰';
  3337. SetLoginStateControlState;
  3338. end;
  3339. //------------------------------------------------------------------------------
  3340. procedure TMainForm.miOnlineClick(Sender: TObject);
  3341. begin
  3342. FLoginState := stOnline;
  3343. FLeaveMessage := '';
  3344. SetLoginStateControlState;
  3345. end;
  3346. //------------------------------------------------------------------------------
  3347. procedure TMainForm.miOtherStateClick(Sender: TObject);
  3348. var
  3349. LeaveMessage: string;
  3350. begin
  3351. LeaveMessage := Trim(ShowMyInputBox('其它状态', '请输入离开状态说明文字', '', 16));
  3352. if Length(LeaveMessage) > 0 then
  3353. begin
  3354. FLoginState := stLeave;
  3355. FLeaveMessage := LeaveMessage;
  3356. SetLoginStateControlState;
  3357. end;
  3358. end;
  3359. //------------------------------------------------------------------------------
  3360. procedure TMainForm.miMoveToBlacklistsClick(Sender: TObject);
  3361. var
  3362. GroupName: string;
  3363. TreeView: TRealICQContacterTreeView;
  3364. ItemIndex: Integer;
  3365. Friend: TRealICQEmployee;
  3366. Black: TRealICQEmployee;
  3367. begin
  3368. if MessageBox(Handle, '确实要将选中的用户移至黑名单吗?', '确认', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  3369. Exit;
  3370. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  3371. TreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3372. Friend := TreeView.GetSelectedEmployee;
  3373. if Friend = nil then
  3374. Exit;
  3375. Black := TRealICQEmployee.Create(Friend.LoginName);
  3376. Black.BranchID := LvBlackLists;
  3377. Black.DisplayName := Friend.DisplayName;
  3378. GroupName := Friend.BranchID;
  3379. if (GroupName = lvBlacklists) then
  3380. exit;
  3381. if GroupName = LvFriends then
  3382. begin
  3383. RealICQClient.DelFriend(Friend.LoginName);
  3384. RealICQClient.MoveToBlacklists(Friend.LoginName);
  3385. TreeView.AddEmployee(Black);
  3386. end;
  3387. end;
  3388. procedure TMainForm.miSkinClick(Sender: TObject);
  3389. var
  3390. OldSkin: string;
  3391. begin
  3392. OldSkin := SkinName;
  3393. try
  3394. SkinName := (Sender as TMenuItem).Caption;
  3395. ChangeAddFriendFormSkin(SkinName);
  3396. ChangeAddFriendRequestFormSkin(SkinName);
  3397. ChangeTalkingFormSkin(SkinName);
  3398. ChangeSMSFormSkin(SkinName);
  3399. ChangeSystemMessageFormsSkin(SkinName);
  3400. // ChangeSeeUserInformationFormsSkin(SkinName);
  3401. ChangeTeamOptionsFormSkin(SkinName);
  3402. if VideoForm <> nil then
  3403. begin
  3404. VideoForm.SkinName := SkinName;
  3405. VideoForm.ChangeUIColor(VideoForm.TalkingForm.WindowColor);
  3406. end;
  3407. if CreateTeamForm <> nil then
  3408. begin
  3409. CreateTeamForm.SkinName := SkinName;
  3410. CreateTeamForm.ChangeUIColor(UIMainColor);
  3411. end;
  3412. if SearchForm <> nil then
  3413. begin
  3414. SearchForm.SkinName := SkinName;
  3415. SearchForm.ChangeUIColor(UIMainColor);
  3416. end;
  3417. if SearchTeamForm <> nil then
  3418. begin
  3419. SearchTeamForm.SkinName := SkinName;
  3420. SearchTeamForm.ChangeUIColor(UIMainColor);
  3421. end;
  3422. if CustomFacesManagerForm <> nil then
  3423. begin
  3424. CustomFacesManagerForm.SkinName := SkinName;
  3425. CustomFacesManagerForm.ChangeUIColor(UIMainColor);
  3426. end;
  3427. except
  3428. MessageBox(Handle, '加载界面时出错!', '错误', MB_ICONERROR);
  3429. SkinName := OldSkin;
  3430. end;
  3431. ChangeUIColor(UIMainColor);
  3432. PostMessage(Handle, WM_SIZE, 0, 0);
  3433. if RealICQClient.Logined and RealICQClient.Connected then
  3434. SaveStyleConfigs;
  3435. SaveDefaultConfigs;
  3436. end;
  3437. //----------------------------------------------------
  3438. procedure TMainForm.ImageButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  3439. begin
  3440. FHintWindow.ReleaseHandle;
  3441. FHintWindow.Visible := False;
  3442. SetToolBarState(Sender);
  3443. end;
  3444. procedure TMainForm.tsContactersResize(Sender: TObject);
  3445. begin
  3446. { TODO -olqq -c : 注释 2015/1/22 15:30:11 }
  3447. // ScrollBoxContacters.Width := pnlGroups.Width;
  3448. // PnlMoreUser.Width := pnlGroups.Width;
  3449. // ScrollBoxMyFriend.Width := pnlGroups.Width;
  3450. // ScrollBoxTeam.Width := pnlGroups.Width;
  3451. // ScrollBoxLatests.Width := pnlGroups.Width;
  3452. //
  3453. // ScrollBoxContacters.Height := pnlGroups.Height;
  3454. // PnlMoreUser.Height := pnlGroups.Height;
  3455. // ScrollBoxMyFriend.Height := pnlGroups.Height;
  3456. // ScrollBoxTeam.Height := pnlGroups.Height;
  3457. // ScrollBoxLatests.Height := pnlGroups.Height;
  3458. {ScrollBoxContacters.Left := 0;
  3459. PnlMoreUser.Left := ScrollBoxContacters.Left + ScrollBoxContacters.Width;
  3460. ScrollBoxMyFriend.Left := PnlMoreUser.Left + PnlMoreUser.Width;
  3461. ScrollBoxTeam.Left := ScrollBoxMyFriend.Left + ScrollBoxMyFriend.Width;
  3462. ScrollBoxLatests.Left := ScrollBoxTeam.Left + ScrollBoxTeam.Width;}
  3463. end;
  3464. procedure TMainForm.tsContactersShow(Sender: TObject);
  3465. begin
  3466. {ScrollBoxContacters.Visible := True;
  3467. PnlMoreUser.Visible := True;
  3468. ScrollBoxMyFriend.Visible := True;
  3469. ScrollBoxTeam.Visible := True;
  3470. ScrollBoxLatests.Visible := True;}
  3471. { TODO -olqq -c : 注释 2015/1/22 15:33:36 }
  3472. // ScrollBoxContacters.Align := alNone;
  3473. // PnlMoreUser.Align := alNone;
  3474. // ScrollBoxMyFriend.Align := alNone;
  3475. // ScrollBoxTeam.Align := alNone;
  3476. // ScrollBoxLatests.Align := alNone;
  3477. //
  3478. // ScrollBoxContacters.Top := 0;
  3479. // PnlMoreUser.Top := 0;
  3480. // ScrollBoxMyFriend.Top := 0;
  3481. // ScrollBoxTeam.Top := 0;
  3482. // ScrollBoxLatests.Top := 0;
  3483. tsContactersResize(tsContacters);
  3484. end;
  3485. //-----------------------------------------------------
  3486. procedure TMainForm.SetToolBarState(Sender: TObject);
  3487. var
  3488. ImageButton: TRealICQHoverImage;
  3489. TmpImageButton: TRealICQHoverImage;
  3490. TmpImageButtonIcon: TRealICQHoverImage;
  3491. iLoop: Integer;
  3492. OldControl, NewControl: TWinControl;
  3493. ItemIndex, divSize: Integer;
  3494. RealICQContacterTreeView: TRealICQContacterTreeView;
  3495. begin
  3496. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3497. OldControl := nil;
  3498. if ScrollBoxContacters.Visible then
  3499. OldControl := ScrollBoxContacters;
  3500. if PnlMoreUser.Visible then
  3501. OldControl := PnlMoreUser;
  3502. if ScrollBoxMyFriend.Visible then
  3503. OldControl := ScrollBoxMyFriend;
  3504. if ScrollBoxTeam.Visible then
  3505. OldControl := ScrollBoxTeam;
  3506. if ScrollBoxLatests.Visible then
  3507. OldControl := ScrollBoxLatests;
  3508. {if ImageButton.Tag = 2 then
  3509. begin
  3510. if ScrollBoxMoreUser.Tag = 0 then
  3511. begin
  3512. ScrollBoxMoreUser.Tag := 1;
  3513. end;
  3514. end; }
  3515. NewControl := nil;
  3516. if ImageButton.Tag = 1 then
  3517. NewControl := ScrollBoxContacters;
  3518. if ImageButton.Tag = 2 then
  3519. NewControl := PnlMoreUser;
  3520. if ImageButton.Tag = 3 then
  3521. NewControl := ScrollBoxMyFriend;
  3522. if ImageButton.Tag = 4 then
  3523. NewControl := ScrollBoxTeam;
  3524. if ImageButton.Tag = 5 then
  3525. NewControl := ScrollBoxLatests;
  3526. if False and (OldControl <> nil) then
  3527. begin
  3528. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3529. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3530. RealICQContacterTreeView.HideScroll;
  3531. RealICQContacterTreeView.ReDrawAll;
  3532. RealICQContacterTreeView.BeginUpdate;
  3533. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  3534. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3535. RealICQContacterTreeView.HideScroll;
  3536. RealICQContacterTreeView.ReDrawAll;
  3537. RealICQContacterTreeView.BeginUpdate;
  3538. Application.ProcessMessages;
  3539. //Exit;
  3540. NewControl.DisableAlign;
  3541. NewControl.Enabled := False;
  3542. OldControl.DisableAlign;
  3543. OldControl.Enabled := False;
  3544. divSize := pnlGroups.Width div 10;
  3545. try
  3546. if OldControl.Tag < NewControl.Tag then
  3547. begin
  3548. NewControl.Left := OldControl.Left + OldControl.Width;
  3549. NewControl.Visible := True;
  3550. while NewControl.Left > 0 do
  3551. begin
  3552. if NewControl.Left - divSize < 0 then
  3553. begin
  3554. NewControl.Left := 0;
  3555. end
  3556. else
  3557. begin
  3558. OldControl.Left := OldControl.Left - divSize;
  3559. NewControl.Left := NewControl.Left - divSize;
  3560. end;
  3561. Application.ProcessMessages;
  3562. Sleep(10);
  3563. end;
  3564. OldControl.Visible := False;
  3565. end
  3566. else
  3567. begin
  3568. NewControl.Left := OldControl.Left - OldControl.Width;
  3569. NewControl.Visible := True;
  3570. while NewControl.Left < 0 do
  3571. begin
  3572. if NewControl.Left + divSize > 0 then
  3573. begin
  3574. NewControl.Left := 0;
  3575. end
  3576. else
  3577. begin
  3578. OldControl.Left := OldControl.Left + divSize;
  3579. NewControl.Left := NewControl.Left + divSize;
  3580. end;
  3581. Application.ProcessMessages;
  3582. Sleep(10);
  3583. end;
  3584. OldControl.Visible := False;
  3585. end;
  3586. finally
  3587. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3588. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3589. RealICQContacterTreeView.EndUpdate;
  3590. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  3591. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3592. RealICQContacterTreeView.EndUpdate;
  3593. NewControl.EnableAlign;
  3594. NewControl.Enabled := True;
  3595. OldControl.EnableAlign;
  3596. OldControl.Enabled := True;
  3597. end;
  3598. end
  3599. else
  3600. begin
  3601. if OldControl <> nil then
  3602. OldControl.Visible := False;
  3603. NewControl.Left := 0;
  3604. NewControl.Visible := True;
  3605. end;
  3606. pnlTeams.Visible := ImageButton.Tag = 4;
  3607. if pnlTeams.Visible then
  3608. pnlTeams.Height := 22
  3609. else
  3610. pnlTeams.Height := 0;
  3611. {ScrollBoxContacters.Visible := ImageButton.Tag = 1;
  3612. PnlMoreUser.Visible := ImageButton.Tag = 2;
  3613. ScrollBoxMyFriend.Visible := ImageButton.Tag = 3;
  3614. ScrollBoxTeam.Visible := ImageButton.Tag = 4;
  3615. pnlTeams.Visible := ImageButton.Tag = 4;
  3616. if pnlTeams.Visible then
  3617. pnlTeams.Height := 22
  3618. else
  3619. pnlTeams.Height := 0;
  3620. ScrollBoxLatests.Visible := ImageButton.Tag = 5; }
  3621. ActiveButtonTag := ImageButton.Tag;
  3622. for iLoop := 0 to FToolBarButtonList.Count - 1 do
  3623. begin
  3624. TmpImageButton := FToolBarButtonList.Objects[iLoop] as TRealICQHoverImage;
  3625. TmpImageButtonIcon := FToolBarButtonIconList.Objects[iLoop] as TRealICQHoverImage;
  3626. if TmpImageButton.Tag = ImageButton.Tag then
  3627. begin
  3628. TmpImageButton.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\menu\01_On.bmp');
  3629. TmpImageButton.OnMouseUp := nil;
  3630. TmpImageButton.OnMouseEnter := nil;
  3631. TmpImageButton.OnMouseLeave := nil;
  3632. TmpImageButtonIcon.OnMouseUp := nil;
  3633. TmpImageButtonIcon.OnMouseEnter := nil;
  3634. TmpImageButtonIcon.OnMouseLeave := nil;
  3635. end
  3636. else
  3637. begin
  3638. TmpImageButton.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\menu\01_Off.bmp');
  3639. TmpImageButton.OnMouseUp := ImageButtonMouseUp;
  3640. TmpImageButton.OnMouseEnter := ImageButtonEnter;
  3641. TmpImageButton.OnMouseLeave := ImageButtonLeave;
  3642. TmpImageButtonIcon.OnMouseUp := ImageButtonMouseUp;
  3643. TmpImageButtonIcon.OnMouseEnter := ImageButtonEnter;
  3644. TmpImageButtonIcon.OnMouseLeave := ImageButtonLeave;
  3645. end;
  3646. ConvertBitmapToColor(TmpImageButton.Picture.Bitmap, UIMainColor);
  3647. end;
  3648. end;
  3649. //----------------------------
  3650. procedure TMainForm.ImageButtonEnter(Sender: TObject);
  3651. var
  3652. ImageButton: TRealICQHoverImage;
  3653. ImagePath: string;
  3654. procedure OpenHint(HintStr: string);
  3655. var
  3656. TextWidth, TextHeight: Integer;
  3657. rect: TRect;
  3658. begin
  3659. TextWidth := FHintWindow.Canvas.TextWidth(HintStr);
  3660. TextHeight := FHintWindow.Canvas.TextHeight(HintStr);
  3661. rect.Left := Mouse.CursorPos.X;
  3662. rect.Top := Mouse.CursorPos.Y + 20;
  3663. rect.Right := rect.Left + TextWidth + 5;
  3664. rect.Bottom := rect.Top + TextHeight;
  3665. FHintWindow.Color := clInfoBk;
  3666. FHintWindow.ActivateHint(Rect, HintStr);
  3667. FHintWindow.Visible := True;
  3668. end;
  3669. begin
  3670. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3671. ImagePath := ExtractFilePath(Application.ExeName) + 'Images\menu\01_Over.bmp';
  3672. ImageButton.Picture.LoadFromFile(ImagePath);
  3673. ConvertBitmapToColor(ImageButton.Picture.Bitmap, UIMainColor);
  3674. OpenHint(FToolBarButtonList[ImageButton.Tag - 1]);
  3675. end;
  3676. //-----------------------------
  3677. procedure TMainForm.ImageButtonLeave(Sender: TObject);
  3678. var
  3679. ImageButton: TRealICQHoverImage;
  3680. ImagePath: string;
  3681. begin
  3682. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3683. ImagePath := ExtractFilePath(Application.ExeName) + 'Images\menu\01_Off.bmp';
  3684. ImageButton.Picture.LoadFromFile(ImagePath);
  3685. ConvertBitmapToColor(ImageButton.Picture.Bitmap, UIMainColor);
  3686. FHintWindow.ReleaseHandle;
  3687. FHintWindow.Visible := False;
  3688. end;
  3689. procedure TMainForm.miChangeLoginNameClick(Sender: TObject);
  3690. var
  3691. LoginUser: TLoginUser;
  3692. begin
  3693. try
  3694. LoginUser := RealICQClient.LoginedUsers.Objects[(Sender as TMenuItem).Tag] as TLoginUser;
  3695. edPassword.Text := '';
  3696. edLoginName.Text := LoginUser.LoginName;
  3697. if (LoginUser.Password <> '') and (LoginUser.LoginName <> '') then
  3698. begin
  3699. edPassword.Text := RealICQClient.DecyptPassword(LoginUser.Password);
  3700. FSavePassword := True;
  3701. self.ImgLstCheckStates.GetIcon(1, spbSavePassword.Icon);
  3702. end;
  3703. self.lblRemoveMyLoginInfo.Visible := True;
  3704. except
  3705. edLoginName.Text := '';
  3706. end;
  3707. end;
  3708. //------------------------------------------------------------------------------
  3709. procedure TMainForm.miClearLoginHistoryClick(Sender: TObject);
  3710. var
  3711. ClearAll: Boolean;
  3712. begin
  3713. ClearAll := True;
  3714. if UpperCase(Sender.ClassName) = UpperCase('TLabel') then
  3715. ClearAll := False;
  3716. MainForm.RealICQClient.ClearLoginHistory(ClearAll, edLoginName.Text);
  3717. edLoginName.Text := '';
  3718. edPassword.Text := '';
  3719. actLoginAs.Visible := False;
  3720. SetLoginControlsVisible(True);
  3721. end;
  3722. //------------------------------------------------------------------------------
  3723. procedure TMainForm.miColorClick(Sender: TObject);
  3724. begin
  3725. FUIMainColor := (Sender as TMenuItem).Tag;
  3726. ChangeUIColor((Sender as TMenuItem).Tag);
  3727. if RealICQClient.Logined and RealICQClient.Connected then
  3728. SaveStyleConfigs;
  3729. SaveDefaultConfigs;
  3730. end;
  3731. //------------------------------------------------------------------------------
  3732. procedure TMainForm.miHiddenClick(Sender: TObject);
  3733. begin
  3734. FLoginState := stHidden;
  3735. FLeaveMessage := '';
  3736. SetLoginStateControlState;
  3737. end;
  3738. //------------------------------------------------------------------------------
  3739. procedure TMainForm.miMeetingClick(Sender: TObject);
  3740. begin
  3741. FLoginState := stLeave;
  3742. FLeaveMessage := (Sender as TMenuItem).Caption;
  3743. SetLoginStateControlState;
  3744. end;
  3745. //------------------------------------------------------------------------------
  3746. procedure TMainForm.miMoreColorsClick(Sender: TObject);
  3747. begin
  3748. ColorDialog.Color := FUIMainColor;
  3749. if ColorDialog.Execute then
  3750. begin
  3751. ChangeUIColor(ColorDialog.Color);
  3752. FUIMainColor := ColorDialog.Color;
  3753. if RealICQClient.Logined and RealICQClient.Connected then
  3754. SaveStyleConfigs;
  3755. SaveDefaultConfigs;
  3756. end;
  3757. end;
  3758. //------------------------------------------------------------------------------
  3759. procedure TMainForm.miMoveGroupClick(Sender: TObject);
  3760. var
  3761. GroupName, TargetGroupName: string;
  3762. MenuItem: TMenuItem;
  3763. GroupIndex, itemIndex: Integer;
  3764. TreeView: TRealICQContacterTreeView;
  3765. Friend: TRealICQEmployee;
  3766. GroupMembers, TargetGroupMembers: TStringList;
  3767. RealICQUser: TRealICQUser;
  3768. OldScrollBarTop: Integer;
  3769. begin
  3770. MenuItem := Sender as TMenuItem;
  3771. if MenuItem <> nil then
  3772. TargetGroupName := MenuItem.Caption
  3773. else
  3774. TargetGroupName := LVFriends;
  3775. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  3776. TreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3777. Friend := TreeView.GetSelectedEmployee;
  3778. if Friend = nil then
  3779. Exit;
  3780. GroupName := Friend.BranchID;
  3781. OldScrollBarTop := TreeView.ScrollBarTop;
  3782. SetFlashCaptionOnOnlineValue(False);
  3783. LockWindowUpdate(GetDesktopWindow);
  3784. try
  3785. if FGroups.IndexOf(GroupName) >= 0 then
  3786. begin
  3787. GroupIndex := FGroups.IndexOf(GroupName);
  3788. GroupMembers := FGroups.Objects[GroupIndex] as TStringList;
  3789. GroupMembers.Delete(GroupMembers.IndexOf(Friend.LoginName));
  3790. end;
  3791. RealICQUser := Friend.Data;
  3792. TreeView.EmployeeItems.Delete(TreeView.EmployeeItems.IndexOf(Friend.LoginName));
  3793. //在树节点之间移动()
  3794. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  3795. Friend.BranchID := TargetGroupName;
  3796. TreeView.AddEmployee(Friend);
  3797. UpdateFriendNode(Friend, RealICQUser, True);
  3798. if FGroups.IndexOf(TargetGroupName) >= 0 then
  3799. begin
  3800. GroupIndex := FGroups.IndexOf(TargetGroupName);
  3801. TargetGroupMembers := FGroups.Objects[GroupIndex] as TStringList;
  3802. TargetGroupMembers.Add(Friend.LoginName);
  3803. end;
  3804. finally
  3805. TreeView.ScrollBarTop := OldScrollBarTop;
  3806. LockWindowUpdate(0);
  3807. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  3808. SaveGroupConfigs;
  3809. end;
  3810. end;
  3811. //------------------------------------------------------------------------------
  3812. procedure TMainForm.NodeDoubleClick(Employee: TRealICQEmployee);
  3813. var
  3814. SMSForm: TSMSForm;
  3815. begin
  3816. if (pgcMainWorkArea.ActivePage = tsAddrBook) then
  3817. begin
  3818. SMSForm := OpenSMSForm('', True);
  3819. SMSForm.edMobiles.Text := Employee.Mobile;
  3820. Exit;
  3821. end;
  3822. if Employee.Data <> nil then
  3823. begin
  3824. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3825. begin
  3826. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3827. Exit;
  3828. end;
  3829. {if GetActiveTabSheetName=MoreUser then
  3830. begin
  3831. RealICQClient.GetUserInformation(Employee.LoginName,True);
  3832. end; }
  3833. OpenTalkingForm(Employee.LoginName);
  3834. end;
  3835. end;
  3836. //------------------------------------------------------------------------------
  3837. procedure TMainForm.NodeIconButtonClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  3838. var
  3839. RealICQUser: TRealICQUser;
  3840. begin
  3841. if IconButtonType = itHeadImage then
  3842. begin
  3843. HideUserCardForm;
  3844. end;
  3845. if IconButtonType = itSNS then
  3846. begin
  3847. RealICQUser := Employee.Data;
  3848. RealICQUser.ClickedSNSIcon;
  3849. try
  3850. RealICQClientUserInformationReady(RealICQClient, RealICQUser);
  3851. //UpdateEmployeeNode(Employee, RealICQUser, True);
  3852. finally
  3853. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + SNSHomePage, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(RealICQUser.LoginName)])), '', SW_SHOWDEFAULT);
  3854. end;
  3855. end;
  3856. end;
  3857. //------------------------------------------------------------------------------
  3858. procedure TMainForm.NodeIconButtonDblClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  3859. var
  3860. TalkingForm: TTalkingForm;
  3861. iWaitTimes: Integer;
  3862. RealICQUser: TRealICQUser;
  3863. SMSForm: TSMSForm;
  3864. begin
  3865. HideUserCardForm;
  3866. if (pgcMainWorkArea.ActivePage = tsAddrBook) then
  3867. begin
  3868. SMSForm := OpenSMSForm('', True);
  3869. SMSForm.edMobiles.Text := Employee.Mobile;
  3870. Exit;
  3871. end;
  3872. if IconButtonType = itCamera then
  3873. begin
  3874. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3875. begin
  3876. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3877. Exit;
  3878. end;
  3879. TalkingForm := GetTalkingForm(Employee.LoginName);
  3880. if TalkingForm = nil then
  3881. begin
  3882. TalkingForm := OpenTalkingForm(Employee.LoginName, True);
  3883. end;
  3884. iWaitTimes := 0;
  3885. while not TalkingForm.CanWriteMessage do
  3886. begin
  3887. Application.ProcessMessages;
  3888. Inc(iWaitTimes);
  3889. if iWaitTimes > 1000 then
  3890. break;
  3891. Sleep(10);
  3892. end;
  3893. TalkingForm.actVideo.Execute;
  3894. end;
  3895. if IconButtonType = itHeadImage then
  3896. begin
  3897. if pgcMainWorkArea.ActivePage = tsAddrBook then
  3898. Exit;
  3899. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3900. begin
  3901. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3902. Exit;
  3903. end;
  3904. OpenTalkingForm(Employee.LoginName, True);
  3905. end;
  3906. if IconButtonType = itSMS then
  3907. begin
  3908. OpenSMSForm(Employee.LoginName, True);
  3909. end;
  3910. if IconButtonType = itEmail then
  3911. begin
  3912. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(Employee.LoginName);
  3913. if (RealICQUser <> nil) and (RealICQUser.Email <> '') then
  3914. ShellExecute(handle, 'open', PChar('mailto:' + RealICQUser.Email), nil, nil, SW_SHOWNORMAL);
  3915. //AddWebBrowserToPageControl(Format('http://mail.lishui.gov.cn/web_email/module.phtml?module=mcomposef&to=%s', [RealICQUser.Email]), 999);
  3916. //AddWebBrowserToPageControl(Format('http://www.lxtalk.com/rd/', [RealICQUser.Email]), 999);
  3917. end;
  3918. if IconButtonType = itAddFriend then
  3919. begin
  3920. if AnsiSameText(MainForm.RealICQClient.LoginName, Employee.LoginName) then
  3921. begin
  3922. MessageBox(Handle, '不能添加自己为好友', '提示', MB_ICONINFORMATION);
  3923. Exit;
  3924. end;
  3925. ShowAddFriendWindow(Self, Employee.LoginName, Employee.DisplayName);
  3926. end;
  3927. if IconButtonType = itTel then
  3928. begin
  3929. { if not FPCAMessage.GetPCALoginStatus then Exit;
  3930. if (Employee.Mobile<>'') and (Employee.Tel<>'') then
  3931. begin
  3932. MenuItem:=ppSelCallTel.Items[0];
  3933. MenuItem.Hint:=Employee.Mobile+char(10)+Employee.DisplayName;
  3934. MenuItem:=ppSelCallTel.Items[1];
  3935. MenuItem.Hint:=Employee.Tel+char(10)+Employee.DisplayName;
  3936. ppSelCallTel.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y - 50);
  3937. Exit;
  3938. end;
  3939. if Employee.Mobile<>'' then CallNumber:=Employee.Mobile;
  3940. if Employee.Tel<>'' then CallNumber:=Employee.Tel;
  3941. FPCAMessage.SendCallTelOutPCAMessage(CallNumber,Employee.DisplayName);
  3942. }
  3943. end;
  3944. end;
  3945. //------------------------------------------------------------------------------
  3946. procedure TMainForm.miGoSpaceClick(Sender: TObject);
  3947. var
  3948. LoginName: string;
  3949. RealICQUser: TRealICQUser;
  3950. begin
  3951. LoginName := GetSelectedLoginName;
  3952. if LoginName <> '' then
  3953. begin
  3954. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  3955. RealICQUser.ClickedSNSIcon;
  3956. try
  3957. RealICQClientUserInformationReady(RealICQClient, RealICQUser);
  3958. finally
  3959. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + SNSHomePage, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(RealICQUser.LoginName)])), '', SW_SHOWDEFAULT);
  3960. end;
  3961. end;
  3962. end;
  3963. //------------------------------------------------------------------------------
  3964. procedure TMainForm.NodeOnline(Employee: TRealICQEmployee);
  3965. var
  3966. ARealICQUser: TRealICQUser;
  3967. begin
  3968. //MessageBox(Handle, '4', '4', MB_OK);
  3969. if RealICQClient.Me = nil then
  3970. Exit;
  3971. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  3972. Exit;
  3973. //MessageBox(Handle, '5', '5', MB_OK);
  3974. if Employee.Data <> nil then
  3975. begin
  3976. ARealICQUser := TRealICQUser(Employee.Data);
  3977. if ARealICQUser = RealICQClient.Me then
  3978. Exit;
  3979. if PlaySoundOnOnline then
  3980. PlayEventSound(OnlineEventSound);
  3981. if ShowHintOnOnline then
  3982. ShowOnOffAlertForm(ARealICQUser);
  3983. end;
  3984. //MessageBox(Handle, '6', '6', MB_OK);
  3985. end;
  3986. //------------------------------------------------------------------------------
  3987. procedure TMainForm.NodeOffline(Employee: TRealICQEmployee);
  3988. var
  3989. ARealICQUser: TRealICQUser;
  3990. begin
  3991. if RealICQClient.Me = nil then
  3992. Exit;
  3993. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  3994. Exit;
  3995. if Employee.Data <> nil then
  3996. begin
  3997. ARealICQUser := TRealICQUser(Employee.Data);
  3998. if ARealICQUser = RealICQClient.Me then
  3999. Exit;
  4000. if PlaySoundOnOffline then
  4001. PlayEventSound(OfflineEventSound);
  4002. if ShowHintOnOffline then
  4003. ShowOnOffAlertForm(ARealICQUser);
  4004. end;
  4005. end;
  4006. //------------------------------------------------------------------------------
  4007. procedure TMainForm.TimerForHideUserCardTimer(Sender: TObject);
  4008. var
  4009. Rect: TRect;
  4010. begin
  4011. TimerForHideUserCard.Enabled := False;
  4012. if Assigned(UserCardViewForm) then
  4013. begin
  4014. Rect.Left := UserCardViewForm.Left;
  4015. Rect.Top := UserCardViewForm.Top;
  4016. Rect.Right := UserCardViewForm.Left + UserCardViewForm.Width;
  4017. Rect.Bottom := UserCardViewForm.Top + UserCardViewForm.Height;
  4018. if PtInRect(Rect, Mouse.CursorPos) then
  4019. begin
  4020. UserCardViewForm.tmrForClose.Enabled := True;
  4021. Exit;
  4022. end;
  4023. end;
  4024. if not TimerForShowUserCard.Enabled then
  4025. FreeAndNil(UserCardViewForm);
  4026. // TimerForHideUserCard.Enabled := False;
  4027. //
  4028. // if Assigned(UserCardForm) then
  4029. // begin
  4030. // Rect.Left := UserCardForm.Left;
  4031. // Rect.Top := UserCardForm.Top;
  4032. // Rect.Right := UserCardForm.Left + UserCardForm.Width;
  4033. // Rect.Bottom := UserCardForm.Top + UserCardForm.Height;
  4034. // if PtInRect(Rect, Mouse.CursorPos) then
  4035. // begin
  4036. // UserCardForm.TimerForClose.Enabled := True;
  4037. // Exit;
  4038. // end;
  4039. // end;
  4040. // if not TimerForShowUserCard.Enabled then FreeAndNil(UserCardForm);
  4041. end;
  4042. //------------------------------------------------------------------------------
  4043. procedure TMainForm.NodeOnHeadImageMouseEnter(Employee: TRealICQEmployee);
  4044. var
  4045. Rect: TRect;
  4046. P: TPoint;
  4047. begin
  4048. Rect := Employee.Node.DisplayRect(False);
  4049. P.X := Rect.Left;
  4050. P.Y := Rect.Top;
  4051. P := Employee.Node.TreeView.ClientToScreen(P);
  4052. if UserCardForm <> nil then
  4053. begin
  4054. FNeedShowUserCardLoginName := Employee.LoginName;
  4055. FShowUserCardTargetTop := P.Y;
  4056. TimerForShowUserCardTimer(nil);
  4057. end
  4058. else
  4059. begin
  4060. ShowUserCardForm(Employee.LoginName, P.Y);
  4061. end;
  4062. end;
  4063. procedure TMainForm.NodeOnHeadImageMouseLeave(Employee: TRealICQEmployee);
  4064. begin
  4065. HideUserCardForm;
  4066. end;
  4067. procedure TMainForm.ItemOnHeadImageEnter(Item: TRealICQContacterListItem);
  4068. var
  4069. Rect: TRect;
  4070. P: TPoint;
  4071. begin
  4072. Rect := Item.ListView.ListBox.ItemRect(Item.ItemIndex);
  4073. P.X := Rect.Left;
  4074. P.Y := Rect.Top;
  4075. P := Item.ListView.ListBox.ClientToScreen(P);
  4076. if UserCardForm <> nil then
  4077. begin
  4078. FNeedShowUserCardLoginName := Item.LoginName;
  4079. FShowUserCardTargetTop := P.Y;
  4080. TimerForShowUserCardTimer(nil);
  4081. end
  4082. else
  4083. begin
  4084. ShowUserCardForm(Item.LoginName, P.Y);
  4085. end;
  4086. end;
  4087. procedure TMainForm.ItemOnHeadImageLeave(Item: TRealICQContacterListItem);
  4088. begin
  4089. HideUserCardForm;
  4090. end;
  4091. procedure TMainForm.imgHeadImageBorderMouseEnter(Sender: TObject);
  4092. var
  4093. P: TPoint;
  4094. begin
  4095. P.X := 0;
  4096. P.Y := 0;
  4097. P := imgHeadImageBorder.ClientToScreen(P);
  4098. if UserCardForm <> nil then
  4099. begin
  4100. FNeedShowUserCardLoginName := RealICQClient.LoginName;
  4101. FShowUserCardTargetTop := P.Y;
  4102. TimerForShowUserCardTimer(nil);
  4103. end
  4104. else
  4105. begin
  4106. ShowUserCardForm(RealICQClient.LoginName, P.Y);
  4107. end;
  4108. end;
  4109. procedure TMainForm.imgHeadImageBorderMouseLeave(Sender: TObject);
  4110. begin
  4111. HideUserCardForm;
  4112. end;
  4113. procedure TMainForm.ShowUserCardForm(ALoginName: string; ATargetTop: Integer);
  4114. begin
  4115. //FreeAndNil(UserCardForm);
  4116. FNeedShowUserCardLoginName := ALoginName;
  4117. FShowUserCardTargetTop := ATargetTop;
  4118. TimerForShowUserCard.Enabled := False;
  4119. TimerForShowUserCard.Enabled := True;
  4120. TimerForHideUserCard.Enabled := False;
  4121. end;
  4122. procedure TMainForm.HideUserCardForm;
  4123. begin
  4124. if TimerForHideUserCard <> nil then
  4125. begin
  4126. TimerForHideUserCard.Enabled := False;
  4127. TimerForHideUserCard.Enabled := True;
  4128. TimerForShowUserCard.Enabled := False;
  4129. end;
  4130. end;
  4131. //------------------------------------------------------------------------------
  4132. procedure TMainForm.NodeOnMouseEnter(Employee: TRealICQEmployee);
  4133. begin
  4134. end;
  4135. //------------------------------------------------------------------------------
  4136. procedure TMainForm.NodeOnMouseLeave(Employee: TRealICQEmployee);
  4137. begin
  4138. end;
  4139. //------------------------------------------------------------------------------
  4140. procedure TMainForm.ItemOnMouseEnter(Item: TRealICQContacterListItem);
  4141. begin
  4142. //
  4143. end;
  4144. //------------------------------------------------------------------------------
  4145. procedure TMainForm.ItemOnMouseLeave(Item: TRealICQContacterListItem);
  4146. begin
  4147. end;
  4148. //------------------------------------------------------------------------------
  4149. procedure TMainForm.ItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  4150. begin
  4151. if IconButtonType = ltHeadImage then
  4152. begin
  4153. if UserCardForm = nil then
  4154. UserCardForm := TUserCardForm.Create(Self);
  4155. if UserCardForm.Width - 10 >= Left then
  4156. UserCardForm.Left := Left + pnlWorkArea.Width + 20
  4157. else
  4158. UserCardForm.Left := Left - UserCardForm.Width + 10;
  4159. UserCardForm.Top := Mouse.CursorPos.Y - 50;
  4160. UserCardForm.LoginName := Item.LoginName;
  4161. Application.ProcessMessages;
  4162. UserCardForm.Show;
  4163. end;
  4164. end;
  4165. //------------------------------------------------------------------------------
  4166. procedure TMainForm.ItemIconButtonDblClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  4167. var
  4168. TalkingForm: TTalkingForm;
  4169. iWaitTimes: Integer;
  4170. RealICQUser: TRealICQUser;
  4171. // CallNumber:String;
  4172. // MenuItem:TMenuItem;
  4173. begin
  4174. if FSearchListViewInVisible then //设置查找输入框为初始状态
  4175. begin
  4176. edFilterKeyword.Text := '查找联系人...';
  4177. edFilterKeyword.Font.Color := clGray;
  4178. end;
  4179. if pnlSearchMoreUser.Visible then
  4180. begin
  4181. edtSearchMoreUser.Text := '查找联系人...';
  4182. edtSearchMoreUser.Font.Color := clGray;
  4183. end;
  4184. if IconButtonType = ltCamera then
  4185. begin
  4186. TalkingForm := GetTalkingForm(Item.LoginName);
  4187. if TalkingForm = nil then
  4188. begin
  4189. TalkingForm := OpenTalkingForm(Item.LoginName, True);
  4190. end;
  4191. iWaitTimes := 0;
  4192. while not TalkingForm.CanWriteMessage do
  4193. begin
  4194. Application.ProcessMessages;
  4195. Inc(iWaitTimes);
  4196. if iWaitTimes > 1000 then
  4197. break;
  4198. Sleep(10);
  4199. end;
  4200. TalkingForm.actVideo.Execute;
  4201. end;
  4202. if IconButtonType = ltHeadImage then
  4203. begin
  4204. if AnsiSameText(Item.LoginName, RealICQClient.Me.LoginName) then
  4205. begin
  4206. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  4207. Exit;
  4208. end;
  4209. OpenTalkingForm(Item.LoginName, True);
  4210. end;
  4211. if IconButtonType = ltSMS then
  4212. begin
  4213. OpenSMSForm(Item.LoginName, True);
  4214. end;
  4215. if IconButtonType = ltEmail then
  4216. begin
  4217. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(Item.LoginName);
  4218. if RealICQUser <> nil then
  4219. //AddWebBrowserToPageControl(Format('http://mail.lishui.gov.cn/web_email/module.phtml?module=mcomposef&to=%s', [RealICQUser.Email]), 999);
  4220. end;
  4221. if IconButtonType = ltAddFriend then
  4222. begin
  4223. if AnsiSameText(MainForm.RealICQClient.LoginName, Item.LoginName) then
  4224. begin
  4225. MessageBox(Handle, '不能添加自己为好友', '提示', MB_ICONINFORMATION);
  4226. Exit;
  4227. end;
  4228. ShowAddFriendWindow(Self, Item.LoginName, Item.DisplayName);
  4229. end;
  4230. if IconButtonType = ltTel then
  4231. begin
  4232. { if not FPCAMessage.GetPCALoginStatus then Exit;
  4233. if (Item.Mobile<>'') and (Item.Tel<>'') then
  4234. begin
  4235. MenuItem:=ppSelCallTel.Items[0];
  4236. MenuItem.Hint:=Item.Mobile+char(10)+Item.DisplayName;
  4237. MenuItem:=ppSelCallTel.Items[1];
  4238. MenuItem.Hint:=Item.Tel+char(10)+Item.DisplayName;
  4239. ppSelCallTel.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y - 50);
  4240. Exit;
  4241. end;
  4242. if Item.Mobile<>'' then CallNumber:=Item.Mobile;
  4243. if Item.Tel<>'' then CallNumber:=Item.Tel;
  4244. FPCAMessage.SendCallTelOutPCAMessage(CallNumber,Item.DisplayName);
  4245. }
  4246. end;
  4247. end;
  4248. //------------------------------------------------------------------------------
  4249. procedure TMainForm.ItemDoubleClick(Item: TRealICQContacterListItem);
  4250. var
  4251. ATeam: TRealICQTeam;
  4252. Branch: TRealICQBranch;
  4253. begin
  4254. if FSearchListViewInVisible then //设置查找输入框为初始状态
  4255. begin
  4256. edFilterKeyword.Text := '查找联系人...';
  4257. edFilterKeyword.Font.Color := clGray;
  4258. end;
  4259. if IsChild(Handle, Item.ListView.Handle) then
  4260. begin
  4261. if GetActiveTabSheetName = LVTeams then
  4262. begin
  4263. ATeam := TRealICQTeam(Item.Data);
  4264. OpenTeamTalkingForm(ATeam.TeamID);
  4265. Exit;
  4266. end;
  4267. end;
  4268. if (Item.StateIndex = 0) and (Item.Data <> nil) then //双击的是部门
  4269. begin
  4270. Branch := Item.Data;
  4271. Branch.Node.Selected := True;
  4272. end
  4273. else if (Item.Data <> nil) then
  4274. begin
  4275. if AnsiSameText(Item.LoginName, RealICQClient.Me.LoginName) then
  4276. begin
  4277. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  4278. Exit;
  4279. end;
  4280. OpenTalkingForm(Item.LoginName);
  4281. end;
  4282. if pnlSearchMoreUser.Visible then
  4283. begin
  4284. edtSearchMoreUser.Text := '查找联系人...';
  4285. end;
  4286. end;
  4287. //------------------------------------------------------------------------------
  4288. procedure TMainForm.ItemOnline(Item: TRealICQContacterListItem);
  4289. var
  4290. iIndex: Integer;
  4291. ARealICQUser: TRealICQUser;
  4292. begin
  4293. //MessageBox(Handle, '1', '1', MB_OK);
  4294. if RealICQClient.Me = nil then
  4295. Exit;
  4296. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  4297. Exit;
  4298. iIndex := FContacterListViews.IndexOfObject(Item.ListView);
  4299. if FContacterListViews[iIndex] = LVLatests then
  4300. exit;
  4301. //MessageBox(Handle, '2', '2', MB_OK);
  4302. if Item.Data <> nil then
  4303. begin
  4304. ARealICQUser := TRealICQUser(Item.Data);
  4305. if (TFriendsService.GetService.IsFriend(ARealICQUser.LoginName)) and (TWorkmatesService.GetService.IsWorkmate(ARealICQUser.LoginName)) then
  4306. begin
  4307. if PlaySoundOnOnline then
  4308. PlayEventSound(OnlineEventSound);
  4309. if ShowHintOnOnline then
  4310. ShowOnOffAlertForm(ARealICQUser);
  4311. end;
  4312. end;
  4313. //MessageBox(Handle, '3', '3', MB_OK);
  4314. end;
  4315. //------------------------------------------------------------------------------
  4316. procedure TMainForm.ItemOffline(Item: TRealICQContacterListItem);
  4317. var
  4318. iIndex: Integer;
  4319. ARealICQUser: TRealICQUser;
  4320. begin
  4321. if RealICQClient.Me = nil then
  4322. Exit;
  4323. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  4324. Exit;
  4325. iIndex := FContacterListViews.IndexOfObject(Item.ListView);
  4326. if FContacterListViews[iIndex] = LVLatests then
  4327. exit;
  4328. if Item.Data <> nil then
  4329. begin
  4330. ARealICQUser := TRealICQUser(Item.Data);
  4331. if (TFriendsService.GetService.IsFriend(ARealICQUser.LoginName)) and (TWorkmatesService.GetService.IsWorkmate(ARealICQUser.LoginName)) then
  4332. begin
  4333. if PlaySoundOnOffline then
  4334. PlayEventSound(OfflineEventSound);
  4335. if ShowHintOnOffline then
  4336. ShowOnOffAlertForm(ARealICQUser);
  4337. end;
  4338. end;
  4339. end;
  4340. //------------------------------------------------------------------------------
  4341. procedure TMainForm.lblLogsClick(Sender: TObject);
  4342. var
  4343. ANoticesRecord: TSystemNotices;
  4344. begin
  4345. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  4346. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(ReadMessageURL + ANoticesRecord.URL)])), '', SW_SHOWDEFAULT);
  4347. end;
  4348. procedure TMainForm.lblLogsMouseEnter(Sender: TObject);
  4349. begin
  4350. lblLogs.Font.Style := [fsUnderline];
  4351. TimerForShowSystemNotices.Enabled := False;
  4352. end;
  4353. procedure TMainForm.lblLogsMouseLeave(Sender: TObject);
  4354. begin
  4355. lblLogs.Font.Style := [];
  4356. TimerForShowSystemNotices.Enabled := FSystemNotices.Count > 0;
  4357. end;
  4358. procedure TMainForm.lblReConnectClick(Sender: TObject);
  4359. begin
  4360. RealICQClient.ReConnectAndLogin;
  4361. end;
  4362. //------------------------------------------------------------------------------
  4363. procedure TMainForm.lblRegisterMouseEnter(Sender: TObject);
  4364. begin
  4365. (Sender as TLabel).Font.Style := [fsUnderline];
  4366. end;
  4367. //------------------------------------------------------------------------------
  4368. procedure TMainForm.lblRegisterMouseLeave(Sender: TObject);
  4369. begin
  4370. (Sender as TLabel).Font.Style := [];
  4371. end;
  4372. //------------------------------------------------------------------------------
  4373. procedure TMainForm.ChangeUIColor(AColor: TColor);
  4374. var
  4375. iLoop: Integer;
  4376. IUIColor: IRealICQUIColor;
  4377. begin
  4378. inherited ChangeUIColor(AColor);
  4379. TMainFormController.GetController.ChangeUIColor(AColor);
  4380. spb360SD.ChangeUIColor(AColor);
  4381. spb360Safe.ChangeUIColor(AColor);
  4382. spbNetworkBackup.ChangeUIColor(AColor);
  4383. spbRefreshBranchUsers.ChangeUIColor(AColor);
  4384. btShowMiniPage.ChangeUIColor(AColor);
  4385. spbDisplayName.ChangeUIColor(AColor);
  4386. spbWatchword.ChangeUIColor(AColor);
  4387. shpWatchwordBorder.Pen.Color := ConvertColorToColor(shpWatchwordBorder.Pen.Color, AColor);
  4388. spbSelUIColor.ChangeUIColor(AColor);
  4389. spbHistroyMessage.ChangeUIColor(AColor);
  4390. spbAddFriend.ChangeUIColor(AColor);
  4391. spblock.ChangeUIColor(AColor);
  4392. btMainMenu.ChangeUIColor(AColor);
  4393. //btOA.ChangeUIColor(AColor);
  4394. //btSwap.ChangeUIColor(AColor);
  4395. spbShowNotReadMessage.ChangeUIColor(AColor);
  4396. spbWinMeet.ChangeUIColor(AColor);
  4397. spbAddFriend.Font.Color := ConvertColorToColor(spbAddFriend.Font.Color, AColor);
  4398. spbHistroyMessage.Font.Color := ConvertColorToColor(spbHistroyMessage.Font.Color, AColor);
  4399. spblock.Font.Color := ConvertColorToColor(spblock.Font.Color, AColor);
  4400. ConvertBitmapToColor(MyContacters.Picture.Bitmap, AColor);
  4401. ConvertBitmapToColor(SysMsg.Picture.Bitmap, AColor);
  4402. ConvertBitmapToColor(MyFriend.Picture.Bitmap, AColor);
  4403. ConvertBitmapToColor(MyTeam.Picture.Bitmap, AColor);
  4404. ConvertBitmapToColor(Latests.Picture.Bitmap, AColor);
  4405. ConvertBitmapToColor(MyContactersIcon.Picture.Bitmap, AColor);
  4406. ConvertBitmapToColor(SysMsgIcon.Picture.Bitmap, AColor);
  4407. ConvertBitmapToColor(MyFriendIcon.Picture.Bitmap, AColor);
  4408. ConvertBitmapToColor(MyTeamIcon.Picture.Bitmap, AColor);
  4409. ConvertBitmapToColor(LatestsIcon.Picture.Bitmap, AColor);
  4410. ConvertBitmapToColor(RealICQHoverImage1.Picture.Bitmap, AColor);
  4411. {通讯录}
  4412. ConvertBitmapToColor(imgAddrBookToolbarBack.Picture.Bitmap, AColor);
  4413. imgAddrBookToolbarBack.Invalidate;
  4414. spbAddGroupUser.ChangeUIColor(AColor);
  4415. spbAddGroup.ChangeUIColor(AColor);
  4416. spbImportGroupUser.ChangeUIColor(AColor);
  4417. {通讯录}
  4418. ShpHint.Pen.Color := ConvertColorToColor(ShpHint.Pen.Color, AColor);
  4419. btPrevLog.ChangeUIColor(AColor);
  4420. btNextLog.ChangeUIColor(AColor);
  4421. ConvertBitmapToColor(ImageForCustomerTop.Picture.Bitmap, AColor);
  4422. ImageForCustomerTop.Invalidate;
  4423. btCustomerLogin.ChangeUIColor(AColor);
  4424. btCustomerLogout.ChangeUIColor(AColor);
  4425. btCustomerDisplayName.ChangeUIColor(AColor);
  4426. ShpLeft.Pen.Color := ConvertColorToColor(ShpLeft.Pen.Color, AColor);
  4427. ShpBottom.Pen.Color := ConvertColorToColor(ShpBottom.Pen.Color, AColor);
  4428. ShpRight.Pen.Color := ConvertColorToColor(ShpRight.Pen.Color, AColor);
  4429. ShpSearchLeft.Pen.Color := ConvertColorToColor(ShpSearchLeft.Pen.Color, AColor);
  4430. ShpSearchBottom.Pen.Color := ConvertColorToColor(ShpSearchBottom.Pen.Color, AColor);
  4431. ShpSearchRight.Pen.Color := ConvertColorToColor(ShpSearchRight.Pen.Color, AColor);
  4432. spbEmail.ChangeUIColor(AColor);
  4433. sbpSMS.ChangeUIColor(AColor);
  4434. spbPersonManage.ChangeUIColor(AColor);
  4435. spbTelMeeting.ChangeUIColor(AColor);
  4436. pnlToolBar.Color := FormColor;
  4437. PnlTop.Color := FormColor;
  4438. pnlWorkArea.Color := FormColor;
  4439. pnlLogout.Color := FormColor;
  4440. pgcMainWorkArea.BackColor := FormColor;
  4441. pnlLocked.Color := FormColor;
  4442. btn_lock_DisplayName.ChangeUIColor(AColor);
  4443. btn_unlock.ChangeUIColor(AColor);
  4444. ConvertBitmapToColor(img_lockback_top.Picture.Bitmap, AColor);
  4445. //ConvertBitmapToColor(shp_lock_client.Picture.Bitmap, AColor);
  4446. //txt_locked.color:= FormColor;
  4447. pnlClient.Color := FormColor;
  4448. pnlNDToolBar.Color := FormColor;
  4449. pnlNDStateBar.Color := FormColor;
  4450. pnlMiddleClient.Color := FormColor;
  4451. pnlAddrBkStateBar.Color := FormColor;
  4452. pnlCustomerServiceStatus.Color := FormColor;
  4453. ConvertBitmapToColor(imgWebToolBack.Picture.Bitmap, AColor);
  4454. imgWebToolBack.Invalidate;
  4455. spbPrev.ChangeUIColor(AColor);
  4456. spbNext.ChangeUIColor(AColor);
  4457. spbStop.ChangeUIColor(AColor);
  4458. spbRefresh.ChangeUIColor(AColor);
  4459. spbAddToNA.ChangeUIColor(AColor);
  4460. spbGo.ChangeUIColor(AColor);
  4461. spbWebClose.ChangeUIColor(AColor);
  4462. sbpNewWebTab.ChangeUIColor(AColor);
  4463. TabSetMuiltWeb.BackgroundColor := ConvertColorToColor(TabSetMuiltWeb.BackgroundColor, AColor);
  4464. TabSetMuiltWeb.SelectedColor := ConvertColorToColor(TabSetMuiltWeb.SelectedColor, AColor);
  4465. shpWebStatus.Pen.Color := ConvertColorToColor(shpWebStatus.Pen.Color, AColor);
  4466. shpWebLeftBorder.Pen.Color := ConvertColorToColor(shpWebLeftBorder.Pen.Color, AColor);
  4467. ConvertBitmapToColor(imgNDToolbarBack.Picture.Bitmap, AColor);
  4468. imgNDToolbarBack.Invalidate;
  4469. ConvertBitmapToColor(imgLogoutBKTop.Picture.Bitmap, AColor);
  4470. imgLogoutBKTop.Invalidate;
  4471. ConvertBitmapToColor(imgLogoutBK.Picture.Bitmap, AColor);
  4472. imgLogoutBK.Invalidate;
  4473. spLoginNameBorder.Pen.Color := ConvertColorToColor(spLoginNameBorder.Pen.Color, AColor);
  4474. spbChangeLoginName.ChangeUIColor(AColor);
  4475. spPasswordBorder.Pen.Color := ConvertColorToColor(spPasswordBorder.Pen.Color, AColor);
  4476. pnlSelectServer.Color := FormColor;
  4477. spServerListBorder.Pen.Color := ConvertColorToColor(spServerListBorder.Pen.Color, AColor);
  4478. spbSelectServer.ChangeUIColor(AColor);
  4479. shpSearchMoreUser.Pen.Color := ConvertColorToColor(shpSearchMoreUser.Pen.Color, AColor);
  4480. spbCancelFilter.ChangeUIColor(AColor);
  4481. shpFilterBorder.Pen.Color := ConvertColorToColor(shpFilterBorder.Pen.Color, AColor);
  4482. spbLoginState.ChangeUIColor(AColor);
  4483. spbSavePassword.ChangeUIColor(AColor);
  4484. spbAutoLogin.ChangeUIColor(AColor);
  4485. btLogin.ChangeUIColor(AColor);
  4486. spbNDMoveUp.ChangeUIColor(AColor);
  4487. spbNDNewDir.ChangeUIColor(AColor);
  4488. spbNDDelete.ChangeUIColor(AColor);
  4489. shpNDDirBorder.Pen.Color := ConvertColorToColor(shpNDDirBorder.Pen.Color, AColor);
  4490. spbNDUpload.ChangeUIColor(AColor);
  4491. spbNDDownload.ChangeUIColor(AColor);
  4492. spbNDConnect.ChangeUIColor(AColor);
  4493. spbNDDisconnect.ChangeUIColor(AColor);
  4494. spbNDRefresh.ChangeUIColor(AColor);
  4495. spbNDCancelAll.ChangeUIColor(AColor);
  4496. TabSetNDMissions.SelectedColor := clWhite;
  4497. TabSetNDMissions.BackgroundColor := clWhite;
  4498. pnlNDMissions.Color := clWhite;
  4499. ConvertBitmapToColor(imgHeadImageBorder.Picture.Bitmap, AColor);
  4500. imgHeadImageBorder.Invalidate;
  4501. ConvertBitmapToColor(imgBottomMenu.Picture.Bitmap, AColor);
  4502. imgBottomMenu.Invalidate;
  4503. ConvertBitmapToColor(imgTitleBackMiddle.Picture.Bitmap, AColor);
  4504. imgTitleBackMiddle.Invalidate;
  4505. IUIColor := pgcMainWorkArea;
  4506. IUIColor.ChangeUIColor(AColor);
  4507. for iLoop := 0 to FContacterListViews.Count - 1 do
  4508. begin
  4509. IUIColor := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  4510. IUIColor.ChangeUIColor(AColor);
  4511. end;
  4512. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  4513. begin
  4514. IUIColor := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  4515. IUIColor.ChangeUIColor(AColor);
  4516. end;
  4517. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  4518. begin
  4519. IUIColor := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  4520. IUIColor.ChangeUIColor(AColor);
  4521. end;
  4522. if Assigned(FTVCustomerLatests) then
  4523. FTVCustomerLatests.ChangeUIColor(AColor);
  4524. // if Assigned(FLVCustomers) then FLVCustomers.ChangeUIColor(AColor);
  4525. if Assigned(FLVSystemMessage) then
  4526. FLVSystemMessage.ChangeUIColor(AColor);
  4527. if Assigned(FLVTeams) then
  4528. FLVTeams.ChangeUIColor(AColor);
  4529. if tsNetWorkDisk.Parent <> nil then
  4530. begin
  4531. FLVNetWorkDisk.ChangeUIColor(AColor);
  4532. FLVNetWorkDiskUploadingFiles.ChangeUIColor(AColor);
  4533. FLVNetWorkDiskDownloadingFiles.ChangeUIColor(AColor);
  4534. end;
  4535. btLogin.ChangeUIColor(AColor);
  4536. btLogin.Invalidate;
  4537. spbContacterViewStyle.ChangeUIColor(AColor);
  4538. spbCreateTeam.ChangeUIColor(AColor);
  4539. spbFindTeam.ChangeUIColor(AColor);
  4540. pnlTeams.Color := ConvertColorToColor(pnlTeams.Color, AColor);
  4541. if CreateTeamForm <> nil then
  4542. CreateTeamForm.ChangeUIColor(AColor);
  4543. if SearchForm <> nil then
  4544. SearchForm.ChangeUIColor(AColor);
  4545. if SearchTeamForm <> nil then
  4546. SearchTeamForm.ChangeUIColor(AColor);
  4547. if SelFaceForm <> nil then
  4548. SelFaceForm.ChangeUIColor(AColor);
  4549. if CustomFacesManagerForm <> nil then
  4550. CustomFacesManagerForm.ChangeUIColor(AColor);
  4551. if NotReadMessageBoxForm <> nil then
  4552. NotReadMessageBoxForm.ChangeUIColor(AColor);
  4553. ChangeAddFriendFormColor(AColor);
  4554. ChangeAddFriendRequestFormColor(AColor);
  4555. // ChangeSeeUserInformationFormColor(AColor);
  4556. ChangeTalkingFormColor(AColor);
  4557. ChangeSMSFormColor(AColor);
  4558. ChangeTeamOptionsFormColor(AColor);
  4559. ChangeSystemMessageFormsColor(AColor);
  4560. end;
  4561. //------------------------------------------------------------------------------
  4562. function TMainForm.GetListViewByLoginName(ALoginName: string; AOnlyInGroups: Boolean = False): TRealICQContacterListView;
  4563. var
  4564. GroupName: string;
  4565. iLoop, jLoop, iIndex, ContacterIndex: Integer;
  4566. GroupMembers: TStringList;
  4567. ListView: TRealICQContacterListView;
  4568. begin
  4569. Result := nil;
  4570. if not AOnlyInGroups then
  4571. begin
  4572. if (TFriendsService.GetService.IsFriend(ALoginName)) and (TWorkmatesService.GetService.IsWorkmate(ALoginName)) then
  4573. begin
  4574. ContacterIndex := FContacterListViews.IndexOf(LVFriends);
  4575. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4576. Result := ListView;
  4577. end
  4578. else if RealICQClient.Blacklists.IndexOf(ALoginName) >= 0 then
  4579. begin
  4580. ContacterIndex := FContacterListViews.IndexOf(LVBlacklists);
  4581. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4582. if ListView.Items.IndexOf(ALoginName) = -1 then
  4583. ListView.Items.Add(ALoginName);
  4584. Result := ListView;
  4585. exit;
  4586. end
  4587. else if RealICQClient.Strangers.IndexOf(ALoginName) >= 0 then
  4588. begin
  4589. ContacterIndex := FContacterListViews.IndexOf(LVStrangers);
  4590. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4591. if ListView.Items.IndexOf(ALoginName) = -1 then
  4592. ListView.Items.Add(ALoginName);
  4593. Result := ListView;
  4594. exit;
  4595. end;
  4596. end;
  4597. if FShowGroup then
  4598. begin
  4599. for iLoop := 0 to FGroups.Count - 1 do
  4600. begin
  4601. GroupName := FGroups[iLoop];
  4602. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  4603. for jLoop := 0 to GroupMembers.Count - 1 do
  4604. begin
  4605. if AnsiSameText(GroupMembers[jLoop], ALoginName) then
  4606. begin
  4607. iIndex := FContacterListViews.IndexOf(GroupName);
  4608. if iIndex >= 0 then
  4609. begin
  4610. ListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  4611. if ListView.Items.IndexOf(ALoginName) = -1 then
  4612. ListView.Items.Add(ALoginName);
  4613. Result := ListView;
  4614. end;
  4615. exit;
  4616. end;
  4617. end;
  4618. end;
  4619. end;
  4620. if Result <> nil then
  4621. if Result.Items.IndexOf(ALoginName) = -1 then
  4622. Result.Items.Add(ALoginName);
  4623. end;
  4624. //------------------------------------------------------------------------------
  4625. procedure TMainForm.ShowNavBarNumeric;
  4626. begin
  4627. //
  4628. end;
  4629. //-------------------显示好友列表---------------
  4630. procedure TMainForm.ShowFriendLists;
  4631. var
  4632. iLoop, itemIndex: Integer;
  4633. RealICQUser: TRealICQUser;
  4634. RealICQFriendTreeView: TRealICQContacterTreeView;
  4635. Friend: TRealICQEmployee;
  4636. begin
  4637. itemIndex := FContacterTreeViews.IndexOf(LvFriends);
  4638. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4639. for iLoop := FNotAddedEmployeeList.Count - 1 downto 0 do
  4640. begin
  4641. RealICQUser := FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  4642. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  4643. Continue;
  4644. if (RealICQFriendTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then
  4645. Continue;
  4646. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  4647. Friend.BranchID := LVFriends;
  4648. RealICQFriendTreeView.AddEmployee(Friend);
  4649. UpdateFriendNode(Friend, RealICQUser, False);
  4650. end;
  4651. end;
  4652. //------------------------------------------------------------------------------
  4653. procedure TMainForm.ShowGroupInterface;
  4654. var
  4655. GroupName, LoginName: string;
  4656. iLoop, jLoop, itemIndex: Integer;
  4657. RealICQUser: TRealICQUser;
  4658. RealICQFriendTreeView: TRealICQContacterTreeView;
  4659. Friend: TRealICQEmployee;
  4660. FriendGroup: TRealICQBranch;
  4661. GroupMembers: TStringList;
  4662. begin
  4663. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  4664. if ItemIndex >= 0 then
  4665. begin
  4666. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4667. try
  4668. RealICQFriendTreeView.Clear;
  4669. FreeAndNil(RealICQFriendTreeView);
  4670. FContacterTreeViews.Delete(ItemIndex);
  4671. except
  4672. end;
  4673. end;
  4674. ItemIndex := AddFriendTreeView(scrollBoxMyFriend, LVFriends);
  4675. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4676. RealICQFriendTreeView.AdjustPosition := False;
  4677. RealICQFriendTreeView.HideSystemScrollBar;
  4678. RealICQFriendTreeView.BeginUpdate;
  4679. SetFlashCaptionOnOnlineValue(False);
  4680. Screen.Cursor := crHourGlass;
  4681. try
  4682. //显示好友
  4683. ShowFriendLists;
  4684. //显示黑名单
  4685. //ShowBlacklists;
  4686. {$region '添加自定义分组'}
  4687. if FShowGroup then
  4688. begin
  4689. for iLoop := 0 to FGroups.Count - 1 do
  4690. begin
  4691. GroupName := FGroups[iLoop];
  4692. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  4693. FriendGroup := TRealICQBranch.Create(GroupName);
  4694. FriendGroup.BranchID := GroupName;
  4695. FriendGroup.ParentID := '';
  4696. FriendGroup.BranchName := GroupName;
  4697. RealICQFriendTreeView.AddBranch(FriendGroup);
  4698. RealICQFriendTreeView.MoveBranch(GroupName, LvFriends);
  4699. for jLoop := 0 to GroupMembers.Count - 1 do
  4700. begin
  4701. LoginName := GroupMembers[jLoop];
  4702. if (not TFriendsService.GetService.IsFriend(LoginName)) and (not TWorkmatesService.GetService.IsWorkmate(LoginName)) then
  4703. continue;
  4704. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  4705. continue;
  4706. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  4707. ItemIndex := RealICQFriendTreeView.EmployeeItems.IndexOf(LoginName);
  4708. if ItemIndex >= 0 then
  4709. RealICQFriendTreeView.EmployeeItems.Delete(ItemIndex);
  4710. Friend := TRealICQEmployee.Create(LoginName);
  4711. Friend.BranchID := FriendGroup.BranchName;
  4712. RealICQFriendTreeView.AddEmployee(Friend);
  4713. UpdateFriendNode(Friend, RealICQUser, False);
  4714. end;
  4715. end;
  4716. end;
  4717. {$endregion}
  4718. //展开好友列表
  4719. ItemIndex := RealICQFriendTreeView.BranchItems.IndexOf(LvFriends);
  4720. FriendGroup := RealICQFriendTreeView.BranchItems.Objects[itemIndex] as TRealICQBranch;
  4721. FriendGroup.Node.Expanded := True;
  4722. finally
  4723. //RealICQFriendTreeView.MoveFriendGroup(LvBlackLists,LvFriends);
  4724. PostMessage(RealICQFriendTreeView.Handle, WM_SIZE, 0, 0);
  4725. RealICQFriendTreeView.EndUpdate;
  4726. Screen.Cursor := crDefault;
  4727. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  4728. end;
  4729. end;
  4730. //------------------------------------------------------------------------------
  4731. function TMainForm.AddFriendTreeView(AOwner: TWinControl; GroupName: string): Integer;
  4732. var
  4733. RealICQFriendTreeView: TRealICQContacterTreeView;
  4734. Group: TRealICQBranch;
  4735. begin
  4736. RealICQFriendTreeView := TRealICQContacterTreeView.Create(AOwner);
  4737. RealICQFriendTreeView.Parent := AOwner;
  4738. RealICQFriendTreeView.Align := alClient;
  4739. RealICQFriendTreeView.Caption := '';
  4740. RealICQFriendTreeView.Color := clWhite;
  4741. RealICQFriendTreeView.ShowHint := True;
  4742. RealICQFriendTreeView.ParentFont := True;
  4743. RealICQFriendTreeView.ShowLine := False;
  4744. RealICQFriendTreeView.ShowBranchImage := False;
  4745. RealICQFriendTreeView.MustDrawButton := True;
  4746. RealICQFriendTreeView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4747. RealICQFriendTreeView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4748. RealICQFriendTreeView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4749. RealICQFriendTreeView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4750. RealICQFriendTreeView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4751. RealICQFriendTreeView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4752. RealICQFriendTreeView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4753. RealICQFriendTreeView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4754. RealICQFriendTreeView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4755. RealICQFriendTreeView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4756. RealICQFriendTreeView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4757. RealICQFriendTreeView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4758. RealICQFriendTreeView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4759. RealICQFriendTreeView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4760. RealICQFriendTreeView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4761. RealICQFriendTreeView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4762. RealICQFriendTreeView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4763. RealICQFriendTreeView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4764. RealICQFriendTreeView.ScrollBarButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarButtonPicture);
  4765. RealICQFriendTreeView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4766. RealICQFriendTreeView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4767. RealICQFriendTreeView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4768. RealICQFriendTreeView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4769. RealICQFriendTreeView.HeadImageBackColor := FLVHeadImageBackColor;
  4770. RealICQFriendTreeView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4771. RealICQFriendTreeView.DefaultPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4772. RealICQFriendTreeView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig44);
  4773. RealICQFriendTreeView.BranchClosedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + GroupClosedButtonPicture);
  4774. RealICQFriendTreeView.BranchOpenedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + GroupOpenedButtonPicture);
  4775. RealICQFriendTreeView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4776. RealICQFriendTreeView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4777. RealICQFriendTreeView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4778. RealICQFriendTreeView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4779. RealICQFriendTreeView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4780. RealICQFriendTreeView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4781. RealICQFriendTreeView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4782. RealICQFriendTreeView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4783. RealICQFriendTreeView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4784. RealICQFriendTreeView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4785. RealICQFriendTreeView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4786. RealICQFriendTreeView.ShowMobileButton := True;
  4787. RealICQFriendTreeView.ShowTelButton := False;
  4788. RealICQFriendTreeView.ShowCameraButton := True;
  4789. RealICQFriendTreeView.ShowHeadImageButton := False;
  4790. RealICQFriendTreeView.ShowEmailButton := False;
  4791. RealICQFriendTreeView.ShowSMSButton := True;
  4792. RealICQFriendTreeView.Style := FLVStyle;
  4793. RealICQFriendTreeView.CaptionStyle := FLVCaptionStyle;
  4794. RealICQFriendTreeView.ChangeUIColor(FUIMainColor);
  4795. RealICQFriendTreeView.PopupMenu := ppUserItemRightMenu;
  4796. RealICQFriendTreeView.OnItemOnline := NodeOnline;
  4797. RealICQFriendTreeView.OnItemOffline := NodeOffline;
  4798. RealICQFriendTreeView.OnItemDoubleClick := NodeDoubleClick;
  4799. RealICQFriendTreeView.OnItemIconButtonClick := NodeIconButtonClick;
  4800. RealICQFriendTreeView.OnItemIconButtonDblClick := NodeIconButtonDblClick;
  4801. RealICQFriendTreeView.OnItemMouseEnter := NodeOnMouseEnter;
  4802. RealICQFriendTreeView.OnItemMouseLeave := NodeOnMouseLeave;
  4803. Result := FContacterTreeViews.AddObject(GroupName, RealICQFriendTreeView);
  4804. RealICQFriendTreeView.AdjustPosition := False;
  4805. RealICQFriendTreeView.HideSystemScrollBar;
  4806. RealICQFriendTreeView.BeginUpdate;
  4807. try
  4808. Group := TRealICQBranch.Create(LVFriends);
  4809. Group.BranchID := LvFriends;
  4810. Group.ParentID := '0';
  4811. Group.BranchName := LvFriends;
  4812. RealICQFriendTreeView.AddBranch(Group);
  4813. finally
  4814. RealICQFriendTreeView.EndUpdate;
  4815. end;
  4816. end;
  4817. //------------------------------------------------------------------------------
  4818. function TMainForm.AddContacterTreeView(AOwner: TWinControl; GroupName: string): Integer;
  4819. var
  4820. RealICQContacterTreeView: TRealICQContacterTreeView;
  4821. begin
  4822. RealICQContacterTreeView := TRealICQContacterTreeView.Create(AOwner);
  4823. RealICQContacterTreeView.Parent := AOwner;
  4824. RealICQContacterTreeView.Align := alClient;
  4825. RealICQContacterTreeView.Caption := '';
  4826. RealICQContacterTreeView.Color := clWhite;
  4827. RealICQContacterTreeView.ShowHint := True;
  4828. RealICQContacterTreeView.ParentFont := True;
  4829. RealICQContacterTreeView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4830. RealICQContacterTreeView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4831. RealICQContacterTreeView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4832. RealICQContacterTreeView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4833. RealICQContacterTreeView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4834. RealICQContacterTreeView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4835. RealICQContacterTreeView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4836. RealICQContacterTreeView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4837. RealICQContacterTreeView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4838. RealICQContacterTreeView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4839. RealICQContacterTreeView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4840. RealICQContacterTreeView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4841. RealICQContacterTreeView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4842. RealICQContacterTreeView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4843. RealICQContacterTreeView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4844. RealICQContacterTreeView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4845. RealICQContacterTreeView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4846. RealICQContacterTreeView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4847. RealICQContacterTreeView.ScrollBarButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarButtonPicture);
  4848. RealICQContacterTreeView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4849. RealICQContacterTreeView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4850. RealICQContacterTreeView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4851. RealICQContacterTreeView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4852. RealICQContacterTreeView.HeadImageBackColor := FLVHeadImageBackColor;
  4853. RealICQContacterTreeView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4854. RealICQContacterTreeView.DefaultPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4855. RealICQContacterTreeView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig44);
  4856. RealICQContacterTreeView.BranchExpandedPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchExpandedPicture);
  4857. RealICQContacterTreeView.BranchCollapsedPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedPicture);
  4858. RealICQContacterTreeView.BranchClosedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchClosedButtonPicture);
  4859. RealICQContacterTreeView.BranchOpenedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchOpenedButtonPicture);
  4860. RealICQContacterTreeView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4861. RealICQContacterTreeView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4862. RealICQContacterTreeView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4863. RealICQContacterTreeView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4864. RealICQContacterTreeView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4865. RealICQContacterTreeView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4866. RealICQContacterTreeView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4867. RealICQContacterTreeView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4868. RealICQContacterTreeView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4869. RealICQContacterTreeView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4870. RealICQContacterTreeView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4871. RealICQContacterTreeView.AddFriendIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + AddFriendIcon);
  4872. RealICQContacterTreeView.NewSNSUpdateIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SNSIcon);
  4873. RealICQContacterTreeView.CheckFalsePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CheckFalse.bmp');
  4874. RealICQContacterTreeView.CheckTruePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CheckTrue.bmp');
  4875. RealICQContacterTreeView.ShowMobileButton := True;
  4876. RealICQContacterTreeView.ShowTelButton := False;
  4877. RealICQContacterTreeView.ShowCameraButton := True;
  4878. RealICQContacterTreeView.ShowHeadImageButton := False;
  4879. RealICQContacterTreeView.ShowEmailButton := False;
  4880. RealICQContacterTreeView.ShowSMSButton := True;
  4881. RealICQContacterTreeView.ShowNewSNSButton := True;
  4882. RealICQContacterTreeView.Style := FLVStyle;
  4883. RealICQContacterTreeView.CaptionStyle := FLVCaptionStyle;
  4884. RealICQContacterTreeView.ChangeUIColor(FUIMainColor);
  4885. RealICQContacterTreeView.PopupMenu := ppUserItemRightMenu;
  4886. if GroupName = LVMoreUsers then
  4887. begin
  4888. RealICQContacterTreeView.OnBranchClick := NodeBranchClick;
  4889. RealICQContacterTreeView.ShowAddFriendButton := True;
  4890. end;
  4891. if GroupName = LVAddrbook then
  4892. begin
  4893. RealICQContacterTreeView.OnBranchClick := NodeGroupClick;
  4894. end;
  4895. RealICQContacterTreeView.OnItemOnline := NodeOnline;
  4896. RealICQContacterTreeView.OnItemOffline := NodeOffline;
  4897. RealICQContacterTreeView.OnItemDoubleClick := NodeDoubleClick;
  4898. RealICQContacterTreeView.OnItemIconButtonClick := NodeIconButtonClick;
  4899. RealICQContacterTreeView.OnItemIconButtonDblClick := NodeIconButtonDblClick;
  4900. RealICQContacterTreeView.OnItemMouseEnter := NodeOnMouseEnter;
  4901. RealICQContacterTreeView.OnItemMouseLeave := NodeOnMouseLeave;
  4902. Result := FContacterTreeViews.AddObject(GroupName, RealICQContacterTreeView);
  4903. end;
  4904. procedure TMainForm.UpdateContacterListView(RealICQContacterListView: TRealICQContacterListView);
  4905. begin
  4906. RealICQContacterListView.Align := alClient;
  4907. RealICQContacterListView.Caption := '';
  4908. RealICQContacterListView.Color := clWhite;
  4909. RealICQContacterListView.ShowHint := True;
  4910. RealICQContacterListView.ParentFont := True;
  4911. RealICQContacterListView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4912. RealICQContacterListView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4913. RealICQContacterListView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4914. RealICQContacterListView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4915. RealICQContacterListView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4916. RealICQContacterListView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4917. RealICQContacterListView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4918. RealICQContacterListView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4919. RealICQContacterListView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4920. RealICQContacterListView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4921. RealICQContacterListView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4922. RealICQContacterListView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4923. RealICQContacterListView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4924. RealICQContacterListView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4925. RealICQContacterListView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4926. RealICQContacterListView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4927. RealICQContacterListView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4928. RealICQContacterListView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4929. RealICQContacterListView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4930. RealICQContacterListView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4931. RealICQContacterListView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4932. RealICQContacterListView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4933. RealICQContacterListView.HeadImageBackColor := FLVHeadImageBackColor;
  4934. RealICQContacterListView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4935. RealICQContacterListView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  4936. RealICQContacterListView.DefaultPictureMiddle.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureMiddle);
  4937. RealICQContacterListView.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4938. //RealICQContacterListView.DefaultPictureBigOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBigOffline);
  4939. //RealICQContacterListView.DefaultPictureMiddleOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureMiddleOffline);
  4940. //RealICQContacterListView.DefaultPictureSmallOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmallOffline);
  4941. RealICQContacterListView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4942. RealICQContacterListView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4943. RealICQContacterListView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4944. RealICQContacterListView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4945. RealICQContacterListView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4946. RealICQContacterListView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4947. RealICQContacterListView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4948. RealICQContacterListView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4949. RealICQContacterListView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4950. RealICQContacterListView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4951. RealICQContacterListView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4952. RealICQContacterListView.AddFriendIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + AddFriendIcon);
  4953. RealICQContacterListView.ShowAddFriendButton := False;
  4954. RealICQContacterListView.ShowMobileButton := True;
  4955. RealICQContacterListView.ShowTelButton := True;
  4956. RealICQContacterListView.ShowCameraButton := True;
  4957. RealICQContacterListView.ShowHeadImageButton := False;
  4958. RealICQContacterListView.ShowEmailButton := True;
  4959. RealICQContacterListView.ShowSMSButton := True;
  4960. RealICQContacterListView.Style := FLVStyle;
  4961. RealICQContacterListView.CaptionStyle := FLVCaptionStyle;
  4962. RealICQContacterListView.ChangeUIColor(FUIMainColor);
  4963. RealICQContacterListView.PopupMenu := ppUserItemRightMenu;
  4964. RealICQContacterListView.OnItemDoubleClick := ItemDoubleClick;
  4965. RealICQContacterListView.OnItemIconButtonClick := ItemIconButtonClick;
  4966. RealICQContacterListView.OnItemIconButtonDblClick := ItemIconButtonDblClick;
  4967. RealICQContacterListView.OnItemMouseEnter := nil; // ItemOnMouseEnter;
  4968. RealICQContacterListView.OnItemMouseLeave := nil; // ItemOnMouseLeave;
  4969. end;
  4970. //------------------------------------------------------------------------------
  4971. function TMainForm.AddContacterListView(AOwner: TWinControl; GroupName: string): Integer;
  4972. var
  4973. RealICQContacterListView: TRealICQContacterListView;
  4974. begin
  4975. RealICQContacterListView := TRealICQContacterListView.Create(AOwner);
  4976. RealICQContacterListView.Parent := AOwner;
  4977. UpdateContacterListView(RealICQContacterListView);
  4978. RealICQContacterListView.ShowAddFriendButton := GroupName = LVMoreUsers;
  4979. RealICQContacterListView.ShowMobileButton := not (GroupName = LVMoreUsers);
  4980. RealICQContacterListView.ShowTelButton := not (GroupName = LVMoreUsers);
  4981. RealICQContacterListView.ShowCameraButton := not (GroupName = LVMoreUsers);
  4982. RealICQContacterListView.ShowHeadImageButton := False; //not (GroupName=LVMoreUsers);
  4983. RealICQContacterListView.ShowEmailButton := False; // not (GroupName=LVMoreUsers);
  4984. RealICQContacterListView.ShowSMSButton := not (GroupName = LVMoreUsers);
  4985. if GroupName = LVMoreUsers then
  4986. begin
  4987. RealICQContacterListView.OnItemOnline := nil;
  4988. RealICQContacterListView.OnItemOffline := nil;
  4989. end
  4990. else
  4991. begin
  4992. RealICQContacterListView.OnItemOnline := ItemOnline;
  4993. RealICQContacterListView.OnItemOffline := ItemOffline;
  4994. end;
  4995. Result := FContacterListViews.AddObject(GroupName, RealICQContacterListView);
  4996. end;
  4997. //------------------------------------------------------------------------------
  4998. procedure TMainForm.ApplicationEventsDeactivate(Sender: TObject);
  4999. begin
  5000. if edWatchword.Visible then
  5001. edWatchwordExit(edWatchword);
  5002. FDblClickedTrayIcon := False;
  5003. end;
  5004. //------------------------------------------------------------------------------
  5005. procedure TMainForm.ApplicationEventsException(Sender: TObject; E: Exception);
  5006. var
  5007. LogFile: TextFile;
  5008. Log: string;
  5009. begin
  5010. Exit;
  5011. try
  5012. Log := DateTimeToStr(Now) + ':' + E.Message;
  5013. AssignFile(LogFile, ExtractFilePath(Application.ExeName) + 'Logs.txt');
  5014. try
  5015. try
  5016. Append(LogFile);
  5017. except
  5018. ReWrite(LogFile);
  5019. end;
  5020. Writeln(LogFile, Log);
  5021. finally
  5022. CloseFile(LogFile);
  5023. end;
  5024. except
  5025. end;
  5026. end;
  5027. procedure TMainForm.ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean);
  5028. var
  5029. classname: array[0..254] of char;
  5030. begin
  5031. if (Msg.message = WM_CLOSE) then
  5032. begin
  5033. getclassname(msg.hwnd, @classname, sizeof(classname)); //取类名
  5034. if classname = 'Shell Embedding' then
  5035. begin
  5036. PeekMessage(Msg, Msg.Hwnd, 0, 0, PM_REMOVE);
  5037. Handled := True; //该消息已处理,不再需要后续处理
  5038. end;
  5039. end;
  5040. if (Msg.message = WM_LBUTTONDOWN) or (Msg.message = WM_NCLBUTTONDOWN) then
  5041. begin
  5042. if IsChild(Handle, Msg.hwnd) then
  5043. begin
  5044. HideUserCardForm;
  5045. end;
  5046. end;
  5047. end;
  5048. procedure TMainForm.ppAddrBookListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5049. begin
  5050. ChangePPMenuColorMap(ppAddrBookList.PopupMenu);
  5051. end;
  5052. procedure TMainForm.ppAddrBookListPopup(Sender: TObject);
  5053. var
  5054. ItemIndex: Integer;
  5055. RealICQContacterTreeView: TRealICQContacterTreeView;
  5056. begin
  5057. ItemIndex := FContacterTreeViews.IndexOf(LVAddrBook);
  5058. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5059. miUpdateGroup.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5060. miDelGroup.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5061. miImportGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5062. miDelGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5063. miUpdateGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5064. miCut.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil) or (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5065. miPaste.Enabled := (FCutNode <> nil);
  5066. miSetRemark.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5067. end;
  5068. procedure TMainForm.ppChangeCustomerStateGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5069. begin
  5070. ChangePPMenuColorMap(ppChangeCustomerState.PopupMenu);
  5071. end;
  5072. procedure TMainForm.ppChangeStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5073. begin
  5074. ChangePPMenuColorMap(ppChangeStates.PopupMenu);
  5075. end;
  5076. //------------------------------------------------------------------------------
  5077. procedure TMainForm.ppChangeStatesPopup(Sender: TObject);
  5078. begin
  5079. end;
  5080. //------------------------------------------------------------------------------
  5081. procedure TMainForm.ppColorsGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5082. begin
  5083. ChangePPMenuColorMap(ppColors.PopupMenu);
  5084. end;
  5085. //------------------------------------------------------------------------------
  5086. procedure TMainForm.ppColorsPopup(Sender: TObject);
  5087. var
  5088. iLoop: Integer;
  5089. ColorStr: string;
  5090. MenuItem: TMenuItem;
  5091. Bitmap: TBitmap;
  5092. procedure FindSkins(APath: string);
  5093. var
  5094. DSearchRec: TSearchRec;
  5095. FindResult: Integer;
  5096. begin
  5097. FindResult := FindFirst(APath + '*.*', faDirectory, DSearchRec);
  5098. while FindResult = 0 do
  5099. begin
  5100. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  5101. if (DSearchRec.Attr and faDirectory) = faDirectory then
  5102. begin
  5103. MenuItem := TMenuItem.Create(miSkins);
  5104. MenuItem.Caption := DSearchRec.Name;
  5105. MenuItem.OnClick := miSkinClick;
  5106. MenuItem.Enabled := SkinName <> DSearchRec.Name;
  5107. MenuItem.Checked := SkinName = DSearchRec.Name;
  5108. miSkins.Insert(0, MenuItem);
  5109. end;
  5110. FindResult := FindNext(DSearchRec);
  5111. end;
  5112. end;
  5113. begin
  5114. ImgLstColors.Clear;
  5115. while ppColors.Items.Count > 4 do
  5116. ppColors.Items.Delete(0);
  5117. Bitmap := TBitmap.Create;
  5118. Bitmap.SetSize(16, 16);
  5119. try
  5120. for iLoop := ColorDialog.CustomColors.Count - 1 downto 0 do
  5121. begin
  5122. ColorStr := Copy(ColorDialog.CustomColors[iLoop], 8, 6);
  5123. if ColorStr = 'FFFFFF' then
  5124. continue;
  5125. ColorStr := '$00' + ColorStr;
  5126. Bitmap.Canvas.Pen.Color := clGray;
  5127. Bitmap.Canvas.Pen.Style := psSolid;
  5128. Bitmap.Canvas.Brush.Color := StrToInt(ColorStr);
  5129. Bitmap.Canvas.Brush.Style := bsSolid;
  5130. Bitmap.Canvas.Rectangle(0, 0, Width, Height);
  5131. ImgLstColors.Add(Bitmap, nil);
  5132. MenuItem := TMenuItem.Create(ppColors);
  5133. MenuItem.Caption := '颜色' + IntToStr(iLoop);
  5134. MenuItem.Tag := StrToInt(ColorStr);
  5135. MenuItem.ImageIndex := ImgLstColors.Count - 1;
  5136. MenuItem.OnClick := miColorClick;
  5137. MenuItem.Enabled := MenuItem.Tag <> UIMainColor;
  5138. MenuItem.Checked := MenuItem.Tag = UIMainColor;
  5139. if MenuItem.Checked then
  5140. MenuItem.ImageIndex := -1;
  5141. ppColors.Items.Insert(0, MenuItem);
  5142. end;
  5143. finally
  5144. Bitmap.Free;
  5145. end;
  5146. miSkins.Clear;
  5147. //FindSkins(ExtractFilePath(Application.ExeName) + 'Skins\');
  5148. FindSkins(ExtractFilePath(Application.ExeName) + SkinPath);
  5149. end;
  5150. //------------------------------------------------------------------------------
  5151. procedure TMainForm.ChangePPMenuColorMap(PopupMenuEx: TCustomActionPopupMenuEx);
  5152. begin
  5153. HideUserCardForm;
  5154. PopupMenuEx.ColorMap.Color := FormColor;
  5155. PopupMenuEx.ColorMap.SelectedColor := ConvertColorToColor(PopupMenuEx.ColorMap.SelectedColor, UIMainColor);
  5156. PopupMenuEx.ColorMap.BtnFrameColor := ConvertColorToColor(PopupMenuEx.ColorMap.BtnFrameColor, UIMainColor);
  5157. PopupMenuEx.Font.Name := '宋体';
  5158. PopupMenuEx.Font.Size := 9;
  5159. end;
  5160. //------------------------------------------------------------------------------
  5161. procedure TMainForm.ppContacterViewStyleGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5162. begin
  5163. ChangePPMenuColorMap(ppContacterViewStyle.PopupMenu);
  5164. end;
  5165. //------------------------------------------------------------------------------
  5166. procedure TMainForm.ppLoginedUsersGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5167. begin
  5168. ChangePPMenuColorMap(ppLoginedUsers.PopupMenu);
  5169. end;
  5170. //------------------------------------------------------------------------------
  5171. procedure TMainForm.ppLoginedUsersPopup(Sender: TObject);
  5172. var
  5173. iLoop: Integer;
  5174. MenuItem: TMenuItem;
  5175. begin
  5176. while ppLoginedUsers.Items.Count > 2 do
  5177. ppLoginedUsers.Items.Delete(0);
  5178. for iLoop := 0 to RealICQClient.LoginedUsers.Count - 1 do
  5179. begin
  5180. if iLoop >= 20 then
  5181. Break;
  5182. MenuItem := TMenuItem.Create(ppLoginedUsers);
  5183. MenuItem.AutoHotkeys := maManual;
  5184. MenuItem.AutoLineReduction := maManual;
  5185. MenuItem.Caption := RealICQClient.LoginedUsers[iLoop];
  5186. MenuItem.OnClick := miChangeLoginNameClick;
  5187. MenuItem.Tag := iLoop;
  5188. ppLoginedUsers.Items.Insert(0, MenuItem);
  5189. end;
  5190. end;
  5191. procedure TMainForm.ppLoginStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5192. begin
  5193. ChangePPMenuColorMap(ppLoginStates.PopupMenu);
  5194. end;
  5195. procedure TMainForm.ppMainMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5196. begin
  5197. ChangePPMenuColorMap(ppMainMenu.PopupMenu);
  5198. end;
  5199. //------------------------------------------------------------------------------
  5200. procedure TMainForm.ppNetWorkFileGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5201. begin
  5202. ChangePPMenuColorMap(ppNetWorkFile.PopupMenu);
  5203. end;
  5204. //------------------------------------------------------------------------------
  5205. procedure TMainForm.ppNetWorkFilePopup(Sender: TObject);
  5206. begin
  5207. NDSelectItemChanged(nil);
  5208. miNDNewDir.Enabled := spbNDNewDir.Enabled;
  5209. miNDDelete.Enabled := spbNDDelete.Enabled;
  5210. miNDDownload.Enabled := spbNDDownload.Enabled;
  5211. miNDRename.Enabled := (FLVNetWorkDisk.SelCount = 1) and (not pnlNDMissions.Visible);
  5212. end;
  5213. //------------------------------------------------------------------------------
  5214. procedure TMainForm.ppNetWorkMissonGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5215. begin
  5216. ChangePPMenuColorMap(ppNetWorkMisson.PopupMenu);
  5217. end;
  5218. //------------------------------------------------------------------------------
  5219. procedure TMainForm.ppNetWorkMissonPopup(Sender: TObject);
  5220. begin
  5221. if PageControlNDMission.ActivePageIndex = 0 then
  5222. miNDCancel.Enabled := FLVNetWorkDiskUploadingFiles.SelCount > 0
  5223. else
  5224. miNDCancel.Enabled := FLVNetWorkDiskDownloadingFiles.SelCount > 0;
  5225. end;
  5226. procedure TMainForm.ppSelCallTelGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5227. begin
  5228. ChangePPMenuColorMap(ppSelCallTel.PopupMenu);
  5229. end;
  5230. procedure TMainForm.ppServerListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5231. begin
  5232. ChangePPMenuColorMap(ppServerList.PopupMenu);
  5233. end;
  5234. procedure TMainForm.MeasureItem(Sender: TObject; ACanvas: TCanvas; var Width, Height: Integer);
  5235. begin
  5236. //在OnMeasureItem事件中改变菜单的宽度和高度
  5237. //改变菜单的宽度和高度以容纳文本
  5238. Width := edServerList.Width;
  5239. end;
  5240. procedure TMainForm.miChangeServerClick(Sender: TObject);
  5241. var
  5242. ServerInfo: TServerInfo;
  5243. ItemIndex: Integer;
  5244. RealICQContacterTreeView: TRealICQContacterTreeView;
  5245. begin
  5246. try
  5247. SetGetMoreUserEvent;
  5248. if Sender = nil then
  5249. begin
  5250. //RealICQClient.SendGetMoreBranch(FCurrentServerID);
  5251. RealICQClient.SendGetBranchs(FCurrentServerID, 0);
  5252. end
  5253. else
  5254. begin
  5255. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf((Sender as TMenuItem).Hint)] as TServerInfo;
  5256. if ServerInfo.ServerName = edServerList.Text then
  5257. Exit;
  5258. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  5259. if ItemIndex >= 0 then
  5260. begin
  5261. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5262. try
  5263. RealICQContacterTreeView.Clear;
  5264. FreeAndNil(RealICQContacterTreeView);
  5265. FContacterTreeViews.Delete(ItemIndex);
  5266. except
  5267. //Exit;
  5268. end;
  5269. end;
  5270. ImgLoadingMoreBranchs.Visible := True;
  5271. ScrollBoxMoreUser.Visible := False;
  5272. edServerList.Text := ServerInfo.ServerName;
  5273. //RealICQClient.SendGetMoreBranch(ServerInfo.ServerId);
  5274. RealICQClient.SendGetBranchs(ServerInfo.ServerId, 0);
  5275. FCurrentServerID := ServerInfo.ServerId;
  5276. end;
  5277. except
  5278. edServerList.Text := '';
  5279. end;
  5280. end;
  5281. //------------------------------------------------------------------------------
  5282. procedure TMainForm.ppTeamListViewGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5283. begin
  5284. ChangePPMenuColorMap(ppTeamListView.PopupMenu);
  5285. end;
  5286. //------------------------------------------------------------------------------
  5287. procedure TMainForm.ppTeamListViewPopup(Sender: TObject);
  5288. var
  5289. iLoop: Integer;
  5290. RealICQTeam: TRealICQTeam;
  5291. ListItem: TRealICQContacterListItem;
  5292. begin
  5293. actSendTeamMessage.Visible := FLVTeams.SelCount = 1;
  5294. actSeeTeamInformation.Visible := FLVTeams.SelCount = 1;
  5295. actShowTeamHistory.Visible := FLVTeams.SelCount = 1;
  5296. actQuitTeam.Visible := FLVTeams.SelCount = 1;
  5297. actDisbandTeam.Visible := FLVTeams.SelCount = 1;
  5298. actQuitOrDisbandTeams.Visible := FLVTeams.SelCount > 1;
  5299. self.miSendTeamSMS.Visible := FLVTeams.SelCount = 1;
  5300. if FLVTeams.SelCount = 1 then
  5301. begin
  5302. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  5303. begin
  5304. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  5305. if ListItem.Selected then
  5306. begin
  5307. RealICQTeam := ListItem.Data;
  5308. actDisbandTeam.Visible := AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName);
  5309. actQuitTeam.Visible := not actDisbandTeam.Visible;
  5310. if actDisbandTeam.Visible then
  5311. actSeeTeamInformation.Caption := '修改群组详细资料(&D)...'
  5312. else
  5313. actSeeTeamInformation.Caption := '查看群组详细资料(&D)...';
  5314. Break;
  5315. end;
  5316. end;
  5317. end;
  5318. end;
  5319. //------------------------------------------------------------------------------
  5320. procedure TMainForm.ppTrayIconGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5321. begin
  5322. ChangePPMenuColorMap(ppTrayIcon.PopupMenu);
  5323. end;
  5324. //------------------------------------------------------------------------------
  5325. procedure TMainForm.ppUserItemRightMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5326. begin
  5327. ChangePPMenuColorMap(ppUserItemRightMenu.PopupMenu);
  5328. end;
  5329. //------------------
  5330. function TMainForm.GetActiveTabSheetName: string;
  5331. //var ImageButton:TRealICQHoverImage;
  5332. begin
  5333. if ActiveButtonTag < 1 then
  5334. ActiveButtonTag := 1;
  5335. // ImageButton:=FToolBarButtonIconList.Objects[ActiveButtonTag-1] as TRealICQHoverImage;
  5336. Result := FToolBarButtonIconList[ActiveButtonTag - 1];
  5337. end;
  5338. //------------------------------------------------------------------------------
  5339. procedure TMainForm.ppUserItemRightMenuPopup(Sender: TObject);
  5340. var
  5341. iLoop, ItemIndex: Integer;
  5342. GroupName, TabSheetName: string;
  5343. Friend: TRealICQEmployee;
  5344. MenuItem: TMenuItem;
  5345. RealICQContacterTreeView: TRealICQContacterTreeView;
  5346. RealICQFriendTreeView: TRealICQContacterTreeView;
  5347. procedure SetMenuItemVisible;
  5348. begin
  5349. actSendMessage.Visible := actSendMessage.Enabled;
  5350. actSeeInformation.Visible := actSeeInformation.Enabled;
  5351. actShowHistory.Visible := actShowHistory.Enabled;
  5352. actChangeRemark.Visible := actChangeRemark.Enabled;
  5353. actDelFriend.Visible := actDelFriend.Enabled;
  5354. actRemoveUser.Visible := actRemoveUser.Enabled;
  5355. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5356. miGroup.Visible := miGroup.Enabled;
  5357. end;
  5358. begin
  5359. miGoSpace.Visible := ShowSNS;
  5360. RealICQContacterTreeView := nil;
  5361. RealICQFriendTreeView := nil;
  5362. TabSheetName := GetActiveTabSheetName;
  5363. //如果是在“最近联系人”中弹出右键菜单
  5364. if TabSheetName = LVLatests then
  5365. begin
  5366. actSendMessage.Enabled := FLVLatests.SelCount = 1;
  5367. actSeeInformation.Enabled := FLVLatests.SelCount = 1;
  5368. actShowHistory.Enabled := FLVLatests.SelCount = 1;
  5369. actChangeRemark.Enabled := False;
  5370. actDelFriend.Enabled := False;
  5371. actRemoveUser.Enabled := False;
  5372. miGroup.Enabled := False;
  5373. miManageGroup.Enabled := False;
  5374. miManageGroup.Visible := False;
  5375. menuItemShowGroup.Visible := False;
  5376. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5377. SetMenuItemVisible;
  5378. Exit;
  5379. end;
  5380. actSendMessage.Enabled := False;
  5381. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5382. actSeeInformation.Enabled := False;
  5383. ;
  5384. actShowHistory.Enabled := False;
  5385. actChangeRemark.Enabled := False;
  5386. actRemoveUser.Enabled := False;
  5387. actDelFriend.Enabled := False;
  5388. miGroup.Enabled := False;
  5389. miManageGroup.Enabled := False;
  5390. miManageGroup.Visible := False;
  5391. menuItemShowGroup.Visible := False;
  5392. if TabSheetName = LVMyContacters then
  5393. begin
  5394. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  5395. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5396. if (RealICQContacterTreeView.GetSelectedEmployee <> nil) then
  5397. begin
  5398. actSendMessage.Enabled := True;
  5399. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5400. actSeeInformation.Enabled := True;
  5401. actShowHistory.Enabled := True;
  5402. actChangeRemark.Enabled := True;
  5403. miGroup.Enabled := False;
  5404. actRemoveUser.Enabled := False;
  5405. actDelFriend.Enabled := False;
  5406. end;
  5407. SetMenuItemVisible;
  5408. Exit;
  5409. end;
  5410. if TabSheetName = LVMoreUsers then
  5411. begin
  5412. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  5413. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5414. if (RealICQContacterTreeView.GetSelectedEmployee <> nil) then
  5415. begin
  5416. actSendMessage.Enabled := True;
  5417. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5418. actSeeInformation.Enabled := True;
  5419. actShowHistory.Enabled := True;
  5420. actChangeRemark.Enabled := True;
  5421. miGroup.Enabled := False;
  5422. actRemoveUser.Enabled := False;
  5423. actDelFriend.Enabled := False;
  5424. end;
  5425. SetMenuItemVisible;
  5426. Exit;
  5427. end;
  5428. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  5429. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5430. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  5431. miManageGroup.Enabled := True;
  5432. miManageGroup.Visible := True;
  5433. menuItemShowGroup.Visible := True;
  5434. if Friend <> nil then
  5435. begin
  5436. GroupName := Friend.BranchID;
  5437. if GroupName = LvFriends then
  5438. actDelFriend.Enabled := True;
  5439. actSendMessage.Enabled := True;
  5440. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5441. actSeeInformation.Enabled := True;
  5442. actShowHistory.Enabled := True;
  5443. actChangeRemark.Enabled := True;
  5444. miGroup.Enabled := True and (not FSearchListViewInVisible);
  5445. actRemoveUser.Enabled := True;
  5446. SetMenuItemVisible;
  5447. end
  5448. else
  5449. begin
  5450. SetMenuItemVisible;
  5451. Exit;
  5452. end;
  5453. if AnsiSameStr(GroupName, LVFriends) then
  5454. begin
  5455. miGroup.Caption := '移动至组(&M)...';
  5456. actRemoveUser.Enabled := False;
  5457. end
  5458. else
  5459. begin
  5460. //在自定义组的用户列表控件上弹出右键菜单
  5461. actSendMessage.Enabled := True;
  5462. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5463. actSeeInformation.Enabled := True;
  5464. actShowHistory.Enabled := True;
  5465. actChangeRemark.Enabled := True;
  5466. miGroup.Enabled := True and (not FSearchListViewInVisible);
  5467. miGroup.Caption := '移动至组(&M)...';
  5468. end;
  5469. miGroup.Clear;
  5470. if FShowGroup then
  5471. begin
  5472. for iLoop := 0 to FGroups.Count - 1 do
  5473. begin
  5474. if GroupName = FGroups[iLoop] then
  5475. continue;
  5476. MenuItem := TMenuItem.Create(miGroup);
  5477. MenuItem.Caption := FGroups[iLoop];
  5478. MenuItem.OnClick := miMoveGroupClick;
  5479. MenuItem.Enabled := miGroup.Enabled;
  5480. miGroup.Add(MenuItem);
  5481. end;
  5482. MenuItem := TMenuItem.Create(miGroup);
  5483. MenuItem.Caption := '-';
  5484. miGroup.Add(MenuItem);
  5485. end;
  5486. miGroup.Enabled := miGroup.Count > 0;
  5487. end;
  5488. //------------------------------------------------------------------------------
  5489. procedure TMainForm.WMQueryEndSession(var message: TWMQUERYENDSESSION);
  5490. begin
  5491. try
  5492. try
  5493. //Dialogs.ShowMessage('关机');
  5494. FreeAndNil(NotReadMessageBoxForm);
  5495. Application.Terminate;
  5496. if RealICQClient.Logined then
  5497. RealICQClient.Logout;
  5498. except
  5499. end;
  5500. finally
  5501. message.Result := 1; //允许
  5502. end;
  5503. end;
  5504. //------------------------------------------------------------------------------
  5505. procedure TMainForm.WMPowerBroadcast(var message: TMessage);
  5506. begin
  5507. try
  5508. try
  5509. if message.wparam = 4 then //..休眠
  5510. begin
  5511. if RealICQClient.Logined then
  5512. RealICQClient.Logout;
  5513. end;
  5514. if message.wparam = 18 then // 休眠重起
  5515. begin
  5516. if RealICQClient.SavedPassword then
  5517. RealICQClient.LoginAsSaved;
  5518. end;
  5519. except
  5520. end;
  5521. finally
  5522. message.Result := 1; //允许
  5523. end;
  5524. end;
  5525. //------------------------------------------------------------------------------
  5526. procedure TMainForm.CMWininichange(var Message: TWMWinIniChange);
  5527. begin
  5528. ChangeUIColor(FUIMainColor);
  5529. DisableAlign;
  5530. try
  5531. PostMessage(Handle, WM_SIZE, 0, 0);
  5532. finally
  5533. EnableAlign;
  5534. end;
  5535. end;
  5536. //------------------------------------------------------------------------------
  5537. procedure TMainForm.SetSearchListViewVisible(AShow: Boolean);
  5538. begin
  5539. FSearchListViewInVisible := AShow;
  5540. if AShow then
  5541. begin
  5542. pnlSearch.Left := shpFilterBorder.Left + 9;
  5543. pnlSearch.Top := shpFilterBorder.Top + shpFilterBorder.Height + 28;
  5544. pnlSearch.Width := shpFilterBorder.Width;
  5545. pnlSearch.Visible := True;
  5546. end
  5547. else
  5548. begin
  5549. pnlSearch.Visible := False;
  5550. end;
  5551. end;
  5552. //------------------------------------------------------------------------------
  5553. procedure TMainForm.edFilterKeywordChange(Sender: TObject);
  5554. var
  5555. iLoop: Integer;
  5556. RealICQUser: TRealICQUser;
  5557. KeyWord, UserCaption: string;
  5558. ItemIndex: Integer;
  5559. ListItem: TRealICQContacterListItem;
  5560. AUsers: TStringList;
  5561. begin
  5562. KeyWord := Trim(edFilterKeyword.Text);
  5563. if (KeyWord = '查找联系人...') or (KeyWord = '') then
  5564. begin
  5565. if FSearchListViewInVisible then
  5566. SetSearchListViewVisible(False);
  5567. end
  5568. else
  5569. begin
  5570. if not FSearchListViewInVisible then
  5571. SetSearchListViewVisible(True);
  5572. if AnsiSameText(KeyWord, FLastSearchKeyWord) then
  5573. Exit;
  5574. //删除当前结果中不符合新的查询条件的记录
  5575. FLastSearchKeyWord := KeyWord;
  5576. for iLoop := FSearchListView.Items.Count - 1 downto 0 do
  5577. begin
  5578. if not AnsiSameText(Trim(edFilterKeyword.Text), KeyWord) then
  5579. Exit;
  5580. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  5581. RealICQUser := ListItem.Data;
  5582. UserCaption := RealICQUser.DisplayName + '' + RealICQUser.LoginName + '' + RealICQUser.Watchword;
  5583. 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
  5584. FSearchListView.Items.Delete(iLoop);
  5585. Application.ProcessMessages;
  5586. end;
  5587. FSearchListView.FlashCaptionOnOnline := False;
  5588. //在好友列表中查找
  5589. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  5590. try
  5591. for iLoop := 0 to AUsers.Count - 1 do
  5592. begin
  5593. if not AnsiSameText(FLastSearchKeyWord, KeyWord) then
  5594. begin
  5595. Exit;
  5596. end;
  5597. RealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  5598. if (RealICQUser = RealICQClient.Me) then
  5599. continue;
  5600. UserCaption := RealICQUser.DisplayName + ' ' + RealICQUser.LoginName + ' ' + RealICQUser.Watchword;
  5601. 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
  5602. begin
  5603. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  5604. if ItemIndex = -1 then
  5605. begin
  5606. ItemIndex := FSearchListView.Items.Add(RealICQUser.LoginName);
  5607. ListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  5608. BindUserDataToItem(ListItem, RealICQUser);
  5609. Application.ProcessMessages;
  5610. end;
  5611. end;
  5612. end;
  5613. finally
  5614. FreeAndNil(AUsers);
  5615. end;
  5616. FSearchListView.FlashCaptionOnOnline := FFlashCaptionOnOnline;
  5617. if FSearchListView.Items.Count <= 0 then
  5618. begin
  5619. ScrollBoxSearchUser.Visible := False;
  5620. lblSearchResult.Caption := #10 + #13 + ' 无搜索结果';
  5621. lblSearchResult.Visible := True;
  5622. end
  5623. else
  5624. begin
  5625. ScrollBoxSearchUser.Visible := True;
  5626. lblSearchResult.Visible := False;
  5627. end;
  5628. end;
  5629. end;
  5630. procedure TMainForm.edFilterKeywordClick(Sender: TObject);
  5631. var
  5632. KeyWord: string;
  5633. begin
  5634. KeyWord := Trim(edFilterKeyword.Text);
  5635. if KeyWord = '查找联系人...' then
  5636. edFilterKeyword.Text := '';
  5637. edFilterKeyword.Font.Color := clWindowText;
  5638. end;
  5639. //------------------------------------------------------------------------------
  5640. procedure TMainForm.edFilterKeywordExit(Sender: TObject);
  5641. var
  5642. KeyWord: string;
  5643. begin
  5644. KeyWord := Trim(edFilterKeyword.Text);
  5645. if KeyWord = '' then
  5646. edFilterKeyword.Text := '查找联系人...';
  5647. edFilterKeyword.Font.Color := clGray;
  5648. end;
  5649. //------------------------------------------------------------------------------
  5650. procedure TMainForm.SetLoginStateControlState;
  5651. const
  5652. CA_TEXT: string = '您选择了使用CA登录';
  5653. begin
  5654. if (FLoginState = stLeave) or (FLoginState = stBusy) then
  5655. spbLoginState.Caption := FLeaveMessage
  5656. else
  5657. spbLoginState.Caption := StateValues[Integer(FLoginState)];
  5658. RealICQClient.LoginState := FLoginState;
  5659. RealICQClient.LeaveMessage := FLeaveMessage;
  5660. if FSavePassword then
  5661. ImgLstCheckStates.GetIcon(1, spbSavePassword.Icon)
  5662. else
  5663. ImgLstCheckStates.GetIcon(0, spbSavePassword.Icon);
  5664. if RealICQClient.CALogin then
  5665. begin
  5666. ImgLstCheckStates.GetIcon(1, btnCaLogin.Icon);
  5667. edLoginName.Text := CA_TEXT;
  5668. edLoginName.Enabled := False;
  5669. edPassword.Enabled := False;
  5670. spbChangeLoginName.Enabled := False;
  5671. end
  5672. else
  5673. begin
  5674. ImgLstCheckStates.GetIcon(0, btnCaLogin.Icon);
  5675. if SameText(CA_TEXT, edLoginName.Text) then
  5676. edLoginName.Text := '';
  5677. edLoginName.Enabled := True;
  5678. edPassword.Enabled := True;
  5679. spbChangeLoginName.Enabled := True;
  5680. end;
  5681. FAutoLogin := FAutoLogin and FSavePassword;
  5682. spbAutoLogin.Enabled := FSavePassword;
  5683. if FAutoLogin then
  5684. ImgLstCheckStates.GetIcon(1, spbAutoLogin.Icon)
  5685. else
  5686. ImgLstCheckStates.GetIcon(0, spbAutoLogin.Icon);
  5687. end;
  5688. //------------------------------------------------------------------------------
  5689. procedure TMainForm.edLoginNameChange(Sender: TObject);
  5690. begin
  5691. if AnsiSameText(edLoginName.Text, RealICQClient.LoginName) and RealICQClient.SavedPassword then
  5692. begin
  5693. edPassword.Text := '保存的密码';
  5694. lblPasswordTitle.Enabled := False;
  5695. edPassword.Enabled := False;
  5696. spbSavePassword.Enabled := False;
  5697. FLoginAsSavePassword := True;
  5698. FLoginState := RealICQClient.LoginState;
  5699. FLeaveMessage := RealICQClient.LeaveMessage;
  5700. FSavePassword := RealICQClient.SavedPassword;
  5701. FAutoLogin := RealICQClient.AutoLogin;
  5702. SetLoginStateControlState;
  5703. end
  5704. else if FLoginAsSavePassword then
  5705. begin
  5706. edPassword.Text := '';
  5707. edPassword.Enabled := True;
  5708. lblPasswordTitle.Enabled := True;
  5709. spbSavePassword.Enabled := True;
  5710. FLoginAsSavePassword := False;
  5711. FLoginState := stOnline;
  5712. FLeaveMessage := '';
  5713. FSavePassword := False;
  5714. FAutoLogin := False;
  5715. SetLoginStateControlState;
  5716. end;
  5717. end;
  5718. //------------------------------------------------------------------------------
  5719. procedure TMainForm.edPasswordEnter(Sender: TObject);
  5720. begin
  5721. if not RealICQClient.CALogin then
  5722. begin
  5723. Self.FSavePassword := True;
  5724. // FAutoLogin := True;
  5725. RealICQClient.AutoLogin := FAutoLogin;
  5726. SetLoginStateControlState;
  5727. end;
  5728. end;
  5729. //------全市查找-----------------------------
  5730. procedure TMainForm.edtSearchMoreUserChange(Sender: TObject);
  5731. var
  5732. KeyWord: string;
  5733. iIndex, iLoop: Integer;
  5734. //FSearchMoreUserListView:TRealICQContacterListView;
  5735. begin
  5736. KeyWord := Trim((Sender as TEdit).Text);
  5737. iIndex := FContacterListViews.IndexOf(LVMoreUsers);
  5738. FSearchMoreUserListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  5739. FSearchMoreUserListView.Items.Clear;
  5740. if (KeyWord = '查找联系人...') or (KeyWord = '') then
  5741. begin
  5742. pnlSearchMoreUser.Visible := False;
  5743. Exit;
  5744. end
  5745. else
  5746. begin
  5747. RealICQClient.OnSearchUserResult := RealICQClientSearchUserResult;
  5748. RealICQClient.SendSearchMoreUser(KeyWord, FCurrentServerID);
  5749. pnlSearchMoreUser.Left := shpSearchMoreUser.Left;
  5750. pnlSearchMoreUser.Width := pnlSelectServer.Width - 22;
  5751. pnlSearchMoreUser.Top := shpSearchMoreUser.Top + shpSearchMoreUser.Height;
  5752. LblSearchHint.Caption := #10 + #10 + #10 + #10 + #10'正在查询,请稍侯。';
  5753. LblSearchHint.Visible := True;
  5754. ScrollBoxSearchMoreUser.Visible := False;
  5755. ImgLogining.Visible := True;
  5756. pnlSearchMoreUser.Visible := True;
  5757. pnlSearchMoreUser.BringToFront;
  5758. end;
  5759. end;
  5760. //--------------------------------------------------------
  5761. procedure TMainForm.edtSearchMoreUserClick(Sender: TObject);
  5762. var
  5763. KeyWord: string;
  5764. begin
  5765. KeyWord := Trim(edtSearchMoreUser.Text);
  5766. if KeyWord = '查找联系人...' then
  5767. edtSearchMoreUser.Text := '';
  5768. edtSearchMoreUser.Font.Color := clWindowText;
  5769. end;
  5770. procedure TMainForm.edtSearchMoreUserExit(Sender: TObject);
  5771. var
  5772. KeyWord: string;
  5773. begin
  5774. KeyWord := Trim(edtSearchMoreUser.Text);
  5775. if KeyWord = '' then
  5776. edtSearchMoreUser.Text := '查找联系人...';
  5777. edtSearchMoreUser.Font.Color := clGray;
  5778. end;
  5779. //------------------------------------------------------------------------------
  5780. procedure TMainForm.edWatchwordExit(Sender: TObject);
  5781. var
  5782. AWatchword: WideString;
  5783. begin
  5784. spbWatchword.Visible := True;
  5785. shpWatchwordBorder.Visible := False;
  5786. edWatchword.Visible := False;
  5787. if RealICQClient.Logined then
  5788. begin
  5789. if (not AnsiSameStr(Trim(edWatchword.Text), RealICQClient.Me.Watchword)) and (not AnsiSameStr(Trim(edWatchword.Text), '在此键入您的个性签名')) then
  5790. begin
  5791. AWatchword := Trim(edWatchword.Text);
  5792. spbWatchword.Hint := AWatchword;
  5793. spbWatchword.ShowHint := False;
  5794. //字符串长度过长时,截短字符串并在后面显示“...”
  5795. while spbWatchword.Canvas.TextWidth(AWatchword) > pnlTop.Width - 86 do
  5796. begin
  5797. if Length(AWatchword) > 3 then
  5798. begin
  5799. if Copy(AWatchword, Length(AWatchword) - 2, Length(AWatchword)) = '...' then
  5800. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 3);
  5801. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 1) + '...';
  5802. end
  5803. else
  5804. break;
  5805. spbWatchword.ShowHint := True;
  5806. end;
  5807. spbWatchword.Caption := edWatchword.Text;
  5808. RealICQClient.ChangeBaseInformation(RealICQClient.Me.DisplayName, Trim(edWatchword.Text));
  5809. end;
  5810. end;
  5811. end;
  5812. //------------------------------------------------------------------------------
  5813. procedure TMainForm.edWatchwordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  5814. begin
  5815. if Key = 13 then
  5816. edWatchwordExit(edWatchword);
  5817. end;
  5818. //------------------------------------------------------------------------------
  5819. procedure TMainForm.edWebSearchKeyWordEnter(Sender: TObject);
  5820. begin
  5821. //
  5822. end;
  5823. //------------------------------------------------------------------------------
  5824. procedure TMainForm.edWebSearchKeyWordExit(Sender: TObject);
  5825. begin
  5826. end;
  5827. //------------------------------------------------------------------------------
  5828. procedure TMainForm.edWebSearchKeyWordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  5829. begin
  5830. if Key = 13 then
  5831. spbWebSearchClick(nil);
  5832. end;
  5833. //------------------------------------------------------------------------------
  5834. procedure TMainForm.spbWatchwordClick(Sender: TObject);
  5835. begin
  5836. if not RealICQClient.Logined then
  5837. Exit;
  5838. spbWatchword.Visible := False;
  5839. shpWatchwordBorder.Left := spbWatchword.Left;
  5840. shpWatchwordBorder.Top := spbWatchword.Top;
  5841. shpWatchwordBorder.Width := pnlTop.Width - 66;
  5842. shpWatchwordBorder.Height := spbWatchword.Height;
  5843. edWatchword.Left := shpWatchwordBorder.Left + 2;
  5844. edWatchword.Top := shpWatchwordBorder.Top + (shpWatchwordBorder.Height - edWatchword.Height) div 2 + 1;
  5845. edWatchword.Width := shpWatchwordBorder.Width - 6;
  5846. edWatchword.Text := RealICQClient.Me.Watchword;
  5847. shpWatchwordBorder.Visible := True;
  5848. edWatchword.Visible := True;
  5849. edWatchword.SetFocus;
  5850. edWatchword.SelStart := 0;
  5851. edWatchword.SelLength := Length(edWatchword.Text);
  5852. shpWatchwordBorder.BringToFront;
  5853. edWatchword.BringToFront;
  5854. end;
  5855. //------------------------------------------------------------------------------
  5856. procedure TMainForm.spbWebSearchClick(Sender: TObject);
  5857. begin
  5858. //
  5859. end;
  5860. //------------------------------------------------------------------------------
  5861. procedure TMainForm.spbWinMeetClick(Sender: TObject);
  5862. var
  5863. WinMeetPath, Parameter: string;
  5864. Branch: TRealICQBranch;
  5865. ItemIndex: Integer;
  5866. RealICQContacterTreeView: TRealICQContacterTreeView;
  5867. begin
  5868. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  5869. if (ItemIndex < 0) then
  5870. Exit;
  5871. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5872. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(MainForm.RealICQClient.Me.BranchID);
  5873. if (ItemIndex < 0) then
  5874. Exit;
  5875. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  5876. while Branch.Node.Parent <> nil do
  5877. begin
  5878. Branch := TRealICQBranch(Branch.Node.Parent.Data);
  5879. end;
  5880. WinMeetPath := GetFilePahtFromRegedit('\Software\WinSoft\WinMeet', 'AppPath');
  5881. if Trim(WinMeetPath) = '' then
  5882. begin
  5883. ShowMessage('您还没有安装视频会议客户端!');
  5884. Exit;
  5885. end;
  5886. Parameter := ' ' + MainForm.RealICQClient.LoginName + ' ' + MD5En(RealICQClient.Password) + ' ' + Branch.BranchID;
  5887. ShellExecute(handle, 'open', PChar(WinMeetPath), PChar(Parameter), '', SW_SHOWNORMAL);
  5888. end;
  5889. //------------------------------------------------------------------------------
  5890. procedure TMainForm.CreateParams(var Params: TCreateParams);
  5891. begin
  5892. inherited;
  5893. with Params do
  5894. begin
  5895. Params.WndParent := 0;
  5896. end;
  5897. end;
  5898. //------------------------------------------------------------------------------
  5899. procedure TMainForm.WndProc(var Message: TMessage);
  5900. begin
  5901. inherited wndproc(message);
  5902. if message.msg = WM_DEVICECHANGE then
  5903. RealICQClient.CheckAVDevice;
  5904. if message.msg = CLOSEWINDOWS then
  5905. QuitWindows;
  5906. {if (message.msg = WM_PAINT) or (message.msg = WM_NCPAINT) then
  5907. begin
  5908. ActionMainMenuBar.Refresh;
  5909. end;}
  5910. end;
  5911. procedure TMainForm.spbAddToNAClick(Sender: TObject);
  5912. var
  5913. TabSheet: TTabSheet;
  5914. WebBrowser: TWebBrowser;
  5915. begin
  5916. MainForm.FormStyle := fsNormal;
  5917. try
  5918. try
  5919. TabSheet := pgcMultiWeb.ActivePage;
  5920. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  5921. AddToFavorite(WebBrowser);
  5922. except
  5923. end;
  5924. finally
  5925. // if MainForm.AlwaysOnTop then
  5926. // MainForm.FormStyle := fsStayOnTop
  5927. // else
  5928. // MainForm.FormStyle := fsNormal;
  5929. end;
  5930. end;
  5931. //------------------------------------------------------------------------------
  5932. procedure TMainForm.spbWebCloseClick(Sender: TObject);
  5933. var
  5934. TabSheet: TTabSheet;
  5935. WebBrowser: TWebBrowser;
  5936. begin
  5937. TabSheet := pgcMultiWeb.ActivePage;
  5938. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  5939. if pgcMultiWeb.PageCount > 1 then
  5940. begin
  5941. try
  5942. if WebBrowser.Busy then
  5943. WebBrowser.Stop;
  5944. except
  5945. end;
  5946. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  5947. TabSheet.PageControl := nil;
  5948. FreeAndNil(TabSheet);
  5949. end
  5950. else
  5951. begin
  5952. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  5953. WebBrowser.Navigate('about:blank');
  5954. end;
  5955. end;
  5956. procedure TMainForm.spbAutoLoginClick(Sender: TObject);
  5957. begin
  5958. FAutoLogin := not FAutoLogin;
  5959. RealICQClient.AutoLogin := FAutoLogin;
  5960. SetLoginStateControlState;
  5961. end;
  5962. //------------------------------------------------------------------------------
  5963. procedure TMainForm.HideMainForm;
  5964. var
  5965. BaseTop, BaseLeft: Integer;
  5966. begin
  5967. if FMovingMainForm then
  5968. Exit;
  5969. if RealICQClient.Logining then
  5970. begin
  5971. FDblClickedTrayIcon := True;
  5972. TimerForShowMainForm.Enabled := False;
  5973. TimerForShowMainForm.Enabled := True;
  5974. Exit;
  5975. end;
  5976. BaseTop := (Height - ClientHeight) div 2;
  5977. BaseLeft := (Width - ClientWidth) div 2;
  5978. DisableAlign;
  5979. try
  5980. if FHidePosition = hpTop then
  5981. begin
  5982. Top := -(Height - BaseTop * 2 - 2);
  5983. end;
  5984. if FHidePosition = hpLeft then
  5985. begin
  5986. Left := -(Width - BaseLeft * 2 - 2);
  5987. end;
  5988. if FHidePosition = hpRight then
  5989. begin
  5990. Left := Screen.WorkAreaWidth - BaseLeft - 4;
  5991. end;
  5992. finally
  5993. EnableAlign;
  5994. PostMessage(Handle, WM_KILLFOCUS, 0, 0);
  5995. FMainFormHidden := True;
  5996. end;
  5997. end;
  5998. //------------------------------------------------------------------------------
  5999. procedure TMainForm.ShowMainForm;
  6000. var
  6001. BaseTop, BaseLeft: Integer;
  6002. begin
  6003. if FMovingMainForm then
  6004. Exit;
  6005. BaseTop := (Height - ClientHeight) div 2;
  6006. BaseLeft := (Width - ClientWidth) div 2;
  6007. DisableAlign;
  6008. try
  6009. if FHidePosition = hpTop then
  6010. begin
  6011. Top := -BaseTop;
  6012. end;
  6013. if FHidePosition = hpLeft then
  6014. begin
  6015. Left := -BaseLeft;
  6016. end;
  6017. if FHidePosition = hpRight then
  6018. begin
  6019. Left := Screen.WorkAreaWidth - Width + BaseLeft;
  6020. end;
  6021. finally
  6022. EnableAlign;
  6023. PostMessage(Handle, WM_SETFOCUS, 0, 0);
  6024. FMainFormHidden := False;
  6025. end;
  6026. end;
  6027. //------------------------------------------------------------------------------
  6028. procedure TMainForm.TimerForShowMainFormTimer(Sender: TObject);
  6029. begin
  6030. FDblClickedTrayIcon := False;
  6031. TimerForShowMainForm.Enabled := False;
  6032. end;
  6033. //------------------------------------------------------------------------------
  6034. procedure TMainForm.TimerForHideMainFormTimer(Sender: TObject);
  6035. begin
  6036. if not FAutoHide then
  6037. begin
  6038. if FMainFormHidden then
  6039. ShowMainForm;
  6040. FHidePosition := hpNone;
  6041. TimerForHideMainForm.Enabled := False;
  6042. Exit;
  6043. end;
  6044. TimerForHideMainForm.Enabled := False;
  6045. try
  6046. if FMovingMainForm then
  6047. Exit;
  6048. if (Mouse.CursorPos.X >= Left) and (Mouse.CursorPos.X <= Left + Width) and (Mouse.CursorPos.Y >= Top) and (Mouse.CursorPos.Y <= Top + Height) then
  6049. begin
  6050. if FMainFormHidden then
  6051. ShowMainForm;
  6052. FDblClickedTrayIcon := False;
  6053. end
  6054. else
  6055. begin
  6056. if (not FMainFormHidden) and (not FDblClickedTrayIcon) then
  6057. HideMainForm;
  6058. end;
  6059. finally
  6060. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  6061. end;
  6062. end;
  6063. //------------------------------------------------------------------------------
  6064. procedure TMainForm.WMMove(var Msg: TMessage);
  6065. var
  6066. BaseTop: Integer;
  6067. begin
  6068. HideUserCardForm;
  6069. FMovingMainForm := False;
  6070. BaseTop := (Height - ClientHeight) div 2;
  6071. if (FHidePosition = hpLeft) or (FHidePosition = hpRight) then
  6072. Height := Screen.WorkAreaHeight + BaseTop * 2;
  6073. if TimerForHideMainForm <> nil then
  6074. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  6075. end;
  6076. //------------------------------------------------------------------------------
  6077. procedure TMainForm.WMSizing(var Msg: TMessage);
  6078. begin
  6079. inherited;
  6080. HideUserCardForm;
  6081. FMovingMainForm := True;
  6082. end;
  6083. //------------------------------------------------------------------------------
  6084. procedure TMainForm.WMSize(var Msg: TMessage);
  6085. begin
  6086. inherited;
  6087. HideUserCardForm;
  6088. FMovingMainForm := False;
  6089. CheckWindowPositon;
  6090. end;
  6091. //------------------------------------------------------------------------------
  6092. procedure TMainForm.WMMoving(var Msg: TMessage);
  6093. var
  6094. BaseTop, BaseLeft: Integer;
  6095. begin
  6096. HideUserCardForm;
  6097. FMovingMainForm := True;
  6098. BaseTop := (Height - ClientHeight) div 2;
  6099. BaseLeft := (Width - ClientWidth) div 2;
  6100. with PRECT(Msg.LParam)^ do
  6101. begin
  6102. if (Top < -BaseTop) then
  6103. begin
  6104. FHidePosition := hpTop;
  6105. Top := -BaseTop;
  6106. Bottom := Top + Height;
  6107. end
  6108. else if (Left < -BaseLeft) then
  6109. begin
  6110. FHidePosition := hpLeft;
  6111. Right := Right + (-BaseLeft - Left);
  6112. Top := -BaseTop;
  6113. Left := -BaseLeft;
  6114. Bottom := Screen.WorkAreaHeight + BaseTop * 2;
  6115. end
  6116. else if (Right > (Screen.WorkAreaWidth + BaseLeft)) then
  6117. begin
  6118. FHidePosition := hpRight;
  6119. Top := -BaseTop;
  6120. Right := Screen.WorkAreaWidth + BaseLeft;
  6121. Left := Right - Width;
  6122. Bottom := Screen.WorkAreaHeight + BaseTop * 2;
  6123. end
  6124. else if (Top > -BaseTop) and (Left > -BaseLeft) and (Right < (Screen.WorkAreaWidth + BaseLeft)) then
  6125. begin
  6126. FHidePosition := hpNone;
  6127. Bottom := Top + Height;
  6128. end;
  6129. end;
  6130. end;
  6131. //------------------------------------------------------------------------------
  6132. procedure TMainForm.spbTelMeetingClick(Sender: TObject);
  6133. begin
  6134. //
  6135. end;
  6136. procedure TMainForm.spbCancelFilterClick(Sender: TObject);
  6137. begin
  6138. edFilterKeyword.Text := '查找联系人...';
  6139. edFilterKeyword.Font.Color := clGray;
  6140. end;
  6141. procedure TMainForm.spbChangeLoginNameClick(Sender: TObject);
  6142. var
  6143. Point: TPoint;
  6144. begin
  6145. Point.X := 0;
  6146. Point.Y := spLoginNameBorder.Height + 1;
  6147. Point := spLoginNameBorder.ClientToScreen(Point);
  6148. ppLoginedUsers.Popup(Point.X, Point.Y);
  6149. end;
  6150. procedure TMainForm.spbContacterViewStyleClick(Sender: TObject);
  6151. var
  6152. Point: TPoint;
  6153. begin
  6154. Point.X := 0;
  6155. Point.Y := spbContacterViewStyle.Height + 1;
  6156. Point := spbContacterViewStyle.ClientToScreen(Point);
  6157. ppContacterViewStyle.Popup(Point.X, Point.Y);
  6158. end;
  6159. //------------------------------------------------------------------------------
  6160. procedure TMainForm.spbDisplayNameClick(Sender: TObject);
  6161. var
  6162. Point: TPoint;
  6163. begin
  6164. Point.X := 0;
  6165. Point.Y := spbDisplayName.Height + 1;
  6166. Point := spbDisplayName.ClientToScreen(Point);
  6167. ppChangeStates.Popup(Point.X, Point.Y);
  6168. end;
  6169. //------------------------------------------------------------------------------
  6170. procedure TMainForm.spbEmailClick(Sender: TObject);
  6171. begin
  6172. //AddWebBrowserToPageControl('http://www.lxtalk.com/rd/', 999);
  6173. end;
  6174. //------------------------------------------------------------------------------
  6175. procedure TMainForm.spbFindTeamClick(Sender: TObject);
  6176. begin
  6177. if SearchTeamForm <> nil then
  6178. begin
  6179. SearchTeamForm.BringToFront;
  6180. Exit;
  6181. end;
  6182. SearchTeamForm := TSearchTeamForm.Create(Application);
  6183. SearchTeamForm.Show;
  6184. end;
  6185. //------------------------------------------------------------------------------
  6186. procedure TMainForm.spbGoClick(Sender: TObject);
  6187. var
  6188. TabSheet: TTabSheet;
  6189. WebBrowser: TWebBrowser;
  6190. begin
  6191. TabSheet := pgcMultiWeb.ActivePage;
  6192. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6193. WebBrowser.Tag := -1;
  6194. try
  6195. if (WebBrowser.Busy) then
  6196. WebBrowser.Stop;
  6197. except
  6198. end;
  6199. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  6200. WebBrowser.Navigate(cbxURLInputer.Text);
  6201. end;
  6202. //------------------------------------------------------------------------------
  6203. procedure TMainForm.spbLoginStateClick(Sender: TObject);
  6204. var
  6205. Point: TPoint;
  6206. begin
  6207. Point.X := 0;
  6208. Point.Y := spbLoginState.Height + 1;
  6209. Point := spbLoginState.ClientToScreen(Point);
  6210. ppLoginStates.Popup(Point.X, Point.Y);
  6211. end;
  6212. //------------------------------------------------------------------------------
  6213. procedure TMainForm.spbNDCancelAllClick(Sender: TObject);
  6214. var
  6215. AMissionID: string;
  6216. UploadMission: TUploadMission;
  6217. ListItem: TRealICQContacterListItem;
  6218. begin
  6219. try
  6220. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count > 0) then
  6221. begin
  6222. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  6223. if Assigned(ListItem) then
  6224. begin
  6225. UploadMission := TUploadMission(ListItem.Data);
  6226. if Assigned(UploadMission) then
  6227. begin
  6228. AMissionID := UploadMission.FID;
  6229. try
  6230. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  6231. FreeAndNil(UploadMission);
  6232. except
  6233. end;
  6234. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  6235. end;
  6236. end;
  6237. end;
  6238. except
  6239. end;
  6240. try
  6241. if FLVNetWorkDiskUploadingFiles <> nil then
  6242. begin
  6243. FLVNetWorkDiskUploadingFiles.Items.Clear;
  6244. FLVNetWorkDiskUploadingFiles.ReDrawAll;
  6245. end;
  6246. except
  6247. end;
  6248. try
  6249. if FLVNetWorkDiskDownloadingFiles <> nil then
  6250. begin
  6251. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  6252. FLVNetWorkDiskDownloadingFiles.ReDrawAll;
  6253. end;
  6254. except
  6255. end;
  6256. ClearFileMissions;
  6257. pnlNDMissions.Visible := False;
  6258. SplitterNDMissions.Visible := False;
  6259. spbNDCancelAll.Enabled := False;
  6260. FConfirmReplaceResult := -1;
  6261. FLastDownloadDirectory := '';
  6262. CheckNDControlState;
  6263. end;
  6264. //------------------------------------------------------------------------------
  6265. procedure TMainForm.spbNDConnectClick(Sender: TObject);
  6266. var
  6267. LoginName: string;
  6268. begin
  6269. RealICQNetWorkDiskClient.TCPClient.RemoteAddress := RealICQClient.NetWorkDiskServerAddress;
  6270. RealICQNetWorkDiskClient.TCPClient.RemotePort := RealICQClient.NetWorkDiskServerPort;
  6271. RealICQNetWorkDiskClient.TCPClient.Proxy.Assign(RealICQClient.TCPClient.Proxy);
  6272. LoginName := RealICQClient.LoginName;
  6273. if Pos('+', RealICQClient.LoginName) > 0 then
  6274. LoginName := Copy(RealICQClient.LoginName, Pos('+', RealICQClient.LoginName) + 1, Length(RealICQClient.LoginName));
  6275. RealICQNetWorkDiskClient.Login(LoginName, RealICQClient.Password);
  6276. end;
  6277. //------------------------------------------------------------------------------
  6278. procedure TMainForm.spbSavePasswordClick(Sender: TObject);
  6279. begin
  6280. FSavePassword := not FSavePassword;
  6281. SetLoginStateControlState;
  6282. end;
  6283. //------------------------------------------------------------------------------
  6284. procedure TMainForm.spbSelectServerClick(Sender: TObject);
  6285. var
  6286. Point: TPoint;
  6287. begin
  6288. Point.X := 0;
  6289. Point.Y := spServerListBorder.Height;
  6290. Point := spServerListBorder.ClientToScreen(Point);
  6291. ppServerList.Popup(Point.X, Point.Y);
  6292. end;
  6293. procedure TMainForm.spbSelLanguageClick(Sender: TObject);
  6294. var
  6295. Point: TPoint;
  6296. begin
  6297. Point.X := 0;
  6298. Point.Y := (Sender as TRealICQSpeedButton).Height + 1;
  6299. Point := (Sender as TRealICQSpeedButton).ClientToScreen(Point);
  6300. ppLanguages.Popup(Point.X, Point.Y);
  6301. end;
  6302. procedure TMainForm.spbSelUIColorClick(Sender: TObject);
  6303. var
  6304. Point: TPoint;
  6305. begin
  6306. Point.X := 0;
  6307. Point.Y := (Sender as TRealICQSpeedButton).Height + 1;
  6308. Point := (Sender as TRealICQSpeedButton).ClientToScreen(Point);
  6309. ppColors.Popup(Point.X, Point.Y);
  6310. end;
  6311. procedure TMainForm.spbShowHideRightClick(Sender: TObject);
  6312. begin
  6313. //ShowOrHideMuiltiWeb;
  6314. end;
  6315. procedure TMainForm.spbStopClick(Sender: TObject);
  6316. var
  6317. TabSheet: TTabSheet;
  6318. WebBrowser: TWebBrowser;
  6319. begin
  6320. try
  6321. TabSheet := pgcMultiWeb.ActivePage;
  6322. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6323. if WebBrowser.Busy then
  6324. WebBrowser.Stop;
  6325. except
  6326. end;
  6327. end;
  6328. //------------------------------------------------------------------------------
  6329. procedure TMainForm.TabSetMuiltWebClick(Sender: TObject);
  6330. var
  6331. TabSheet: TTabSheet;
  6332. WebBrowser: TWebBrowser;
  6333. begin
  6334. pgcMultiWeb.ActivePageIndex := TabSetMuiltWeb.TabIndex;
  6335. try
  6336. TabSheet := pgcMultiWeb.ActivePage;
  6337. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6338. if not AnsiSameText(WebBrowser.LocationURL, 'about:blank') then
  6339. begin
  6340. with cbxURLInputer.ItemsEx.Add do
  6341. begin
  6342. Caption := WebBrowser.LocationURL;
  6343. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  6344. ImageIndex := 2
  6345. else if Copy(Caption, 1, 4) = 'ftp:' then
  6346. ImageIndex := 1
  6347. else
  6348. ImageIndex := 0;
  6349. end;
  6350. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  6351. end;
  6352. except
  6353. end;
  6354. end;
  6355. //------------------------------------------------------------------------------
  6356. procedure TMainForm.TabSetMuiltWebGetImageIndex(Sender: TObject; TabIndex: Integer; var ImageIndex: Integer);
  6357. var
  6358. TabSheet: TTabSheet;
  6359. WebBrowser: TWebBrowser;
  6360. AImageIndex: Integer;
  6361. begin
  6362. AImageIndex := 0;
  6363. try
  6364. TabSheet := pgcMultiWeb.Pages[TabIndex];
  6365. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6366. if not AnsiSameText(WebBrowser.LocationURL, 'about:blank') then
  6367. begin
  6368. with cbxURLInputer.ItemsEx.Add do
  6369. begin
  6370. Caption := WebBrowser.LocationURL;
  6371. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  6372. ImageIndex := 2
  6373. else if Copy(Caption, 1, 4) = 'ftp:' then
  6374. ImageIndex := 1
  6375. else
  6376. ImageIndex := 0;
  6377. AImageIndex := ImageIndex;
  6378. end;
  6379. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  6380. end;
  6381. except
  6382. end;
  6383. ImageIndex := AImageIndex;
  6384. end;
  6385. //------------------------------------------------------------------------------
  6386. procedure TMainForm.TabSetNDMissionsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
  6387. begin
  6388. PageControlNDMission.ActivePageIndex := TabSetNDMissions.TabIndex;
  6389. end;
  6390. //------------------------------------------------------------------------------
  6391. procedure TMainForm.TabSetNDMissionsClick(Sender: TObject);
  6392. begin
  6393. PageControlNDMission.ActivePageIndex := TabSetNDMissions.TabIndex;
  6394. end;
  6395. //------------------------------------------------------------------------------
  6396. procedure TMainForm.TimerForCheckDblClickTimer(Sender: TObject);
  6397. begin
  6398. TimerForCheckDblClick.Enabled := False;
  6399. //if AutoUpdateForm <> nil then Exit;
  6400. SetForegroundWindow(TrueHiddenMainForm.Handle);
  6401. if RealICQClient.Logined and RealICQClient.Connected then
  6402. ppChangeStates.Popup(FCursorPosX, Screen.WorkAreaHeight)
  6403. else
  6404. ppTrayIcon.Popup(FCursorPosX, Screen.WorkAreaHeight);
  6405. end;
  6406. //------------------------------------------------------------------------------
  6407. procedure TMainForm.TimerForCheckLogoutTimeoutTimer(Sender: TObject);
  6408. begin
  6409. TimerForCheckLogoutTimeout.Enabled := False;
  6410. RealICQClient.Logout;
  6411. SetUIState;
  6412. end;
  6413. //------------------------------------------------------------------------------
  6414. procedure TMainForm.TrayIconClick(Sender: TObject);
  6415. begin
  6416. FCursorPosX := Mouse.CursorPos.X;
  6417. TimerForCheckDblClick.Interval := GetDoubleClickTime();
  6418. if not TimerForCheckDblClick.Enabled then
  6419. TimerForCheckDblClick.Enabled := True;
  6420. end;
  6421. //------------------------------------------------------------------------------
  6422. procedure TMainForm.OpenNotReadMessage(iIndex: Integer);
  6423. var
  6424. nTeamID: string;
  6425. MessageID, SMSReceiver: string;
  6426. SystemMessage: TRealICQSystemMessage;
  6427. SMSForm: TSMSForm;
  6428. MessageList: TList;
  6429. NotReadMessage: TNotReadMessage;
  6430. begin
  6431. if (iIndex < 0) and (iIndex >= FNotReadMessages.Count) then
  6432. Exit;
  6433. if FNotReadMessages.Count = 0 then
  6434. actOpenMainForm.Execute
  6435. else
  6436. begin
  6437. MessageID := FNotReadMessages.Strings[iIndex];
  6438. if AnsiSameStr(Copy(MessageID, 1, Length(SMSMessageID)), SMSMessageID) then
  6439. begin
  6440. SMSReceiver := Copy(MessageID, Length(SMSMessageID) + 1, Length(MessageID) - Length(SMSMessageID));
  6441. // if SMSReceiver <> '' then
  6442. SMSForm := OpenSMSForm(SMSReceiver)
  6443. // else
  6444. // SMSForm := OpenSMSForm()
  6445. end
  6446. else if AnsiSameStr(Copy(MessageID, 1, Length(TeamMessageID)), TeamMessageID) then
  6447. begin
  6448. nTeamID := Copy(MessageID, Length(TeamMessageID) + 1, Length(MessageID) - Length(TeamMessageID));
  6449. OpenTeamTalkingForm(nTeamID);
  6450. end
  6451. else if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  6452. begin
  6453. try
  6454. SystemMessage := FNotReadMessages.Objects[iIndex] as TRealICQSystemMessage;
  6455. ShowSystemMessage(SystemMessage);
  6456. finally
  6457. FNotReadMessages.Delete(iIndex);
  6458. try
  6459. NotReadMessageBoxForm.ShowNotReadMessage;
  6460. NotReadMessageBoxForm.Height := 0;
  6461. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  6462. except
  6463. end;
  6464. end;
  6465. end
  6466. else
  6467. begin
  6468. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  6469. NotReadMessage := MessageList[0];
  6470. OpenTalkingForm(MessageID, True, NotReadMessage.FRealICQClient);
  6471. end;
  6472. end;
  6473. end;
  6474. //------------------------------------------------------------------------------
  6475. procedure TMainForm.TrayIconDblClick(Sender: TObject);
  6476. begin
  6477. TimerForCheckDblClick.Enabled := False;
  6478. OpenNotReadMessage(FNotReadMessages.Count - 1);
  6479. end;
  6480. //------------------------------------------------------------------------------
  6481. procedure TMainForm.TrayIconMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  6482. var
  6483. iTimes: Integer;
  6484. ANeedShow: Boolean;
  6485. rcTray: TRect;
  6486. hwndTray: hWnd;
  6487. hwndChild: hWnd;
  6488. begin
  6489. try
  6490. if not Assigned(NotReadMessageBoxForm) then
  6491. Exit;
  6492. ANeedShow := (FNotReadMessages <> nil) and (FNotReadMessages.Count > 0) and (MainForm.RealICQClient.Connected) and (TimerForFlashTrayIcon.Enabled);
  6493. if not ANeedShow then
  6494. begin
  6495. if NotReadMessageBoxForm.Visible then
  6496. begin
  6497. NotReadMessageBoxForm.Visible := False;
  6498. NotReadMessageBoxForm.Timer1.Enabled := False;
  6499. end;
  6500. Exit;
  6501. end;
  6502. if (not NotReadMessageBoxForm.Visible) and (NotReadMessageBoxForm.Tag = 1) then
  6503. begin
  6504. //TrayIcon.Hint := '';
  6505. NotReadMessageBoxForm.Tag := 0;
  6506. hwndTray := FindWindow('Shell_TrayWnd', nil);
  6507. hwndChild := FindWindowEx(hwndTray, 0, 'TrayNotifyWnd', nil);
  6508. GetWindowRect(hwndChild, rcTray);
  6509. FTrayIconRect.Left := X - 20;
  6510. FTrayIconRect.Top := rcTray.Top;
  6511. FTrayIconRect.Right := FTrayIconRect.Left + 40;
  6512. FTrayIconRect.Bottom := rcTray.Bottom;
  6513. NotReadMessageBoxForm.ShowNotReadMessage;
  6514. NotReadMessageBoxForm.Height := 0;
  6515. NotReadMessageBoxForm.FRect := FTrayIconRect;
  6516. //NotReadMessageBoxForm.Left := X - NotReadMessageBoxForm.Width div 2;
  6517. NotReadMessageBoxForm.Left := Screen.WorkAreaWidth - NotReadMessageBoxForm.Width;
  6518. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  6519. NotReadMessageBoxForm.FRect.Left := NotReadMessageBoxForm.FRect.Left;
  6520. NotReadMessageBoxForm.FRect.Top := NotReadMessageBoxForm.Top;
  6521. NotReadMessageBoxForm.FRect.Right := NotReadMessageBoxForm.FRect.Right;
  6522. NotReadMessageBoxForm.FRect.Bottom := NotReadMessageBoxForm.FRect.Bottom;
  6523. NotReadMessageBoxForm.Visible := True;
  6524. NotReadMessageBoxForm.Timer1.Enabled := True;
  6525. end;
  6526. //MessageBoxForm.Visible := FNotReadMessages.Count > 0;
  6527. except
  6528. end;
  6529. end;
  6530. procedure TMainForm.TrayIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  6531. begin
  6532. //if AutoUpdateForm <> nil then Exit;
  6533. if Button = mbRight then
  6534. begin
  6535. SetForegroundWindow(TrueHiddenMainForm.Handle);
  6536. ppTrayIcon.Popup(Mouse.CursorPos.X, Screen.WorkAreaHeight);
  6537. end;
  6538. end;
  6539. //------------------------------------------------------------------------------
  6540. {通讯录}
  6541. //------------------------------------------------------------------------------
  6542. procedure TMainForm.tsAddrBookShow(Sender: TObject);
  6543. begin
  6544. //
  6545. end;
  6546. //----保存联系人----------------------------------------------------- ---------
  6547. procedure TMainForm.SaveContacter(Name, Mobile, Tel, Email, Remark, BranchId: string);
  6548. var
  6549. MessageId, ParamValue: string;
  6550. begin
  6551. MessageId := IntToStr(GetTickCount);
  6552. CreateManageGroupMemberMessage('', Name, '', Mobile, Tel, Email, Remark, BranchId, MessageId);
  6553. //发送新增联系人消息
  6554. ParamValue := MessageId + #10 + '' + #10 + Name + #10 + Mobile + #10 + Tel + #10 + Email + #10 + Remark + #10 + '' + #10 + BranchId;
  6555. RealICQClient.SendAddrBookCommand(1, 1, ParamValue);
  6556. end;
  6557. //----修改备注名称--------------------------------------------------------------
  6558. procedure TMainForm.miSendTeamSMSClick(Sender: TObject);
  6559. var
  6560. iLoop: Integer;
  6561. ListItem: TRealICQContacterListItem;
  6562. RealICQTeam: TRealICQTeam;
  6563. begin
  6564. if (not MainForm.RealICQClient.UserPermission.EnableMultiSendSms) or (not MainForm.RealICQClient.UserPermission.EnableSendSms) then
  6565. begin
  6566. ShowMessage('您没有群发手机短信的权限!');
  6567. Exit;
  6568. end;
  6569. if FLVTeams.SelCount = 1 then
  6570. begin
  6571. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  6572. begin
  6573. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  6574. if ListItem.Selected then
  6575. begin
  6576. RealICQTeam := ListItem.Data;
  6577. OpenTeamSMSForm(RealICQTeam.TeamID);
  6578. Break;
  6579. end;
  6580. end;
  6581. end;
  6582. end;
  6583. procedure TMainForm.miSetRemarkClick(Sender: TObject);
  6584. var
  6585. LoginName: string;
  6586. Remark, MessageId, ParamValue: string;
  6587. RealICQUser: TRealICQUser;
  6588. Employee: TRealICQEmployee;
  6589. RealICQContacterTreeView: TRealICQContacterTreeView;
  6590. ItemIndex: Integer;
  6591. begin
  6592. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6593. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6594. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6595. LoginName := Employee.LoginName;
  6596. if LoginName <> '' then
  6597. begin
  6598. RealICQUser := GetAddrBookUser(Employee.BranchID, LoginName);
  6599. if RealICQUser = nil then
  6600. Exit;
  6601. Remark := RealICQUser.Remark;
  6602. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  6603. if not AnsiSameStr(Remark, RealICQUser.Remark) then//发送修改备注
  6604. begin
  6605. MessageId := IntToStr(GetTickCount);
  6606. CreateManageGroupMemberMessage(RealICQUser.LoginName, RealICQUser.DisplayName, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, Remark, Employee.BranchID, MessageId);
  6607. //发送修改联系人消息
  6608. RealICQUser.Remark := Remark;
  6609. LoginName := Employee.LoginName;
  6610. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6611. ParamValue := MessageId + #10 + LoginName + #10 + RealICQUser.DisplayName + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Watchword + #10 + Remark + #10 + Employee.BranchId;
  6612. MainForm.RealICQClient.SendAddrBookCommand(6, 1, ParamValue);
  6613. end;
  6614. end;
  6615. end;
  6616. //------------------------------------------------------------------------------
  6617. procedure TMainForm.miAddGroupClick(Sender: TObject);
  6618. var
  6619. ItemIndex, iLoop: Integer;
  6620. RealICQContacterTreeView: TRealICQContacterTreeView;
  6621. TmpBranch: TRealICQBranchInfo;
  6622. Branch: TRealICQBranch;
  6623. GroupName, ResultStr, SelBranchName: string;
  6624. ParamValue: string;
  6625. MessageId: string;
  6626. BranchNames, TmpList: TStringList;
  6627. Employee: TRealICQEmployee;
  6628. begin
  6629. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6630. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6631. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6632. if Branch = nil then
  6633. begin
  6634. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6635. if Employee <> nil then
  6636. Branch := Employee.Node.Parent.Data;
  6637. end;
  6638. if Branch <> nil then
  6639. SelBranchName := Branch.BranchName
  6640. else
  6641. SelBranchName := '我的通讯录';
  6642. BranchNames := TStringList.Create;
  6643. try
  6644. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6645. begin
  6646. TmpBranch := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6647. GroupName := '';
  6648. GetParentGroupNameList(TmpBranch, GroupName);
  6649. BranchNames.AddObject(GroupName, TmpBranch);
  6650. if TmpBranch.ID = Branch.BranchID then
  6651. SelBranchName := GroupName;
  6652. end;
  6653. ResultStr := ShowAddrGroupInputBox('新建组', SelBranchName, BranchNames);
  6654. if ResultStr = '' then
  6655. exit;
  6656. TmpList := SplitString(ResultStr, #10);
  6657. GroupName := TmpList[1];
  6658. if BranchNames.IndexOf(TmpList[0] + GroupName + '\') >= 0 then
  6659. begin
  6660. ShowMessage('已存在相同名称的组!');
  6661. Exit;
  6662. end;
  6663. TmpBranch := BranchNames.Objects[BranchNames.IndexOf(TmpList[0])] as TRealICQBranchInfo;
  6664. //发送添加通讯录组消息
  6665. MessageId := IntToStr(GetTickCount);
  6666. CreateManageGroupMessage(TmpBranch.ID, GroupName, TmpBranch.ParentID, MessageId);
  6667. ParamValue := MessageId + #10 + GroupName + #10 + '0' + #10 + TmpBranch.ID + #10 + MainForm.RealICQClient.Me.LoginName;
  6668. MainForm.RealICQClient.SendAddrBookCommand(1, 0, ParamValue);
  6669. finally
  6670. BranchNames.Free;
  6671. end;
  6672. end;
  6673. //---修改组----------------------------------------------------------
  6674. procedure TMainForm.miUpdateGroupClick(Sender: TObject);
  6675. var
  6676. ItemIndex: Integer;
  6677. RealICQContacterTreeView: TRealICQContacterTreeView;
  6678. Branch: TRealICQBranch;
  6679. GroupName, MessageId, ParamValue: string;
  6680. begin
  6681. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6682. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6683. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6684. if Branch <> nil then
  6685. begin
  6686. GroupName := Branch.BranchName;
  6687. if GroupName = '我的通讯录' then
  6688. begin
  6689. ShowMessage('默认组不允许修改!');
  6690. Exit;
  6691. end;
  6692. end
  6693. else
  6694. begin
  6695. ShowMessage('请选择要修改的组!');
  6696. Exit;
  6697. end;
  6698. GroupName := ShowMyInputBox('修改组', '组名称', GroupName, 500);
  6699. if (GroupName <> Branch.BranchName) and (GroupName <> '') then
  6700. begin
  6701. //发送修改通讯录组名消息
  6702. MessageId := IntToStr(GetTickCount);
  6703. CreateManageGroupMessage(Branch.BranchID, GroupName, Branch.ParentID, MessageId);
  6704. ParamValue := MessageId + #10 + GroupName + #10 + Branch.BranchID + #10 + Branch.ParentID + #10 + MainForm.RealICQClient.Me.LoginName;
  6705. MainForm.RealICQClient.SendAddrBookCommand(2, 0, ParamValue);
  6706. end;
  6707. end;
  6708. //-----删除通讯录组----------------------------------------------------
  6709. procedure TMainForm.miDelGroupClick(Sender: TObject);
  6710. var
  6711. ItemIndex: Integer;
  6712. RealICQContacterTreeView: TRealICQContacterTreeView;
  6713. Branch: TRealICQBranch;
  6714. GroupId: string;
  6715. ParamValue: string;
  6716. MessageId: string;
  6717. begin
  6718. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6719. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6720. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6721. GroupId := '';
  6722. if Branch <> nil then
  6723. begin
  6724. if Branch.ParentID = '0' then
  6725. begin
  6726. ShowMessage('默认组不可以删除');
  6727. Exit;
  6728. end;
  6729. if MessageBox(Handle, '确定要将选中的组删除吗?', '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  6730. Exit;
  6731. //发送删除通讯录组消息
  6732. MessageId := IntToStr(GetTickCount);
  6733. GetChildsGroupId(Branch.BranchID, GroupId);
  6734. CreateManageGroupMessage(GroupId, Branch.BranchName, Branch.ParentID, MessageId);
  6735. ParamValue := MessageId + #10 + GroupId + #10 + Branch.BranchID + #10 + Branch.ParentID + #10 + MainForm.RealICQClient.Me.LoginName;
  6736. MainForm.RealICQClient.SendAddrBookCommand(3, 0, ParamValue);
  6737. end
  6738. else
  6739. ShowMessage('请选择要删除的组!');
  6740. end;
  6741. //-----新增用户到通讯录---------------------------------------
  6742. procedure TMainForm.miAddGroupUserClick(Sender: TObject);
  6743. var
  6744. MessageId, ParamValue, BranchID: string;
  6745. Branch: TRealICQBranch;
  6746. TmpBranch: TRealICQBranchInfo;
  6747. Employee: TRealICQEmployee;
  6748. RealICQUser: TRealICQUser;
  6749. Node: TTreeNode;
  6750. ItemIndex, iLoop: Integer;
  6751. BranchNames: TStringList;
  6752. BranchName, GroupName: string;
  6753. RealICQContacterTreeView: TRealICQContacterTreeView;
  6754. begin
  6755. BranchName := '我的通讯录\';
  6756. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6757. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6758. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6759. if Branch = nil then
  6760. begin
  6761. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6762. if Employee <> nil then
  6763. begin
  6764. Node := Employee.Node.Parent;
  6765. Branch := Node.Data;
  6766. end;
  6767. end;
  6768. if Branch <> nil then
  6769. begin
  6770. if Branch.BranchName = '我的通讯录' then
  6771. begin
  6772. ShowMessage('默认组下面不允许添加联系人!');
  6773. Exit;
  6774. end;
  6775. BranchID := Branch.BranchID;
  6776. end;
  6777. if (GetGroupUserCount + 1) > MainForm.RealICQClient.UserPermission.AddrBookSize then
  6778. begin
  6779. ShowMessage('您的通讯录已满或者没有添加联系人的权限!' + #13 + '请联系系统管理员。');
  6780. Exit;
  6781. end;
  6782. BranchNames := TStringList.Create;
  6783. try
  6784. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6785. begin
  6786. TmpBranch := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6787. GroupName := '';
  6788. GetParentGroupNameList(TmpBranch, GroupName);
  6789. if TmpBranch.ID = BranchID then
  6790. BranchNames.InsertObject(0, GroupName, TmpBranch)
  6791. else
  6792. BranchNames.AddObject(GroupName, TmpBranch);
  6793. end;
  6794. //弹出新增联系人窗体
  6795. RealICQUser := TRealICQUser.Create('', RealICQClient);
  6796. if not ShowAddrUserInputBox('新增联系人', RealICQUser, BranchNames) then
  6797. Exit;
  6798. if Trim(RealICQUser.Nickname) = '' then
  6799. Exit;
  6800. MessageId := IntToStr(GetTickCount);
  6801. CreateManageGroupMemberMessage('', RealICQUser.Nickname, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, RealICQUser.Remark1, BranchID, MessageId);
  6802. //发送新增联系人消息
  6803. ParamValue := MessageId + #10 + '' + #10 + RealICQUser.Nickname + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Remark1 + #10 + RealICQUser.Remark + #10 + BranchID;
  6804. RealICQClient.SendAddrBookCommand(1, 1, ParamValue);
  6805. finally
  6806. BranchNames.Free;
  6807. end;
  6808. end;
  6809. procedure TMainForm.miBusyClick(Sender: TObject);
  6810. begin
  6811. FLoginState := stBusy;
  6812. FLeaveMessage := '忙碌';
  6813. SetLoginStateControlState;
  6814. end;
  6815. //-----------------------------------------------------------------
  6816. procedure TMainForm.miUpdateGroupUserClick(Sender: TObject);
  6817. var
  6818. ItemIndex, iLoop: Integer;
  6819. RealICQContacterTreeView: TRealICQContacterTreeView;
  6820. Employee: TRealICQEmployee;
  6821. BranchNames: TStringList;
  6822. Branch: TRealICQBranch;
  6823. RealICQUser: TRealICQUser;
  6824. LoginName: string;
  6825. ParamValue: string;
  6826. MessageId: string;
  6827. ParentNode: TTreeNode;
  6828. begin
  6829. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6830. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6831. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6832. if Employee <> nil then
  6833. begin
  6834. //弹出修改窗体
  6835. BranchNames := TStringList.Create;
  6836. try
  6837. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  6838. begin
  6839. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  6840. if Branch.BranchID = Employee.BranchID then
  6841. BranchNames.Insert(0, Branch.BranchName)
  6842. else
  6843. BranchNames.Add(Branch.BranchName);
  6844. end;
  6845. ParentNode := Employee.Node.Parent;
  6846. Branch := ParentNode.Data;
  6847. RealICQUser := GetAddrBookUser(Employee.BranchID, Employee.LoginName);
  6848. if not ShowAddrUserInputBox('查看/编辑联系人', RealICQUser, BranchNames) then
  6849. Exit;
  6850. MessageId := IntToStr(GetTickCount);
  6851. CreateManageGroupMemberMessage(RealICQUser.LoginName, RealICQUser.DisplayName, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, RealICQUser.Remark1, Employee.BranchID, MessageId);
  6852. //发送修改联系人消息
  6853. LoginName := Employee.LoginName;
  6854. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6855. 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;
  6856. MainForm.RealICQClient.SendAddrBookCommand(2, 1, ParamValue);
  6857. finally
  6858. BranchNames.Free;
  6859. end;
  6860. end
  6861. else
  6862. ShowMessage('请选择要修改的联系人!');
  6863. end;
  6864. //----删除联系人-------------------------------------------------------------
  6865. procedure TMainForm.miDelGroupUserClick(Sender: TObject);
  6866. var
  6867. ItemIndex: Integer;
  6868. RealICQContacterTreeView: TRealICQContacterTreeView;
  6869. Employee: TRealICQEmployee;
  6870. ParamValue: string;
  6871. MessageId, LoginName: string;
  6872. begin
  6873. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6874. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6875. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6876. if Employee = nil then
  6877. begin
  6878. ShowMessage('请选择要删除的联系人');
  6879. Exit
  6880. end;
  6881. //发送删除通讯录组联系人消息
  6882. MessageId := IntToStr(GetTickCount);
  6883. CreateManageGroupMemberMessage(Employee.LoginName, Employee.DisplayName, '', Employee.Mobile, '', '', '', Employee.BranchID, MessageId);
  6884. LoginName := Employee.LoginName;
  6885. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6886. ParamValue := MessageId + #10 + LoginName + #10 + Employee.DisplayName + #10 + Employee.Mobile + #10 + '' + #10 + '' + #10 + '' + #10 + '' + #10 + Employee.BranchId;
  6887. MainForm.RealICQClient.SendAddrBookCommand(3, 1, ParamValue);
  6888. end;
  6889. procedure TMainForm.spbExportGroupUserClick(Sender: TObject);
  6890. var
  6891. ItemIndex, iLoop, jLoop, IIndex: Integer;
  6892. RealICQContacterTreeView: TRealICQContacterTreeView;
  6893. Branch: TRealICQBranch;
  6894. RealICQUser: TRealICQUser;
  6895. BranchInfo: TRealICQBranchInfo;
  6896. GroupId: string;
  6897. begin
  6898. SD.Title := '导出通讯录另存为';
  6899. SD.Filter := 'CSV(*.csv)|*.csv';
  6900. CsvLines := TStringList.Create;
  6901. CommaStr := TStringList.Create;
  6902. CommaStr.CommaText := '姓名 手机 电话 电子邮箱 备注';
  6903. CsvLines.Add(CommaStr.CommaText);
  6904. MainForm.RealICQClient.OnGettedAddrBookUsers := GettedAddrBookUsers1;
  6905. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6906. if (ItemIndex < 0) then
  6907. Exit;
  6908. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6909. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6910. if Branch = nil then
  6911. begin
  6912. ShowMessage('请在通讯录中选择组!');
  6913. Exit;
  6914. end;
  6915. if Branch.BranchName = '我的通讯录' then
  6916. begin
  6917. ShowMessage('默认组下面不允许导出联系人!');
  6918. Exit;
  6919. end;
  6920. SD.FileName := Branch.BranchName + '.csv';
  6921. GetChildsGroupId(Branch.BranchID, GroupId);
  6922. MainForm.RealICQClient.ExAddrBookUsers.Clear;
  6923. while Pos(',', GroupId) > 0 do
  6924. begin
  6925. IIndex := Pos(',', GroupId);
  6926. MainForm.RealICQClient.SendGetAddrbookUser(Copy(GroupId, 1, IIndex - 1));
  6927. sleep(200);
  6928. Delete(GroupId, 1, IIndex);
  6929. end;
  6930. MainForm.RealICQClient.SendGetAddrbookUser(GroupId);
  6931. if SD.Execute then
  6932. begin
  6933. CsvLines.SaveToFile(SD.FileName);
  6934. end;
  6935. CsvLines.Free;
  6936. CommaStr.Free;
  6937. end;
  6938. procedure TMainForm.GettedAddrBookUsers1(Sender: TObject);
  6939. var
  6940. iLoop: integer;
  6941. RealICQUser: TRealICQUser;
  6942. BranchInfo: TRealICQBranchInfo;
  6943. begin
  6944. for iLoop := MainForm.RealICQClient.ExAddrBookUsers.Count - 1 downto 0 do
  6945. begin
  6946. RealICQUser := MainForm.RealICQClient.ExAddrBookUsers.Objects[iLoop] as TRealICQUser;
  6947. CommaStr.CommaText := AnsiRePlaceStr(RealICQUser.DisplayName, ' ', '') + ',' + RealICQUser.Mobile + ',' + RealICQUser.Tel + ',' + RealICQUser.Email + ',' + RealICQUser.Remark1;
  6948. CsvLines.Add(CommaStr.CommaText);
  6949. end;
  6950. MainForm.RealICQClient.ExAddrBookUsers.Clear;
  6951. end;
  6952. //-----导入联系人---------------------------------
  6953. procedure TMainForm.spbImportGroupUserClick(Sender: TObject);
  6954. var
  6955. ItemIndex: Integer;
  6956. RealICQContacterTreeView: TRealICQContacterTreeView;
  6957. Branch: TRealICQBranch;
  6958. begin
  6959. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6960. if (ItemIndex < 0) then
  6961. Exit;
  6962. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6963. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6964. if Branch = nil then
  6965. begin
  6966. ShowMessage('请在通讯录中选择组!');
  6967. Exit;
  6968. end;
  6969. if ImportGuideFrom = nil then
  6970. ImportGuideFrom := TImportGuideFrom.Create(self);
  6971. ImportGuideFrom.SelBranch := Branch;
  6972. ImportGuideFrom.Show;
  6973. ForceForeGroundWindow(ImportGuideFrom.Handle);
  6974. end;
  6975. //-----得到指定通讯录组的所有子节点ID----------------------------------
  6976. procedure TMainForm.GetChildsGroupId(GroupId: string; var Groups: string);
  6977. var
  6978. iLoop: Integer;
  6979. BranchInfo: TRealICQBranchInfo;
  6980. begin
  6981. if Groups <> '' then
  6982. Groups := Groups + ',';
  6983. Groups := Groups + GroupId;
  6984. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6985. begin
  6986. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6987. if BranchInfo.ParentID = GroupId then
  6988. GetChildsGroupId(BranchInfo.ID, Groups);
  6989. end;
  6990. end;
  6991. //----剪切-----------------------------------------------------------
  6992. procedure TMainForm.miCutClick(Sender: TObject);
  6993. var
  6994. ItemIndex: Integer;
  6995. Employee: TRealICQEmployee;
  6996. Branch: TRealICQBranch;
  6997. RealICQContacterTreeView: TRealICQContacterTreeView;
  6998. begin
  6999. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7000. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7001. if FCutNode <> nil then
  7002. begin
  7003. if FCutNode.StateIndex = 0 then
  7004. begin
  7005. Branch := FCutNode.Data;
  7006. Branch.IsCutState := False;
  7007. Branch.Update;
  7008. end
  7009. else
  7010. begin
  7011. Employee := FCutNode.Data;
  7012. Employee.IsCutState := False;
  7013. Employee.Update;
  7014. end;
  7015. end;
  7016. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7017. if Employee <> nil then
  7018. begin
  7019. Employee.IsCutState := True;
  7020. Employee.Update;
  7021. FCutNode := Employee.Node;
  7022. Exit;
  7023. end;
  7024. Branch := RealICQContacterTreeView.GetSelectedBranch;
  7025. if Branch <> nil then
  7026. begin
  7027. if Branch.BranchName = '我的通讯录' then
  7028. begin
  7029. ShowMessage('默认组不允许剪切!');
  7030. Exit;
  7031. end;
  7032. Branch.IsCutState := True;
  7033. Branch.Update;
  7034. FCutNode := Branch.Node;
  7035. end;
  7036. end;
  7037. //---粘贴------------------------------------------------------------
  7038. procedure TMainForm.miPasteClick(Sender: TObject);
  7039. var
  7040. ItemIndex, EmployeeCount, iLoop: Integer;
  7041. MessageId, ParamValue, LoginName: string;
  7042. Employee, TmpEmployee: TRealICQEmployee;
  7043. SelBranch, TmpBranch, Branch: TRealICQBranch;
  7044. RealICQContacterTreeView: TRealICQContacterTreeView;
  7045. ParentNode: TTreeNode;
  7046. RealICQUser: TRealICQUser;
  7047. begin
  7048. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7049. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7050. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7051. if Employee <> nil then
  7052. begin
  7053. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(Employee.BranchID);
  7054. SelBranch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7055. end
  7056. else
  7057. SelBranch := RealICQContacterTreeView.GetSelectedBranch;
  7058. if SelBranch = nil then
  7059. Exit;
  7060. if FCutNode.StateIndex = 0 then
  7061. begin
  7062. TmpBranch := FCutNode.Data;
  7063. //判断同一级别是否存在相同的部门
  7064. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  7065. begin
  7066. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  7067. if (Branch.ParentID = SelBranch.BranchID) and (Branch.BranchName = TmpBranch.BranchName) then
  7068. begin
  7069. ShowMessage('已存在名称相同的组!');
  7070. TmpBranch.IsCutState := False;
  7071. TmpBranch.Update;
  7072. FCutNode := nil;
  7073. Exit;
  7074. end;
  7075. end;
  7076. ParentNode := TmpBranch.Node.Parent;
  7077. TmpBranch.Node.MoveTo(SelBranch.Node, naAddChild);
  7078. TmpBranch.ParentID := SelBranch.BranchID;
  7079. TmpBranch.Node.Selected := True;
  7080. TmpBranch.IsCutState := False;
  7081. TmpBranch.Update;
  7082. MessageId := IntToStr(GetTickCount);
  7083. CreateManageGroupMessage(TmpBranch.BranchID, TmpBranch.BranchName, SelBranch.BranchID, MessageId);
  7084. //发送修改组的父级ID
  7085. ParamValue := MessageId + #10 + TmpBranch.BranchName + #10 + TmpBranch.BranchID + #10 + SelBranch.BranchID + #10 + MainForm.RealICQClient.Me.LoginName;
  7086. MainForm.RealICQClient.SendAddrBookCommand(4, 0, ParamValue);
  7087. EmployeeCount := TmpBranch.EmployeeCount;
  7088. while ParentNode <> nil do
  7089. begin
  7090. TmpBranch := ParentNode.Data;
  7091. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount - EmployeeCount;
  7092. TmpBranch.Update;
  7093. ParentNode := TmpBranch.Node.Parent;
  7094. end;
  7095. ParentNode := SelBranch.Node;
  7096. while ParentNode <> nil do
  7097. begin
  7098. TmpBranch := ParentNode.Data;
  7099. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount + EmployeeCount;
  7100. TmpBranch.Update;
  7101. ParentNode := TmpBranch.Node.Parent;
  7102. end;
  7103. end
  7104. else
  7105. begin
  7106. TmpEmployee := FCutNode.Data;
  7107. if GetAddrBookUserIndex(SelBranch.BranchID, TmpEmployee.LoginName) >= 0 then
  7108. begin
  7109. ShowMessage('已存在名称相同的联系人!');
  7110. TmpEmployee.IsCutState := False;
  7111. TmpEmployee.Update;
  7112. FCutNode := nil;
  7113. Exit;
  7114. end;
  7115. MessageId := IntToStr(GetTickCount);
  7116. CreateManageGroupMemberMessage(TmpEmployee.LoginName, TmpEmployee.DisplayName, '', TmpEmployee.Mobile, TmpEmployee.Tel, TmpEmployee.EmailHint, '', SelBranch.BranchID, MessageId);
  7117. //发送修改联系人所属组消息
  7118. LoginName := TmpEmployee.LoginName;
  7119. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  7120. ParamValue := MessageId + #10 + LoginName + #10 + TmpEmployee.DisplayName + #10 + TmpEmployee.Mobile + #10 + '' + #10 + '' + #10 + TmpEmployee.BranchID + #10 + '' + #10 + SelBranch.BranchId;
  7121. MainForm.RealICQClient.SendAddrBookCommand(5, 1, ParamValue);
  7122. end;
  7123. end;
  7124. //----得到父级的所有组名称---------------------------------------------
  7125. procedure TMainForm.GetParentGroupNameList(BranchInfo: TRealICQBranchInfo; var Groups: string);
  7126. var
  7127. iLoop: Integer;
  7128. TmpBranchInfo: TRealICQBranchInfo;
  7129. begin
  7130. Groups := BranchInfo.BranchName + '\' + Groups;
  7131. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7132. begin
  7133. TmpBranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7134. if BranchInfo.ParentID = TmpBranchInfo.ID then
  7135. GetParentGroupNameList(TmpBranchInfo, Groups);
  7136. end;
  7137. end;
  7138. //----创建管理组消息
  7139. procedure TMainForm.CreateManageGroupMessage(GroupId, GroupName, ParentId, MessageId: string);
  7140. var
  7141. ManageGroupMessage: TManageGroupMessage;
  7142. begin
  7143. ManageGroupMessage := TManageGroupMessage.Create;
  7144. ManageGroupMessage.MessageId := MessageId;
  7145. ManageGroupMessage.FGroupID := GroupId;
  7146. ManageGroupMessage.FGroupName := GroupName;
  7147. ManageGroupMessage.FParentID := ParentId;
  7148. FManageGroupMsgList.AddObject(ManageGroupMessage.MessageId, ManageGroupMessage);
  7149. end;
  7150. //----创建管理联系人消息
  7151. procedure TMainForm.CreateManageGroupMemberMessage(ID, DisplayName, NickName, Mobile, Tel, Email, Remark, GroupId, MessageId: string);
  7152. var
  7153. ManageGroupMemberMessage: TManageGroupMemberMessage;
  7154. begin
  7155. ManageGroupMemberMessage := TManageGroupMemberMessage.Create;
  7156. ManageGroupMemberMessage.MessageId := MessageId;
  7157. ManageGroupMemberMessage.FID := Id;
  7158. ManageGroupMemberMessage.FDisplayName := DisplayName;
  7159. ManageGroupMemberMessage.FNickName := NickName;
  7160. ManageGroupMemberMessage.FMobile := Mobile;
  7161. ManageGroupMemberMessage.FTel := Tel;
  7162. ManageGroupMemberMessage.FEmail := Email;
  7163. ManageGroupMemberMessage.FRemark := Remark;
  7164. ManageGroupMemberMessage.FGroupId := GroupId;
  7165. FManageGroupMemberMsgList.AddObject(ManageGroupMemberMessage.MessageId, ManageGroupMemberMessage);
  7166. end;
  7167. //----------------------------------------------------------
  7168. procedure TMainForm.GettedManageAddrBookResult(Sender: TObject; OperatModal: Integer; OperatCommand: Integer; RetValue, MessageId: Cardinal);
  7169. var
  7170. Branch: TRealICQBranch;
  7171. RealICQBranch: TRealICQBranchInfo;
  7172. RealICQUser, TmpRealICQUser: TRealICQUser;
  7173. TreeViewIndex, ItemIndex, iLoop, i, jLoop: Integer;
  7174. RealICQContacterTreeView: TRealICQContacterTreeView;
  7175. ManageGroupMessage: TManageGroupMessage;
  7176. ManageGroupMemberMsg: TManageGroupMemberMessage;
  7177. TmpList, TmpDelUsers: TStringList;
  7178. Employee, TmpEmployee: TRealICQEmployee;
  7179. ErrMsg, TmpUsers: string;
  7180. begin
  7181. try
  7182. TreeViewIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7183. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[TreeViewIndex] as TRealICQContacterTreeView;
  7184. if RetValue = -1 then
  7185. begin
  7186. case OperatCommand of
  7187. 1:
  7188. ErrMsg := '新建';
  7189. 2:
  7190. ErrMsg := '修改';
  7191. 3:
  7192. ErrMsg := '删除';
  7193. 4:
  7194. ErrMsg := '批量添加';
  7195. end;
  7196. if OperatModal = 0 then
  7197. begin
  7198. if OperatCommand = 4 then
  7199. ErrMsg := '粘贴';
  7200. ErrMsg := ErrMsg + '组失败';
  7201. end
  7202. else
  7203. begin
  7204. ErrMsg := ErrMsg + '联系人失败';
  7205. if OperatCommand = 5 then
  7206. ErrMsg := '粘贴联系人失败';
  7207. if OperatCommand = 6 then
  7208. ErrMsg := '修改联系人备注失败';
  7209. end;
  7210. ShowMessage(ErrMsg);
  7211. Exit;
  7212. end;
  7213. if OperatModal = 0 then //对组操作
  7214. begin
  7215. i := FManageGroupMsgList.IndexOf(IntToStr(MessageId));
  7216. ManageGroupMessage := FManageGroupMsgList.Objects[i] as TManageGroupMessage;
  7217. case OperatCommand of
  7218. 1:
  7219. begin //增加组
  7220. Branch := TRealICQBranch.Create(ManageGroupMessage.FGroupName);
  7221. Branch.BranchID := IntToStr(RetValue);
  7222. Branch.ParentID := ManageGroupMessage.FGroupID;
  7223. RealICQBranch := TRealICQBranchInfo.Create;
  7224. RealICQBranch.ID := IntToStr(RetValue);
  7225. RealICQBranch.ParentID := ManageGroupMessage.FGroupID;
  7226. RealICQBranch.BranchName := ManageGroupMessage.FGroupName;
  7227. RealICQContacterTreeView.AddBranch(Branch);
  7228. MainForm.RealICQClient.AddrBookGroups.AddObject(RealICQBranch.ID, RealICQBranch);
  7229. Branch.Node.Selected := True;
  7230. end;
  7231. 2:
  7232. begin //修改组
  7233. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(ManageGroupMessage.FGroupID);
  7234. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7235. Branch.BranchName := ManageGroupMessage.FGroupName;
  7236. Branch.Update;
  7237. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(ManageGroupMessage.FGroupID);
  7238. RealICQBranch := MainForm.RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7239. RealICQBranch.BranchName := ManageGroupMessage.FGroupName;
  7240. end;
  7241. 3:
  7242. begin //删除组
  7243. try
  7244. TmpList := SplitString(ManageGroupMessage.FGroupID, ',');
  7245. for iLoop := 0 to TmpList.Count - 1 do
  7246. begin
  7247. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(TmpList[iLoop]);
  7248. if ItemIndex >= 0 then
  7249. begin
  7250. MainForm.RealICQClient.AddrBookGroups.Delete(ItemIndex);
  7251. ItemIndex := GetGroupUsers(TmpList[iLoop]);
  7252. while ItemIndex >= 0 do
  7253. begin
  7254. MainForm.RealICQClient.AddrBookUsers.Delete(ItemIndex);
  7255. ItemIndex := GetGroupUsers(TmpList[iLoop]);
  7256. end;
  7257. end;
  7258. end;
  7259. RealICQContacterTreeView.Clear;
  7260. FreeAndNil(RealICQContacterTreeView);
  7261. MainForm.ContacterTreeViews.Delete(TreeViewIndex);
  7262. MainForm.AddContacterTreeView(ScrollBoxAddrBook, LVAddrBook);
  7263. LoadAddrBook(ManageGroupMessage.FParentId);
  7264. TreeViewIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7265. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[TreeViewIndex] as TRealICQContacterTreeView;
  7266. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(ManageGroupMessage.FParentID);
  7267. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7268. while Branch.ParentID <> '0' do
  7269. begin
  7270. NodeGroupClick(nil, Branch);
  7271. Branch := Branch.Node.Parent.Data;
  7272. end;
  7273. finally
  7274. if TmpList <> nil then
  7275. TmpList.Free;
  7276. if TmpDelUsers <> nil then
  7277. TmpDelUsers.Free;
  7278. end;
  7279. end;
  7280. 4:
  7281. begin //剪切粘贴
  7282. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(ManageGroupMessage.FGroupID);
  7283. RealICQBranch := MainForm.RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7284. RealICQBranch.ParentID := ManageGroupMessage.FParentID;
  7285. end;
  7286. end;
  7287. FManageGroupMsgList.Delete(i);
  7288. end
  7289. else //对联系人操作
  7290. begin
  7291. i := FManageGroupMemberMsgList.IndexOf(IntToStr(MessageId));
  7292. ManageGroupMemberMsg := FManageGroupMemberMsgList.Objects[i] as TManageGroupMemberMessage;
  7293. case OperatCommand of
  7294. 1:
  7295. begin //新增联系人
  7296. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7297. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7298. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + 1;
  7299. //---------------------------------------------
  7300. RealICQUser := TRealICQUser.Create(IntToStr(RetValue), MainForm.RealICQClient);
  7301. RealICQUser.LoginName := IntToStr(RetValue);
  7302. RealICQUser.DisplayName := ManageGroupMemberMsg.FDisplayName;
  7303. RealICQUser.Remark := ManageGroupMemberMsg.FNickName;
  7304. RealICQUser.Mobile := ManageGroupMemberMsg.FMobile;
  7305. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7306. RealICQUser.Tel := ManageGroupMemberMsg.FTel;
  7307. RealICQUser.Email := ManageGroupMemberMsg.FEmail;
  7308. RealICQUser.Remark1 := ManageGroupMemberMsg.FRemark;
  7309. MainForm.RealICQClient.AddrBookUsers.AddObject(RealICQUser.LoginName, RealICQUser);
  7310. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7311. Employee.BranchID := RealICQUser.BranchID;
  7312. Employee.DisplayName := RealICQUser.DisplayName;
  7313. Employee.Mobile := RealICQUser.Mobile;
  7314. Employee.HasSMS := (Length(RealICQUser.Mobile) > 0);
  7315. Employee.SMSHint := RealICQUser.Mobile;
  7316. Employee.HasEmail := False;
  7317. Employee.HasAddFreindButton := False;
  7318. RealICQContacterTreeView.AddEmployee(Employee);
  7319. Employee.Node.Selected := True;
  7320. end;
  7321. 2:
  7322. begin //修改联系人
  7323. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7324. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7325. Employee.DisplayName := ManageGroupMemberMsg.FDisplayName;
  7326. Employee.Mobile := ManageGroupMemberMsg.FMobile;
  7327. Employee.SMSHint := ManageGroupMemberMsg.FMobile;
  7328. Employee.HasSMS := (Length(ManageGroupMemberMsg.FMobile) > 0);
  7329. Employee.Update;
  7330. end;
  7331. 3:
  7332. begin //删除联系人
  7333. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7334. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7335. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount - 1;
  7336. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7337. if ItemIndex >= 0 then
  7338. begin
  7339. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7340. RealICQUser := GetAddrBookUser(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7341. RealICQClient.AddrBookUsers.Delete(RealICQClient.AddrBookUsers.IndexOfObject(RealICQUser));
  7342. end;
  7343. end;
  7344. 4:
  7345. begin //批量添加联系人
  7346. TmpList := SplitString(ManageGroupMemberMsg.FId, ',');
  7347. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7348. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7349. RealICQBranch.IsGetUserList := True;
  7350. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + TmpList.Count;
  7351. for iLoop := 0 to TmpList.Count - 1 do
  7352. begin
  7353. if GetAddrBookUser(ManageGroupMemberMsg.FGroupId, TmpList[iLoop]) = nil then
  7354. begin
  7355. ItemIndex := MainForm.RealICQClient.MoreUsers.IndexOf(TmpList[iLoop]);
  7356. if ItemIndex >= 0 then
  7357. RealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser
  7358. else
  7359. begin
  7360. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(TmpList[iLoop]);
  7361. end;
  7362. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7363. Employee.BranchID := ManageGroupMemberMsg.FGroupId;
  7364. Employee.DisplayName := RealICQUser.DisplayName;
  7365. Employee.Mobile := RealICQUser.Mobile;
  7366. Employee.HasSMS := (Length(RealICQUser.Mobile) > 0);
  7367. Employee.EmailHint := RealICQUser.Email;
  7368. Employee.SMSHint := RealICQUser.Mobile;
  7369. Employee.HasEmail := False;
  7370. Employee.HasAddFreindButton := False;
  7371. RealICQContacterTreeView.AddEmployee(Employee);
  7372. Employee.Node.Selected := True;
  7373. end;
  7374. end;
  7375. for iLoop := TmpList.Count - 1 downto 0 do
  7376. begin
  7377. ItemIndex := MainForm.RealICQClient.MoreUsers.IndexOf(TmpList[iLoop]);
  7378. if ItemIndex >= 0 then
  7379. RealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser
  7380. else
  7381. begin
  7382. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(TmpList[iLoop]);
  7383. end;
  7384. TmpRealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser;
  7385. RealICQUser := TRealICQUser.Create(TmpList[iLoop], RealICQClient);
  7386. RealICQUser.LoginName := TmpRealICQUser.LoginName;
  7387. RealICQUser.DisplayName := TmpRealICQUser.DisplayName;
  7388. RealICQUser.Mobile := TmpRealICQUser.Mobile;
  7389. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7390. RealICQUser.Tel := TmpRealICQUser.Tel;
  7391. //RealICQUser.Email:=RealICQUser.EmailHint;
  7392. MainForm.RealICQClient.AddrBookUsers.AddObject(RealICQUser.LoginName, RealICQUser);
  7393. end;
  7394. end;
  7395. 5:
  7396. begin
  7397. TmpEmployee := FCutNode.Data;
  7398. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7399. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7400. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + 1;
  7401. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(TmpEmployee.BranchID);
  7402. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7403. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount - 1;
  7404. ItemIndex := GetAddrBookUserIndex(TmpEmployee.BranchID, TmpEmployee.LoginName);
  7405. Employee := TRealICQEmployee.Create(TmpEmployee.LoginName);
  7406. Employee.BranchID := ManageGroupMemberMsg.FGroupId;
  7407. Employee.DisplayName := TmpEmployee.DisplayName;
  7408. Employee.Tel := TmpEmployee.Tel;
  7409. Employee.Mobile := TmpEmployee.Mobile;
  7410. RealICQContacterTreeView.AddEmployee(Employee);
  7411. RealICQUser := GetAddrBookUser(TmpEmployee.BranchID, TmpEmployee.LoginName);
  7412. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7413. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7414. Employee.Node.Selected := True;
  7415. end;
  7416. 6:
  7417. begin
  7418. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7419. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7420. if Employee <> nil then
  7421. begin
  7422. Employee.DisplayName := ManageGroupMemberMsg.FRemark;
  7423. Employee.Update;
  7424. end;
  7425. end;
  7426. end;
  7427. FManageGroupMemberMsgList.Delete(i);
  7428. end;
  7429. finally
  7430. if FCutNode <> nil then
  7431. FCutNode := nil;
  7432. end;
  7433. end;
  7434. //------得到联系人-----------------------------
  7435. function TMainForm.GetAddrBookUser(GroupId, LoginName: string): TRealICQUser;
  7436. var
  7437. iLoop: Integer;
  7438. RealICQUser: TRealICQUser;
  7439. begin
  7440. Result := nil;
  7441. for iLoop := 0 to MainForm.RealICQClient.AddrBookUsers.Count - 1 do
  7442. begin
  7443. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7444. if (RealICQUser.BranchID = GroupId) and (RealICQUser.LoginName = LoginName) then
  7445. begin
  7446. Result := RealICQUser;
  7447. Break;
  7448. end;
  7449. end;
  7450. end;
  7451. //------得到联系人的下标------------------------------
  7452. function TMainForm.GetAddrBookUserIndex(GroupId, LoginName: string): Integer;
  7453. var
  7454. iLoop: Integer;
  7455. Employee: TRealICQEmployee;
  7456. RealICQContacterTreeView: TRealICQContacterTreeView;
  7457. begin
  7458. Result := -1;
  7459. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[MainForm.ContacterTreeViews.IndexOf(LVAddrBook)] as TRealICQContacterTreeView;
  7460. for iLoop := 0 to RealICQContacterTreeView.EmployeeItems.Count - 1 do
  7461. begin
  7462. Employee := RealICQContacterTreeView.EmployeeItems.Objects[iLoop] as TRealICQEmployee;
  7463. if (Employee.BranchID = GroupId) and (Employee.LoginName = LoginName) then
  7464. begin
  7465. Result := iLoop;
  7466. break;
  7467. end;
  7468. end;
  7469. end;
  7470. //-----得到联系人总的人数------------------
  7471. function TMainForm.GetGroupUserCount: Integer;
  7472. var
  7473. iLoop, ItemIndex: Integer;
  7474. TmpBranch: TRealICQBranch;
  7475. RealICQContacterTreeView: TRealICQContacterTreeView;
  7476. begin
  7477. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7478. if ItemIndex < 0 then
  7479. Exit;
  7480. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7481. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  7482. begin
  7483. TmpBranch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  7484. if TmpBranch.ParentID = '0' then
  7485. begin
  7486. Result := TmpBranch.EmployeeCount;
  7487. break;
  7488. end;
  7489. end;
  7490. end;
  7491. //-------------------------显示联系人-------
  7492. procedure TMainForm.GettedAddrBookUsers(Sender: TObject);
  7493. var
  7494. iLoop, ItemIndex: Integer;
  7495. RealICQContacterTreeView: TRealICQContacterTreeView;
  7496. RealICQUser: TRealICQUser;
  7497. TmpBranch: TRealICQBranch;
  7498. Employee: TRealICQEmployee;
  7499. ParentNode: TTreeNode;
  7500. BranchInfo: TRealICQBranchInfo;
  7501. begin
  7502. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7503. if ItemIndex < 0 then
  7504. Exit;
  7505. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7506. RealICQContacterTreeView.AdjustPosition := False;
  7507. RealICQContacterTreeView.HideSystemScrollBar;
  7508. RealICQContacterTreeView.BeginUpdate;
  7509. TmpBranch := nil;
  7510. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载联系人');
  7511. if ItemIndex >= 0 then
  7512. begin
  7513. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7514. TmpBranch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(Employee.BranchID)] as TRealICQBranch;
  7515. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7516. BranchInfo := RealICQClient.AddrBookGroups.Objects[RealICQClient.AddrBookGroups.IndexOf(TmpBranch.BranchID)] as TRealICQBranchInfo;
  7517. BranchInfo.IsGetUserList := True;
  7518. end;
  7519. {$region '添加联系人'}
  7520. for iLoop := MainForm.RealICQClient.AddrBookUsers.Count - 1 downto 0 do
  7521. begin
  7522. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7523. if GetAddrBookUserIndex(RealICQUser.BranchID, RealICQUser.LoginName) >= 0 then
  7524. Continue;
  7525. if RealICQUser.BranchID <> TmpBranch.BranchID then
  7526. Continue;
  7527. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7528. Employee.BranchID := RealICQUser.BranchID;
  7529. Employee.Mobile := RealICQUser.Mobile;
  7530. Employee.HasSMS := Length(RealICQUser.Mobile) > 0;
  7531. Employee.SMSHint := RealICQUser.Mobile;
  7532. Employee.HasEmail := False;
  7533. if Trim(RealICQUser.Remark) <> '' then
  7534. Employee.DisplayName := RealICQUser.Remark
  7535. else
  7536. Employee.DisplayName := RealICQUser.DisplayName;
  7537. Employee.HasAddFreindButton := False;
  7538. RealICQContacterTreeView.AddEmployee(Employee);
  7539. end;
  7540. {$endregion}
  7541. if TmpBranch <> nil then
  7542. begin
  7543. ParentNode := TmpBranch.Node;
  7544. while ParentNode <> nil do
  7545. begin
  7546. ParentNode.Expanded := True;
  7547. ParentNode := ParentNode.Parent;
  7548. end;
  7549. TmpBranch.Node.Selected := True;
  7550. TmpBranch.IsGetUserList := True;
  7551. end;
  7552. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  7553. RealICQContacterTreeView.MoveScrollBarToTop;
  7554. RealICQContacterTreeView.EndUpdate;
  7555. end;
  7556. //----------显示组-------------------------
  7557. procedure TMainForm.GettedAddrBookGroups(Sender: TObject);
  7558. begin
  7559. LoadAddrBook('0');
  7560. end;
  7561. //-------------------------------------------------------------------------
  7562. procedure TMainForm.LoadAddrBook(ExpandGroupId: string);
  7563. var
  7564. iLoop, ItemIndex: Integer;
  7565. RealICQContacterTreeView: TRealICQContacterTreeView;
  7566. RealICQUser: TRealICQUser;
  7567. BranchInfo: TRealICQBranchInfo;
  7568. Branch, TmpBranch: TRealICQBranch;
  7569. Employee: TRealICQEmployee;
  7570. ParentNode: TTreeNode;
  7571. BranchId: string;
  7572. OnlineEmployee, EmployeeCount: Integer;
  7573. begin
  7574. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7575. if ItemIndex < 0 then
  7576. Exit;
  7577. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7578. RealICQContacterTreeView.OnItemOnline := nil;
  7579. RealICQContacterTreeView.OnItemOffline := nil;
  7580. RealICQContacterTreeView.OnItemIconButtonClick := nil;
  7581. RealICQContacterTreeView.OnItemMouseEnter := nil;
  7582. RealICQContacterTreeView.OnItemMouseLeave := nil;
  7583. RealICQContacterTreeView.ShowOnlineNumber := False;
  7584. RealICQContacterTreeView.ShowLoginState := False;
  7585. RealICQContacterTreeView.PopupMenu := ppAddrbookList;
  7586. RealICQContacterTreeView.AdjustPosition := False;
  7587. RealICQContacterTreeView.HideSystemScrollBar;
  7588. RealICQContacterTreeView.BeginUpdate;
  7589. TmpBranch := nil;
  7590. {$region '添加组'}
  7591. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7592. begin
  7593. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7594. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  7595. Continue;
  7596. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  7597. Branch.BranchID := BranchInfo.ID;
  7598. Branch.ParentID := BranchInfo.ParentID;
  7599. Branch.IsGetUserList := False;
  7600. OnlineEmployee := 0;
  7601. EmployeeCount := 0;
  7602. GetBranchEmpOnlineAndSum(RealICQClient.AddrBookGroups, BranchInfo, OnlineEmployee, EmployeeCount);
  7603. Branch.EmployeeCount := EmployeeCount;
  7604. Branch.OnlineEmployee := 0;
  7605. RealICQContacterTreeView.AddBranch(Branch);
  7606. if ExpandGroupId = '0' then
  7607. begin
  7608. BranchId := Branch.ParentID;
  7609. end
  7610. else
  7611. BranchId := Branch.BranchID;
  7612. if BranchId = ExpandGroupId then
  7613. begin
  7614. TmpBranch := Branch;
  7615. end;
  7616. end;
  7617. RealICQContacterTreeView.ReAlignBranchs;
  7618. {$endregion}
  7619. if TmpBranch <> nil then
  7620. begin
  7621. ParentNode := TmpBranch.Node;
  7622. while ParentNode <> nil do
  7623. begin
  7624. ParentNode.Expanded := True;
  7625. ParentNode := ParentNode.Parent;
  7626. end;
  7627. TmpBranch.Node.Selected := True;
  7628. end;
  7629. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  7630. RealICQContacterTreeView.MoveScrollBarToTop;
  7631. RealICQContacterTreeView.EndUpdate;
  7632. ScrollBoxAddrBook.Visible := True;
  7633. end;
  7634. //----------------------------------------------
  7635. procedure TMainForm.NodeGroupClick(Sender: TObject; Group: TRealICQBranch);
  7636. var
  7637. RealICQContacterTreeView: TRealICQContacterTreeView;
  7638. ItemIndex: Integer;
  7639. Employee: TRealICQEmployee;
  7640. BranchInfo: TRealICQBranchInfo;
  7641. begin
  7642. //-------获取指定部门下的用户------------------------------------------------
  7643. if (not Group.IsGetUserList) and (Group.Node.Parent <> nil) then
  7644. begin
  7645. MainForm.RealICQClient.OnGettedAddrBookUsers := GettedAddrBookUsers;
  7646. ItemIndex := FContacterTreeViews.IndexOf(LVAddrBook);
  7647. if ItemIndex < 0 then
  7648. exit;
  7649. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7650. if RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载联系人') < 0 then
  7651. begin
  7652. RealICQContacterTreeView.ReCalculateEmployeeCount(Group);
  7653. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[MainForm.RealICQClient.AddrBookGroups.IndexOf(Group.BranchID)] as TRealICQBranchInfo;
  7654. Employee := TRealICQEmployee.Create('正在下载联系人');
  7655. Employee.BranchID := Group.BranchID;
  7656. RealICQContacterTreeView.AddEmployee(Employee);
  7657. if (BranchInfo.IsGetUserList) then
  7658. begin
  7659. GettedAddrBookUsers(nil);
  7660. end
  7661. else
  7662. begin
  7663. MainForm.RealICQClient.SendGetAddrbookUser(Group.BranchID);
  7664. end;
  7665. end;
  7666. Group.Node.Expanded := True;
  7667. end;
  7668. end;
  7669. //---------------------------------------------------------------------------
  7670. function TMainForm.GetGroupUsers(GroupId: string): Integer;
  7671. var
  7672. iLoop: Integer;
  7673. RealICQUser: TRealICQUser;
  7674. begin
  7675. Result := -1;
  7676. for iLoop := 0 to MainForm.RealICQClient.AddrBookUsers.Count - 1 do
  7677. begin
  7678. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7679. if RealICQUser.BranchID = GroupId then
  7680. begin
  7681. Result := iLoop;
  7682. end;
  7683. end;
  7684. end;
  7685. {通讯录}
  7686. procedure TMainForm.tsCustomerServiceContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
  7687. begin
  7688. end;
  7689. //------------
  7690. procedure TMainForm.tsNetWorkDiskShow(Sender: TObject);
  7691. begin
  7692. if RealICQClient.NetWorkDiskServerPort <= 0 then
  7693. begin
  7694. lblNDState.Caption := '没有服务器';
  7695. end
  7696. else
  7697. begin
  7698. if (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) then
  7699. begin
  7700. spbNDConnectClick(spbNDConnect);
  7701. end
  7702. else if not AnsiSameText(RealICQNetWorkDiskClient.LoginName, RealICQClient.LoginName) then
  7703. begin
  7704. RealICQNetWorkDiskClient.Logout;
  7705. spbNDConnectClick(spbNDConnect);
  7706. end;
  7707. end;
  7708. end;
  7709. //------------------------------------------------------------------------------
  7710. procedure TMainForm.WebBrowserAddrBookBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7711. begin
  7712. //
  7713. end;
  7714. procedure TMainForm.WebBrowserAddrBookDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  7715. begin
  7716. //
  7717. end;
  7718. procedure TMainForm.WebBrowserForAdvertisementBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7719. begin
  7720. if not AnsiSameText(URL, MainForm.RealICQClient.MainFormAdversement.URL) then
  7721. begin
  7722. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar('"' + string(URL) + '"'), '', SW_SHOWNORMAL);
  7723. Cancel := True;
  7724. end;
  7725. end;
  7726. //------------------------------------------------------------------------------
  7727. procedure TMainForm.WebBrowserForAdvertisementDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  7728. begin
  7729. try
  7730. WebBrowserForAdvertisement.OnDocumentComplete := nil;
  7731. WebBrowserForAdvertisement.OnBeforeNavigate2 := WebBrowserForAdvertisementBeforeNavigate2;
  7732. SetDomStyle(WebBrowserForAdvertisement.Document as IHtmlDocument2);
  7733. except
  7734. end;
  7735. pnlForHideWebBrowser.Visible := False;
  7736. pnlAdvertisement.Top := pnlWebSearch.Top - 1;
  7737. pnlAdvertisement.Height := RealICQClient.MainFormAdversement.Height + 2;
  7738. pnlWebSearch.Top := pnlAdvertisement.Top + pnlAdvertisement.Height + 1;
  7739. ClearMemory;
  7740. end;
  7741. //------------------------------------------------------------------------------
  7742. procedure TMainForm.WebBrowserForContactersBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7743. var
  7744. NewUrl: string;
  7745. Args: string;
  7746. ArgList: TStringList;
  7747. AForm: TForm;
  7748. index: Integer;
  7749. begin
  7750. NewUrl := URL;
  7751. if AnsiSameText(Copy(NewUrl, 1, 18), 'OpenTalkingForm://') then
  7752. begin
  7753. Cancel := True;
  7754. Args := Copy(NewUrl, 19, Length(NewUrl) - 19);
  7755. if AnsiSameText(Args, RealICQClient.Me.LoginName) then
  7756. begin
  7757. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  7758. Exit;
  7759. end;
  7760. OpenTalkingForm(Args, True);
  7761. Exit;
  7762. end;
  7763. if AnsiSameText(Copy(NewUrl, 1, 12), 'AddFriend://') then
  7764. begin
  7765. Cancel := True;
  7766. Args := Copy(NewUrl, 13, Length(NewUrl) - 13);
  7767. if AnsiSameText(Args, RealICQClient.Me.LoginName) then
  7768. begin
  7769. MessageBox(Handle, '对不起,不可以加自己为好友!', '提示', MB_ICONINFORMATION);
  7770. Exit;
  7771. end;
  7772. if TUsersService.GetUsersService.IsWorkmateOrFriend(Args) then
  7773. begin
  7774. MessageBox(Handle, PChar('用户 ' + Args + ' 已在您的好友列表中!'), '提示', MB_ICONINFORMATION);
  7775. Exit;
  7776. end;
  7777. ShowAddFriendWindow(Self, Args, '');
  7778. Exit;
  7779. end;
  7780. end;
  7781. //------------------------------------------------------------------------------
  7782. procedure TMainForm.ppLanguagesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  7783. begin
  7784. ChangePPMenuColorMap(ppLanguages.PopupMenu);
  7785. end;
  7786. //------------------------------------------------------------------------------
  7787. procedure TMainForm.miLanguageClick(Sender: TObject);
  7788. var
  7789. MenuItem: TMenuItem;
  7790. begin
  7791. MenuItem := Sender as TMenuItem;
  7792. ChangeLanguage(ExtractFilePath(Application.ExeName) + 'Languages\' + AnsiReplaceStr(MenuItem.Caption, '&', '') + '.ini');
  7793. end;
  7794. procedure TMainForm.miLeaveClick(Sender: TObject);
  7795. begin
  7796. FLoginState := stLeave;
  7797. FLeaveMessage := '离开';
  7798. SetLoginStateControlState;
  7799. end;
  7800. //------------------------------------------------------------------------------
  7801. procedure TMainForm.ppLanguagesPopup(Sender: TObject);
  7802. var
  7803. MenuItem: TMenuItem;
  7804. procedure FindLanguages(APath: string);
  7805. var
  7806. DSearchRec: TSearchRec;
  7807. FindResult: Integer;
  7808. begin
  7809. ppLanguages.Items.Clear;
  7810. FindResult := FindFirst(APath + '*.ini', faAnyFile, DSearchRec);
  7811. while FindResult = 0 do
  7812. begin
  7813. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  7814. if (DSearchRec.Attr and faDirectory) <> faDirectory then
  7815. begin
  7816. MenuItem := TMenuItem.Create(ppLanguages);
  7817. MenuItem.AutoHotkeys := maManual;
  7818. MenuItem.AutoLineReduction := maManual;
  7819. MenuItem.Caption := AnsiReplaceText(DSearchRec.Name, '.ini', '') + '&';
  7820. MenuItem.OnClick := miLanguageClick;
  7821. MenuItem.RadioItem := True;
  7822. MenuItem.AutoCheck := True;
  7823. MenuItem.Enabled := Language <> AnsiReplaceText(DSearchRec.Name, '.ini', '');
  7824. MenuItem.Checked := Language = AnsiReplaceText(DSearchRec.Name, '.ini', '');
  7825. ppLanguages.Items.Insert(0, MenuItem);
  7826. end;
  7827. FindResult := FindNext(DSearchRec);
  7828. end;
  7829. end;
  7830. begin
  7831. FindLanguages(ExtractFilePath(Application.ExeName) + 'Languages\');
  7832. end;
  7833. //------------------------------------------------------------------------------
  7834. procedure TMainForm.Post(stURL, stPostData: string; var wbWebBrowser: TWebBrowser);
  7835. var
  7836. vWebAddr, vPostData, vFlags, vFrame, vHeaders: OleVariant;
  7837. iLoop: Integer;
  7838. begin
  7839. {Are we posting data to this Url?}
  7840. if Length(stPostData) > 0 then
  7841. begin
  7842. {头信息当PostData使.}
  7843. vHeaders := 'Content-Type: application/x-www-form-urlencoded' + #10#13#0;
  7844. vPostData := VarArrayCreate([0, Length(stPostData)], varByte);
  7845. for iLoop := 0 to Length(stPostData) - 1 do
  7846. begin
  7847. vPostData[iLoop] := Ord(stPostData[iLoop + 1]);
  7848. end;
  7849. {结束字符}
  7850. vPostData[Length(stPostData)] := 0;
  7851. {Set the type of Variant, cast}
  7852. TVarData(vPostData).vType := varArray;
  7853. end;
  7854. vWebAddr := stURL;
  7855. wbWebBrowser.Navigate2(vWebAddr, vFlags, vFrame, vPostData, vHeaders);
  7856. end;
  7857. //------------------------------------------------------------------------------
  7858. procedure TMainForm.ChangeLanguage(ALanguageIniFile: string);
  7859. var
  7860. IniFile: TIniFile;
  7861. iLoop: Integer;
  7862. OldLVAddrbook, OldLVSystemMessage, OldLVMyContacters, OldLVMoreUsers, OldLVFriends, OldLVStrangers, OldLVBlacklists, OldLVLatests, OldLVTeams, OldLVSearch: string;
  7863. begin
  7864. inherited ChangeLanguage(ALanguageIniFile);
  7865. RealICQClient.ChangeLanguage(ALanguageIniFile);
  7866. IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Languages\' + Language + '.ini');
  7867. try
  7868. {$region}
  7869. with IniFile do
  7870. begin
  7871. OldLVSystemMessage := LVSystemMessage;
  7872. OldLVMyContacters := LVMyContacters;
  7873. OldLVFriends := LVFriends;
  7874. OldLVStrangers := LVStrangers;
  7875. OldLVBlacklists := LVBlacklists;
  7876. OldLVLatests := LVLatests;
  7877. OldLVTeams := LVTeams;
  7878. OldLVSearch := LVSearch;
  7879. OldLVMoreUsers := LVMoreUsers;
  7880. OldLVAddrbook := LvAddrbook;
  7881. LVSystemMessage := FilterStr(ReadString(string(Self.ClassName), 'LVSystemMessage', ''));
  7882. LVMyContacters := FilterStr(ReadString(string(Self.ClassName), 'LVMyContacters', ''));
  7883. LVMoreUsers := FilterStr(ReadString(string(Self.ClassName), 'LVMoreUser', ''));
  7884. LVFriends := FilterStr(ReadString(string(Self.ClassName), 'LVFriends', ''));
  7885. LVStrangers := FilterStr(ReadString(string(Self.ClassName), 'LVStrangers', ''));
  7886. LVBlacklists := FilterStr(ReadString(string(Self.ClassName), 'LVBlacklists', ''));
  7887. LVLatests := FilterStr(ReadString(string(Self.ClassName), 'LVLatests', ''));
  7888. LVTeams := FilterStr(ReadString(string(Self.ClassName), 'LVTeams', ''));
  7889. LVSearch := FilterStr(ReadString(string(Self.ClassName), 'LVSearch', ''));
  7890. LVAddrbook := FilterStr(ReadString(string(Self.ClassName), 'LVAddrbook', ''));
  7891. end;
  7892. {$endregion}
  7893. finally
  7894. FreeAndNil(IniFile);
  7895. end;
  7896. edWebSearchKeyWordExit(nil);
  7897. for iLoop := 0 to FContacterListViews.Count - 1 do
  7898. begin
  7899. if AnsiSameStr(OldLVSystemMessage, FContacterListViews.Strings[iLoop]) then
  7900. FContacterListViews.Strings[iLoop] := LVSystemMessage;
  7901. if AnsiSameStr(OldLVMyContacters, FContacterListViews.Strings[iLoop]) then
  7902. FContacterListViews.Strings[iLoop] := LVMyContacters;
  7903. if AnsiSameStr(OldLVFriends, FContacterListViews.Strings[iLoop]) then
  7904. FContacterListViews.Strings[iLoop] := LVFriends;
  7905. if AnsiSameStr(OldLVStrangers, FContacterListViews.Strings[iLoop]) then
  7906. FContacterListViews.Strings[iLoop] := LVStrangers;
  7907. if AnsiSameStr(OldLVAddrbook, FContacterListViews.Strings[iLoop]) then
  7908. FContacterListViews.Strings[iLoop] := LVAddrbook;
  7909. //if AnsiSameStr(OldLVBlacklists, FContacterListViews.Strings[iLoop]) then
  7910. // FContacterListViews.Strings[iLoop] := LVBlacklists;
  7911. if AnsiSameStr(OldLVLatests, FContacterListViews.Strings[iLoop]) then
  7912. FContacterListViews.Strings[iLoop] := LVLatests;
  7913. if AnsiSameStr(OldLVTeams, FContacterListViews.Strings[iLoop]) then
  7914. FContacterListViews.Strings[iLoop] := LVTeams;
  7915. if AnsiSameStr(OldLVSearch, FContacterListViews.Strings[iLoop]) then
  7916. FContacterListViews.Strings[iLoop] := LVSearch;
  7917. end;
  7918. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  7919. begin
  7920. if AnsiSameStr(OldLVMyContacters, FContacterTreeViews.Strings[iLoop]) then
  7921. FContacterTreeViews.Strings[iLoop] := LVMyContacters;
  7922. if AnsiSameStr(OldLVFriends, FContacterTreeViews.Strings[iLoop]) then
  7923. FContacterTreeViews.Strings[iLoop] := LVFriends;
  7924. if AnsiSameStr(OldLVMoreUsers, FContacterTreeViews.Strings[iLoop]) then
  7925. FContacterTreeViews.Strings[iLoop] := LVMoreUsers;
  7926. if AnsiSameStr(OldLVAddrbook, FContacterTreeViews.Strings[iLoop]) then
  7927. FContacterTreeViews.Strings[iLoop] := LVAddrbook;
  7928. end;
  7929. if (RealICQClient.Logined and RealICQClient.Connected and pnlWorkArea.Visible) then
  7930. begin
  7931. ShowGroupInterface;
  7932. end;
  7933. edFilterKeyword.Text := '';
  7934. edFilterKeywordExit(edFilterKeyword);
  7935. SetUIState;
  7936. end;
  7937. //------------------------------------------------------------------------------
  7938. procedure TMainForm.SetLoginControlsVisible(Value: Boolean);
  7939. begin
  7940. lblLoginNameTitle.Visible := Value;
  7941. spLoginNameBorder.Visible := Value;
  7942. spbChangeLoginName.Visible := Value;
  7943. edLoginName.Visible := Value;
  7944. lblPasswordTitle.Visible := Value;
  7945. spPasswordBorder.Visible := Value;
  7946. edPassword.Visible := Value;
  7947. lblLoginStateTitle.Visible := Value;
  7948. spbLoginState.Visible := Value;
  7949. spbSavePassword.Visible := Value;
  7950. spbAutoLogin.Visible := Value;
  7951. btnCALogin.Visible := GetCaConfig.GetEnable and Value;
  7952. btLogin.Visible := Value;
  7953. lblRemoveMyLoginInfo.Visible := Value and RealICQClient.SavedPassword;
  7954. lblPasswordTitle.Enabled := not lblRemoveMyLoginInfo.Visible;
  7955. edPassword.Enabled := not lblRemoveMyLoginInfo.Visible;
  7956. //lblForgotPassword.Visible := Value;
  7957. lblNetworkConfig.Visible := Value;
  7958. //lblHelper.Visible := Value;
  7959. //lblNetworkConfig.Top:=Height-100;
  7960. //lblHelper.Top:=Height-80;
  7961. //lblRegister.Visible := Value;
  7962. end;
  7963. //------------------------------------------------------------------------------
  7964. procedure TMainForm.RealICQClientDisconnected(Sender: TObject);
  7965. begin
  7966. ScrollBoxMoreUser.Tag := 0;
  7967. try
  7968. if FSearchListViewInVisible then
  7969. spbCancelFilterClick(nil);
  7970. //ToDo
  7971. if pnlMiddleRight.Visible then
  7972. ShowOrHideMuiltiWeb;
  7973. if Assigned(AGuideViewForm) then
  7974. FreeAndNil(AGuideViewForm);
  7975. finally
  7976. lblLoginState.Caption := '正在注销...';
  7977. SetLoginControlsVisible(False);
  7978. pnlWorkArea.Visible := False;
  7979. pnlLogout.Visible := True;
  7980. //WebBrowserForEMail.Navigate('http://mail.lishui.gov.cn/web_email/modules/i_logout.phtml');
  7981. TimerForCheckLogoutTimeout.Enabled := True;
  7982. TimerForGetBranchOnlineStates.Enabled := False;
  7983. pnlForTopMessage.Visible := False;
  7984. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  7985. { TODO -olqq -c : 退出时,重置Log的登录名 2014/12/14 10:59:28 }
  7986. LoggerImport.LoginName := '';
  7987. TTeamsAdapter.Stop;
  7988. TMessagesHander.GetHander.Uninstall;
  7989. TMainFormController.GetController.LogoutFromAppCentre;
  7990. FDBHistory.DBFileName := '';
  7991. end;
  7992. end;
  7993. //------------------------------------------------------------------------------
  7994. procedure TMainForm.SetUIState;
  7995. var
  7996. iLoop: Integer;
  7997. RealICQContacterListView: TRealICQContacterListView;
  7998. RealICQContacterTreeView: TRealICQContacterTreeView;
  7999. RealICQFriendTreeView: TRealICQContacterTreeView;
  8000. GroupMembers: TStringList;
  8001. TabSheet: TTabSheet;
  8002. SystemMessage: TRealICQSystemMessage;
  8003. NotReadMessageObject: TObject;
  8004. MessageList: TList;
  8005. Employee: TRealICQEmployee;
  8006. RealICQUser: TRealICQUser;
  8007. VisibleValue: Boolean;
  8008. iIndex: Integer;
  8009. GroupName, MessageID: string;
  8010. SysMsgInterface: TSysMsgInterface;
  8011. begin
  8012. if OptionsForm <> nil then
  8013. OptionsForm.GetSets;
  8014. {$region '根据状态显示登录界面上的按钮等界面元素的内容和行为'}
  8015. TimerForLogining.Enabled := RealICQClient.Logining;
  8016. if True then
  8017. edLoginName.Text := RealICQClient.InputLoginName;
  8018. if RealICQClient.Logining then
  8019. begin
  8020. actLoginAs.Enabled := False;
  8021. lblLoginState.Caption := '正在登录...';
  8022. lblLoginState.Refresh;
  8023. SetLoginControlsVisible(False);
  8024. btLogin.Enabled := True;
  8025. btLogin.Visible := True;
  8026. btLogin.Caption := '取消(&C)';
  8027. btLogin.Refresh;
  8028. Application.ProcessMessages;
  8029. end
  8030. else if RealICQClient.SavedPassword and (not RealICQClient.Logined) then
  8031. begin
  8032. edPassword.Text := '保存的密码';
  8033. lblPasswordTitle.Enabled := False;
  8034. edPassword.Enabled := False;
  8035. FLoginAsSavePassword := True;
  8036. actLoginAs.Enabled := (not RealICQClient.Logined or not RealICQClient.Connected) and (not RealICQClient.Logining);
  8037. actLoginAs.Caption := '作为 ' + RealICQClient.LoginName + ' 登录(&S)';
  8038. btLogin.Enabled := True;
  8039. btLogin.Visible := True;
  8040. btLogin.Caption := '登录(&S)';
  8041. btLogin.Refresh;
  8042. lblLoginState.Caption := '';
  8043. SetLoginControlsVisible(True);
  8044. end
  8045. else if (not RealICQClient.Logined) then
  8046. begin
  8047. edPassword.Text := '';
  8048. lblPasswordTitle.Enabled := True;
  8049. edPassword.Enabled := True;
  8050. FLoginAsSavePassword := False;
  8051. actLoginAs.Enabled := False;
  8052. actLoginAs.Caption := '作为 ... 登录(&S)';
  8053. btLogin.Enabled := True;
  8054. btLogin.Visible := True;
  8055. btLogin.Caption := '登录(&S)';
  8056. btLogin.Refresh;
  8057. lblLoginState.Caption := '';
  8058. SetLoginControlsVisible(True);
  8059. end;
  8060. {$endregion}
  8061. {$region '设置控件的Enabled属性'}
  8062. actReg.Enabled := (not RealICQClient.Logining) and (not RealICQClient.Reging);
  8063. actOptions.Enabled := (not RealICQClient.Logining) and (not RealICQClient.Reging);
  8064. actConnectSet.Enabled := actOptions.Enabled;
  8065. actLogout.Enabled := (not (not RealICQClient.Logined or not RealICQClient.Connected) and (not RealICQClient.Logining) and (not RealICQClient.Reging)) and RealICQClient.Connected;
  8066. actOpenRecvFileDir.Enabled := actLogout.Enabled;
  8067. btLogin.Default := not actLogout.Enabled;
  8068. actOnline.Enabled := actLogout.Enabled;
  8069. actHidden.Enabled := actLogout.Enabled;
  8070. actOffline.Enabled := actLogout.Enabled;
  8071. actBusy.Enabled := actLogout.Enabled;
  8072. actMute.Enabled := actLogout.Enabled;
  8073. actLeave.Enabled := actLogout.Enabled;
  8074. actPhone.Enabled := actLogout.Enabled;
  8075. actRepast.Enabled := actLogout.Enabled;
  8076. actMeeting.Enabled := actLogout.Enabled;
  8077. actOtherState.Enabled := actLogout.Enabled;
  8078. actOfflieAutoResponse.Enabled := actLogout.Enabled;
  8079. actPersonalSet.Enabled := actLogout.Enabled;
  8080. actChangePass.Enabled := actLogout.Enabled;
  8081. actFindUsers.Enabled := actLogout.Enabled;
  8082. actShowLoginName.Enabled := actLogout.Enabled;
  8083. actShowDisplayName.Enabled := actLogout.Enabled;
  8084. actShowAllName.Enabled := actLogout.Enabled;
  8085. actShowRemark.Enabled := actLogout.Enabled;
  8086. actShowBigHeadImage.Enabled := actLogout.Enabled;
  8087. actShowMiddleHeadImage.Enabled := actLogout.Enabled;
  8088. actShowSmallHeadImage.Enabled := actLogout.Enabled;
  8089. actShowNormalHeadImage.Enabled := actLogout.Enabled;
  8090. actShowGroup.Enabled := actLogout.Enabled;
  8091. actGroupManager.Enabled := actLogout.Enabled;
  8092. actShowStrangers.Enabled := actLogout.Enabled;
  8093. actShowBlacklists.Enabled := actLogout.Enabled;
  8094. actShowTeams.Enabled := actLogout.Enabled;
  8095. actShowLatests.Enabled := actLogout.Enabled;
  8096. actShowGIFInMailForm.Enabled := actLogout.Enabled;
  8097. actShowGIFInTalkingForm.Enabled := actLogout.Enabled;
  8098. actCustomFacesManager.Enabled := actLogout.Enabled;
  8099. actMsgManager.Enabled := actLogout.Enabled;
  8100. actAVSet.Enabled := actLogout.Enabled;
  8101. RealICQNetWorkDiskClientConnectStateChanged(Self.RealICQNetWorkDiskClient);
  8102. SetLoginStateMenuChecked;
  8103. SetStyleMenuChecked;
  8104. {$endregion}
  8105. {$region '设置控件的Visible属性'}
  8106. lblReConnect.Visible := False;
  8107. actLoginAs.Visible := actLoginAs.Enabled;
  8108. if (RealICQClient.WorkingMode = wmCorporation) then
  8109. begin
  8110. actShowBigHeadImage.Visible := False;
  8111. actShowMiddleHeadImage.Visible := False;
  8112. actShowStrangers.Visible := False;
  8113. actShowBlacklists.Visible := False;
  8114. actReg.Visible := False;
  8115. //actFindUsers.Visible := False;
  8116. actShowTree.Visible := False;
  8117. end
  8118. else
  8119. begin
  8120. actShowBigHeadImage.Visible := not actShowTree.Checked;
  8121. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  8122. actShowStrangers.Visible := True;
  8123. actShowBlacklists.Visible := True;
  8124. actReg.Visible := True;
  8125. //actFindUsers.Visible := True;
  8126. actShowTree.Visible := True;
  8127. end;
  8128. VisibleValue := RealICQClient.Logined and RealICQClient.Connected;
  8129. ActionManager.ActionBars.ActionBars[1].Items[1].Visible := VisibleValue;
  8130. ActionManager.ActionBars.ActionBars[1].Items[2].Visible := VisibleValue;
  8131. //spbShowHideRight.Visible := VisibleValue;
  8132. {$endregion}
  8133. {$region '根据登录/连接状态,显示登录界面或联系人界面'}
  8134. if RealICQClient.Logined and RealICQClient.Connected then
  8135. begin
  8136. pnlWorkArea.Visible := True;
  8137. pnlLogout.Visible := False;
  8138. SetAllTakingFormEnabledState(True);
  8139. SetAllSMSFormEnabledState(True);
  8140. if not TLimitCondition.UserInfoCheck(MainForm.RealICQClient.Me) then
  8141. MainForm.actPersonalSetExecute(nil)
  8142. else if TLimitCondition.FirstLoginComfirm then
  8143. begin
  8144. ShowMessage('请确认或修改您的用户信息,确保您的信息正确');
  8145. MainForm.actPersonalSetExecute(nil);
  8146. end;
  8147. end
  8148. else
  8149. begin
  8150. pnlWorkArea.Visible := False;
  8151. pnlLogout.Visible := True;
  8152. tsCustomerService.PageControl := nil;
  8153. tsCustomers.PageControl := pgcMainWorkArea;
  8154. RealICQNetWorkDiskClient.Logout;
  8155. if VideoForm <> nil then
  8156. FreeAndNil(VideoForm);
  8157. if CreateTeamForm <> nil then
  8158. FreeAndNil(CreateTeamForm);
  8159. if SearchForm <> nil then
  8160. FreeAndNil(SearchForm);
  8161. if SearchTeamForm <> nil then
  8162. FreeAndNil(SearchTeamForm);
  8163. if SelFaceForm <> nil then
  8164. FreeAndNil(SelFaceForm);
  8165. if CustomFacesManagerForm <> nil then
  8166. FreeAndNil(CustomFacesManagerForm);
  8167. if MessagesManagerForm <> nil then
  8168. FreeAndNil(MessagesManagerForm);
  8169. if AddFaceForm <> nil then
  8170. FreeAndNil(AddFaceForm);
  8171. try
  8172. CloseAllTeamOptionsForms;
  8173. except
  8174. end;
  8175. try
  8176. WebBrowserForAdvertisement.OnDocumentComplete := nil;
  8177. WebBrowserForAdvertisement.OnBeforeNavigate2 := nil;
  8178. pnlAdvertisement.Height := 0;
  8179. if WebBrowserForAdvertisement.Busy then
  8180. WebBrowserForAdvertisement.Stop;
  8181. WebBrowserForAdvertisement.Navigate('about:blank');
  8182. except
  8183. end;
  8184. try
  8185. // CloseAllSeeUserInformationForms;
  8186. except
  8187. end;
  8188. try
  8189. CloseAllChangeSystemMessageForms;
  8190. except
  8191. end;
  8192. try
  8193. SetAllTakingFormEnabledState(False);
  8194. SetAllSMSFormEnabledState(False);
  8195. except
  8196. end;
  8197. TimerForFlashTrayIcon.Enabled := False;
  8198. if Assigned(NotReadMessageBoxForm) then
  8199. NotReadMessageBoxForm.Visible := False;
  8200. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  8201. TrayIcon.SetDefaultIcon;
  8202. TrayIcon.Hint := Application.Title + ' - 未登录';
  8203. {$region '删除WEB标签'}
  8204. try
  8205. for iLoop := 0 to FWebTabs.Count - 1 do
  8206. begin
  8207. TabSheet := FWebTabs[iLoop];
  8208. TabSheet.PageControl := nil;
  8209. FreeAndNil(TabSheet);
  8210. end;
  8211. except
  8212. end;
  8213. FWebTabs.Clear;
  8214. {$endregion}
  8215. {$region '删除未处理的系统消息'}
  8216. try
  8217. for iLoop := 0 to FSystemMessages.Count - 1 do
  8218. begin
  8219. SystemMessage := FSystemMessages[iLoop];
  8220. FreeAndNil(SystemMessage);
  8221. end;
  8222. except
  8223. end;
  8224. FSystemMessages.Clear;
  8225. {$endregion}
  8226. {$region '清除还未读的消息'}
  8227. for iLoop := 0 to FNotReadMessages.Count - 1 do
  8228. begin
  8229. MessageID := FNotReadMessages[iLoop];
  8230. if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  8231. begin
  8232. try
  8233. NotReadMessageObject := FNotReadMessages.Objects[iLoop];
  8234. FreeAndNil(NotReadMessageObject);
  8235. except
  8236. end;
  8237. end
  8238. else
  8239. begin
  8240. MessageList := FNotReadMessages.Objects[iLoop] as TList;
  8241. while MessageList.Count > 0 do
  8242. begin
  8243. try
  8244. NotReadMessageObject := TObject(MessageList[0]);
  8245. FreeAndNil(NotReadMessageObject);
  8246. except
  8247. end;
  8248. MessageList.Delete(0);
  8249. end;
  8250. FreeAndNil(MessageList);
  8251. end;
  8252. end;
  8253. FNotReadMessages.Clear;
  8254. {$endregion}
  8255. {try
  8256. for iLoop :=FNotAddedEmployeeList.Count-1 Downto 0 do
  8257. begin
  8258. try
  8259. RealICQUser:= FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  8260. if Assigned(RealICQUser) then FreeAndNil(RealICQUser);
  8261. except
  8262. end;
  8263. end;
  8264. finally
  8265. FNotAddedEmployeeList.Clear;
  8266. end; }
  8267. if FNotAddedEmployeeList.Count > 0 then
  8268. FNotAddedEmployeeList.Clear;
  8269. if Assigned(FLVSystemMessage) then
  8270. FLVSystemMessage.Items.Clear;
  8271. if Assigned(FLVTeams) then
  8272. FLVTeams.Items.Clear;
  8273. if Assigned(FLVCustomers) then
  8274. FLVCustomers.Items.Clear;
  8275. {$region '删除用于显示用户列表对象'}
  8276. for iLoop := FContacterListViews.Count - 1 downto 0 do
  8277. begin
  8278. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  8279. try
  8280. RealICQContacterListView.Items.Clear;
  8281. except
  8282. end;
  8283. GroupName := FContacterListViews[iLoop];
  8284. if AnsiSameText(GroupName, LVFriends) or AnsiSameText(GroupName, LVStrangers) or
  8285. {AnsiSameText(GroupName, LVBlacklists) or}
  8286. (FGroups.IndexOf(GroupName) >= 0) then
  8287. begin
  8288. try
  8289. FreeAndNil(RealICQContacterListView);
  8290. except
  8291. end;
  8292. FContacterListViews.Delete(iLoop);
  8293. end;
  8294. end;
  8295. for iLoop := FContacterTreeViews.Count - 1 downto 0 do
  8296. begin
  8297. try
  8298. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  8299. try
  8300. RealICQContacterTreeView.Clear;
  8301. except
  8302. end;
  8303. finally
  8304. try
  8305. FreeAndNil(RealICQContacterTreeView);
  8306. except
  8307. end;
  8308. FContacterTreeViews.Delete(iLoop);
  8309. end;
  8310. end;
  8311. for iLoop := FContacterTreeViews.Count - 1 downto 0 do
  8312. begin
  8313. try
  8314. RealICQFriendTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  8315. try
  8316. RealICQFriendTreeView.Clear;
  8317. except
  8318. end;
  8319. finally
  8320. try
  8321. FreeAndNil(RealICQFriendTreeView);
  8322. except
  8323. end;
  8324. FContacterTreeViews.Delete(iLoop);
  8325. end;
  8326. end;
  8327. {$endregion}
  8328. for iLoop := 0 to RealICQClient.SysMsgInterfaces.Count - 1 do
  8329. begin
  8330. SysMsgInterface := RealICQClient.SysMsgInterfaces.Objects[iLoop] as TSysMsgInterface;
  8331. FreeAndNil(SysMsgInterface);
  8332. end;
  8333. RealICQClient.SysMsgInterfaces.Clear;
  8334. for iLoop := 0 to FGroups.Count - 1 do
  8335. begin
  8336. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  8337. GroupMembers.Clear;
  8338. GroupMembers.Free;
  8339. end;
  8340. FGroups.Clear;
  8341. end;
  8342. {$endregion}
  8343. PostMessage(Handle, WM_SIZE, 0, 0);
  8344. Application.ProcessMessages;
  8345. if not TrayIcon.Visible then
  8346. begin
  8347. TrayIcon.Visible := True;
  8348. end;
  8349. end;
  8350. //------------------------------------------------------------------------------
  8351. procedure TMainForm.AddMessageHistory(ASystemMessageType: TSystemMessageType; ASimpleMessage: string; ASystemMessage: TRealICQSystemMessage);
  8352. var
  8353. ItemIndex: Integer;
  8354. ListItem: TRealICQContacterListItem;
  8355. ID: string;
  8356. begin
  8357. ID := '';
  8358. case ASystemMessageType of
  8359. smSimple:
  8360. begin
  8361. ID := IntToStr(GetTickCount);
  8362. while FLVSystemMessage.Items.IndexOf(ID) >= 0 do
  8363. begin
  8364. ID := IntToStr(GetTickCount);
  8365. Sleep(10);
  8366. Application.ProcessMessages;
  8367. end;
  8368. end;
  8369. smSystemMessage:
  8370. ID := IntToStr(ASystemMessage.MessageID);
  8371. end;
  8372. FLVSystemMessage.ShowHeadImageButton := False;
  8373. ItemIndex := FLVSystemMessage.Items.Add(ID);
  8374. ListItem := FLVSystemMessage.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  8375. with ListItem do
  8376. begin
  8377. DisplayName := TimeToStr(Now);
  8378. LoginState := stOnline;
  8379. case ASystemMessageType of
  8380. smSimple:
  8381. begin
  8382. Watchword := ASimpleMessage;
  8383. try
  8384. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + SimpleMessagePicture);
  8385. except
  8386. end;
  8387. end;
  8388. smSystemMessage:
  8389. begin
  8390. Watchword := ASystemMessage.Title;
  8391. try
  8392. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  8393. except
  8394. end;
  8395. end;
  8396. end;
  8397. ReDrawItem;
  8398. end;
  8399. FLVSystemMessage.TopIndex := ItemIndex;
  8400. end;
  8401. //------------------------------------------------------------------------------
  8402. constructor TMainForm.Create(AOwner: TComponent);
  8403. begin
  8404. MainForm := Self;
  8405. inherited Create(AOwner);
  8406. end;
  8407. //------------------------------------------------------------------------------
  8408. procedure TMainForm.FormCreate(Sender: TObject);
  8409. function URLDecode(const S: string): string;
  8410. var
  8411. Idx: Integer; // loops thru chars in string
  8412. Hex: string; // string of hex characters
  8413. Code: Integer; // hex character code (-1 on error)
  8414. begin
  8415. // Intialise result and string index
  8416. Result := '';
  8417. Idx := 1;
  8418. // Loop thru string decoding each character
  8419. while Idx <= Length(S) do
  8420. begin
  8421. case S[Idx] of
  8422. '%':
  8423. begin
  8424. // % should be followed by two hex digits - exception otherwise
  8425. if Idx <= Length(S) - 2 then
  8426. begin
  8427. // there are sufficient digits - try to decode hex digits
  8428. Hex := S[Idx + 1] + S[Idx + 2];
  8429. Code := SysUtils.StrToIntDef('$' + Hex, -1);
  8430. Inc(Idx, 2);
  8431. end
  8432. else
  8433. // insufficient digits - error
  8434. Code := -1;
  8435. // check for error and raise exception if found
  8436. if Code = -1 then
  8437. raise SysUtils.EConvertError.Create('Invalid hex digit in URL');
  8438. // decoded OK - add character to result
  8439. Result := Result + Chr(Code);
  8440. end;
  8441. '+':
  8442. // + is decoded as a space
  8443. Result := Result + ' ' else
  8444. // All other characters pass thru unchanged
  8445. Result := Result + S[Idx];
  8446. end;
  8447. Inc(Idx);
  8448. end;
  8449. end;
  8450. function UserIsLogined(user: string): Boolean;
  8451. var
  8452. hWndStart, hwndLike: HWND;
  8453. WndCaption: array[0..254] of char;
  8454. WndClassName: array[0..254] of char;
  8455. ActiveTimes: Integer;
  8456. begin
  8457. Result := False;
  8458. try
  8459. ActiveTimes := 0;
  8460. hWndStart := GetDesktopWindow;
  8461. hwndLike := GetWindow(hWndStart, GW_CHILD);
  8462. while hwndLike <> 0 do
  8463. begin
  8464. GetWindowText(hwndLike, @WndCaption, 254);
  8465. GetClassName(hwndLike, @WndClassName, 254);
  8466. if (pos(user, StrPas(WndCaption)) <> 0) and (pos('TrueHiddenMainForm', StrPas(WndClassName)) <> 0) then
  8467. begin
  8468. Result := True;
  8469. ShowWindow(hwndLike, SW_SHOW);
  8470. ForceForeGroundWindow(hwndLike);
  8471. Inc(ActiveTimes);
  8472. if ActiveTimes >= 2 then
  8473. Break;
  8474. end;
  8475. hwndLike := GetWindow(hwndLike, GW_HWNDNEXT);
  8476. end;
  8477. except
  8478. on E: Exception do
  8479. begin
  8480. Error(E.Message, 'TMainForm.UserIsLogined(' + user + ')');
  8481. end;
  8482. end;
  8483. end;
  8484. var
  8485. iIndex, i: Integer;
  8486. gif: TGIFImage;
  8487. ca: string;
  8488. IdHttp: TIdHTTP;
  8489. ResponeStr: string;
  8490. Sends: TStrings;
  8491. jo, ja: ISuperObject;
  8492. CALoginName, CAPassWord: string;
  8493. icon: TIcon; //cmg
  8494. begin
  8495. try
  8496. TAuthority.SetDropFileAuthority;
  8497. TrayIcon.Visible := False;
  8498. if FileExists(ExtractFilePath(paramstr(0)) + LoginingGif) then
  8499. begin
  8500. gif := TGIFImage.Create;
  8501. try
  8502. gif.LoadFromFile(ExtractFilePath(paramstr(0)) + LoginingGif);
  8503. gif.Animate := True;
  8504. ImgLoadingMoreBranchs.Picture.Assign(gif);
  8505. finally
  8506. gif.Free;
  8507. end;
  8508. end;
  8509. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\0.ico', $ff00ff);
  8510. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\1.ico', $ff00ff);
  8511. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\2.ico', $ff00ff);
  8512. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\3.ico', $ff00ff);
  8513. //cmg
  8514. begin
  8515. Icon := Ticon.create;
  8516. try
  8517. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\3.ico');
  8518. i := ImgLstForLogining.addicon(Icon);
  8519. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\2.ico');
  8520. i := ImgLstForLogining.addicon(Icon);
  8521. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\1.ico');
  8522. i := ImgLstForLogining.addicon(Icon);
  8523. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\0.ico');
  8524. i := ImgLstForLogining.addicon(Icon);
  8525. finally
  8526. Icon.Free;
  8527. end;
  8528. end;
  8529. //注册自定义消息
  8530. CLOSEWINDOWS := RegisterWindowMessage('关闭窗口');
  8531. if FileExists(ExtractFilePath(Application.ExeName) + 'Images\Logo.gif') then
  8532. ImgLogo.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Logo.gif');
  8533. if FileExists(ExtractFilePath(Application.ExeName) + 'Images\AppCode.png') then
  8534. Image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\AppCode.png');
  8535. LoadMainTabImage;
  8536. LoadGroupConfig;
  8537. FDownFile := TDownFile.Create;
  8538. FDownFile.OnComplete := DownFileComplete;
  8539. //调用自动更新程序
  8540. FCheckedUpdate := True;
  8541. try
  8542. RegisterOleFile(ExtractFilePath(Application.ExeName) + IEContext_DLL_PACH, 1);
  8543. except
  8544. on E: Exception do
  8545. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(IEContext.dll)');
  8546. end;
  8547. try
  8548. RegisterOleFile(ExtractFilePath(Application.ExeName) + ImageX2_DLL_PACH, 1);
  8549. except
  8550. on E: Exception do
  8551. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(ImageX2.dll)');
  8552. end;
  8553. try
  8554. RegisterOleFile(ExtractFilePath(Application.ExeName) + AppCentreCom_DLL_PACH, 1);
  8555. except
  8556. on E: Exception do
  8557. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(AppCentreCom.dll)');
  8558. end;
  8559. if HookID <> 0 then
  8560. UnHookWindowsHookEx(HookID);
  8561. HookID := SetWindowsHookEx(WH_MOUSE, MouseProc, 0, GetCurrentThreadId());
  8562. MinButtonForClose := True;
  8563. FGettedTrayIconRect := False;
  8564. FMainFormHidden := False;
  8565. FHidePosition := hpNone;
  8566. SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
  8567. Caption := Application.Title;
  8568. actOpenMainForm.Caption := '打开 ' + Application.Title + ' 主界面(&O)';
  8569. btShowMiniPage.Visible := TCustomerConfig.GetConfig.ShowGuideViewBtn;
  8570. FIsLogout := False;
  8571. DoubleBuffered := True;
  8572. pnlTop.DoubleBuffered := True;
  8573. pnlClient.DoubleBuffered := True;
  8574. pnlWorkArea.DoubleBuffered := True;
  8575. pnlLogout.DoubleBuffered := True;
  8576. edFilterKeyword.DoubleBuffered := True;
  8577. pnlWebSearch.DoubleBuffered := True;
  8578. pnlWebSearchSplit.DoubleBuffered := True;
  8579. pnlTeams.DoubleBuffered := True;
  8580. pnlAll.DoubleBuffered := True;
  8581. edLoginName.DoubleBuffered := True;
  8582. edPassword.DoubleBuffered := True;
  8583. pnlNDToolBar.DoubleBuffered := True;
  8584. pnlNDStateBar.DoubleBuffered := True;
  8585. pnlNetWorkFiles.DoubleBuffered := True;
  8586. pnlMiddleClient.DoubleBuffered := True;
  8587. pgcMultiWeb.DoubleBuffered := True;
  8588. pnlToolBar.DoubleBuffered := True;
  8589. FHintWindow := TSingleBorderHintWindow.Create(Self);
  8590. FHintWindow.Visible := False;
  8591. FGetUsersTask := TStringList.Create;
  8592. //默认值
  8593. ActiveButtonTag := 1;
  8594. HotKeyID_ReadMessage := 0;
  8595. HotKeyID_CopyScreen := 0;
  8596. FShowGroup := False;
  8597. FFlashCaptionOnOnline := True;
  8598. FLVSelectedItemBorderColor := $00E9CAAD;
  8599. FLVSelectedItemBorderInnerColor := $00F7F7F7;
  8600. FLVSelectedItemBackColor := $00FEE9CE;
  8601. FLVHeadImageBorderColor := $00E9CAAD;
  8602. FLVHeadImageBackColor := clWhite;
  8603. FLVStyle := lsMiddleHeadImage;
  8604. FLVCaptionStyle := csDisplayName;
  8605. FShowTree := False;
  8606. LoadDefaultConfigs;
  8607. FFlashTrayIconIndex := 0;
  8608. FFlashTrayIconIndexAtLogining := 0;
  8609. FNotReadMessages := TStringList.Create;
  8610. FGroups := TStringList.Create;
  8611. FWebTabs := TList.Create;
  8612. FFaceList := TStringList.Create;
  8613. FTempFaceList := TStringList.Create;
  8614. FFaceCategory := TStringList.Create;
  8615. FInputFont := TFont.Create;
  8616. FContacterListViews := TStringList.Create;
  8617. FContacterTreeViews := TStringList.Create;
  8618. FContacterTreeViews := TStringList.Create;
  8619. FSystemMessages := TList.Create;
  8620. TMainFormController.GetController.ChangeStyle;
  8621. try
  8622. FDBHistory := TRealICQDBHistory.Create;
  8623. except
  8624. //ShowMessage('数据库创建失败');
  8625. on E: Exception do
  8626. begin
  8627. ShowMessage('异常类名称:' + E.ClassName + #13#10 + '异常信息:' + E.Message);
  8628. end;
  8629. end;
  8630. FWebPanels := TStringList.Create;
  8631. FOfflineAutoResponseTexts := TStringList.Create;
  8632. FNotAddedEmployeeList := TStringList.Create;
  8633. FSystemNotices := TList.Create;
  8634. FToolBarButtonList := TStringList.Create;
  8635. FToolBarButtonIconList := TStringList.Create;
  8636. FManageGroupMsgList := TStringList.Create;
  8637. FManageGroupMemberMsgList := TStringList.Create;
  8638. FFriendInfo := TStringList.Create;
  8639. FLoginAsSavePassword := False;
  8640. FSavePassword := False;
  8641. FAutoLogin := False;
  8642. FLoginState := stOnline;
  8643. FLeaveMessage := '';
  8644. FServerInfoList := TStringList.Create;
  8645. pnlMiddleClient.Align := alClient;
  8646. pnlMiddleRight.Align := alRight;
  8647. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  8648. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  8649. ChangeLanguage(ExtractFilePath(Application.ExeName) + 'Languages\简体中文.ini');
  8650. {$region '生成显示系统消息的ListView'}
  8651. AddContacterListView(pnlTemp, LVSystemMessage);
  8652. FLVSystemMessage := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8653. FContacterListViews.Delete(0);
  8654. FLVSystemMessage.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  8655. FLVSystemMessage.Style := lsSmallHeadImage;
  8656. FLVSystemMessage.CaptionStyle := csDisplayName;
  8657. FLVSystemMessage.PopupMenu := nil;
  8658. FLVSystemMessage.OnItemOnline := nil;
  8659. FLVSystemMessage.OnItemOffline := nil;
  8660. FLVSystemMessage.OnItemMouseEnter := nil;
  8661. FLVSystemMessage.OnItemMouseLeave := nil;
  8662. FLVSystemMessage.OnItemIconButtonClick := nil;
  8663. FLVSystemMessage.OnItemIconButtonDblClick := nil;
  8664. FLVSystemMessage.ShowMobileButton := False;
  8665. FLVSystemMessage.ShowTelButton := False;
  8666. FLVSystemMessage.ShowEmailButton := False;
  8667. FLVSystemMessage.ShowSMSButton := False;
  8668. FLVSystemMessage.ShowCameraButton := False;
  8669. FLVSystemMessage.ShowHeadImageButton := False;
  8670. FLVSystemMessage.ShowHint := False;
  8671. FLVSystemMessage.SelectedItemBackgroud.Graphic := nil;
  8672. FLVSystemMessage.HeadImageBorderColor := clWhite;
  8673. FLVSystemMessage.SelectedItemBorderInnerColor := clWhite;
  8674. FLVSystemMessage.SelectedItemBackColor := clWhite;
  8675. {$endregion}
  8676. {$region '生成显示群组列表的ListView'}
  8677. AddContacterListView(ScrollBoxTeam, LVTeams);
  8678. // navForContacters.Groups[3] := LVTeams;
  8679. FLVTeams := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8680. FContacterListViews.Delete(0);
  8681. FLVTeams.AdjustPosition := False;
  8682. FLVTeams.LeavePicture := nil;
  8683. FLVTeams.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  8684. FLVTeams.Style := lsSmallHeadImage;
  8685. FLVTeams.CaptionStyle := csDisplayName;
  8686. FLVTeams.PopupMenu := ppTeamListView;
  8687. FLVTeams.OnItemOnline := nil;
  8688. FLVTeams.OnItemOffline := nil;
  8689. FLVTeams.OnItemMouseEnter := nil;
  8690. FLVTeams.OnItemMouseLeave := nil;
  8691. FLVTeams.OnItemIconButtonClick := nil;
  8692. FLVTeams.OnItemIconButtonDblClick := nil;
  8693. FLVTeams.ShowMobileButton := False;
  8694. FLVTeams.ShowTelButton := False;
  8695. FLVTeams.ShowEmailButton := False;
  8696. FLVTeams.ShowSMSButton := False;
  8697. FLVTeams.ShowCameraButton := False;
  8698. FLVTeams.ShowHeadImageButton := False;
  8699. pnlTeams.Parent := ScrollBoxTeam;
  8700. pnlTeams.Align := alTop;
  8701. pnlTeams.ShowHint := False;
  8702. {$endregion}
  8703. {$region '生成显示网络硬盘文件的ListView'}
  8704. AddContacterListView(pnlNDFiles, '网络硬盘');
  8705. FLVNetWorkDisk := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8706. FLVNetWorkDisk.Align := alClient;
  8707. FContacterListViews.Delete(0);
  8708. FLVNetWorkDisk.LeavePicture := nil;
  8709. FLVNetWorkDisk.SelectedItemBackgroud.Graphic := nil;
  8710. FLVNetWorkDisk.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8711. FLVNetWorkDisk.Style := lsSmallHeadImage;
  8712. FLVNetWorkDisk.CaptionStyle := csDisplayName;
  8713. FLVNetWorkDisk.PopupMenu := ppNetWorkFile;
  8714. FLVNetWorkDisk.HeadImageBorderColor := clWhite;
  8715. FLVNetWorkDisk.SelectedItemBorderInnerColor := clWhite;
  8716. FLVNetWorkDisk.SelectedItemBackColor := clWhite;
  8717. FLVNetWorkDisk.OnItemOnline := nil;
  8718. FLVNetWorkDisk.OnItemOffline := nil;
  8719. FLVNetWorkDisk.OnItemMouseEnter := nil;
  8720. FLVNetWorkDisk.OnItemMouseLeave := nil;
  8721. FLVNetWorkDisk.OnItemIconButtonClick := nil;
  8722. FLVNetWorkDisk.OnItemIconButtonDblClick := nil;
  8723. FLVNetWorkDisk.ShowMobileButton := False;
  8724. FLVNetWorkDisk.ShowTelButton := False;
  8725. FLVNetWorkDisk.ShowEmailButton := False;
  8726. FLVNetWorkDisk.ShowSMSButton := False;
  8727. FLVNetWorkDisk.ShowCameraButton := False;
  8728. FLVNetWorkDisk.ShowHeadImageButton := False;
  8729. FLVNetWorkDisk.AdjustPosition := True;
  8730. FLVNetWorkDisk.OnItemShowHint := ItemShowHint;
  8731. FLVNetWorkDisk.OnItemDoubleClick := NDItemDoubleClick;
  8732. FLVNetWorkDisk.OnSelectItemChanged := NDSelectItemChanged;
  8733. FLVNetWorkDisk.OnItemClick := NDSelectItemChanged;
  8734. FLVNetWorkDisk.OnItemMouseEnter := NDSelectItemChanged;
  8735. FLVNetWorkDisk.OnDropFiles := NDMissionDropFiles;
  8736. FLVNetWorkDisk.OnItemMouseDown := NDItemMouseDown;
  8737. DragAcceptFiles(FLVNetWorkDisk.Handle, True);
  8738. {$endregion}
  8739. {$region '生成显示网络硬盘上传文件任务列表的ListView'}
  8740. AddContacterListView(tsUploadingFiles, '硬盘上传文件');
  8741. FLVNetWorkDiskUploadingFiles := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8742. FLVNetWorkDiskUploadingFiles.Align := alClient;
  8743. FContacterListViews.Delete(0);
  8744. FLVNetWorkDiskUploadingFiles.LeavePicture := nil;
  8745. FLVNetWorkDiskUploadingFiles.SelectedItemBackgroud.Graphic := nil;
  8746. FLVNetWorkDiskUploadingFiles.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8747. FLVNetWorkDiskUploadingFiles.Style := lsSmallHeadImage;
  8748. FLVNetWorkDiskUploadingFiles.CaptionStyle := csDisplayName;
  8749. FLVNetWorkDiskUploadingFiles.PopupMenu := ppNetWorkMisson;
  8750. FLVNetWorkDiskUploadingFiles.HeadImageBorderColor := clWhite;
  8751. FLVNetWorkDiskUploadingFiles.SelectedItemBorderInnerColor := clWhite;
  8752. FLVNetWorkDiskUploadingFiles.SelectedItemBackColor := clWhite;
  8753. FLVNetWorkDiskUploadingFiles.OnItemOnline := nil;
  8754. FLVNetWorkDiskUploadingFiles.OnItemOffline := nil;
  8755. FLVNetWorkDiskUploadingFiles.OnItemMouseEnter := nil;
  8756. FLVNetWorkDiskUploadingFiles.OnItemMouseLeave := nil;
  8757. FLVNetWorkDiskUploadingFiles.OnItemIconButtonClick := NDMissionItemIconButtonClick;
  8758. FLVNetWorkDiskUploadingFiles.OnItemIconButtonDblClick := nil;
  8759. FLVNetWorkDiskUploadingFiles.ShowMobileButton := False;
  8760. FLVNetWorkDiskUploadingFiles.ShowTelButton := False;
  8761. FLVNetWorkDiskUploadingFiles.ShowEmailButton := False;
  8762. FLVNetWorkDiskUploadingFiles.ShowSMSButton := False;
  8763. FLVNetWorkDiskUploadingFiles.ShowCameraButton := False;
  8764. FLVNetWorkDiskUploadingFiles.ShowHeadImageButton := False;
  8765. FLVNetWorkDiskUploadingFiles.AdjustPosition := False;
  8766. FLVNetWorkDiskUploadingFiles.OnItemShowHint := ItemShowHint;
  8767. FLVNetWorkDiskUploadingFiles.OnItemDoubleClick := nil;
  8768. FLVNetWorkDiskUploadingFiles.OnSelectItemChanged := nil;
  8769. FLVNetWorkDiskUploadingFiles.OnItemClick := nil;
  8770. FLVNetWorkDiskUploadingFiles.OnItemMouseEnter := nil;
  8771. FLVNetWorkDiskUploadingFiles.ShowSMSButton := True;
  8772. FLVNetWorkDiskUploadingFiles.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CancelIcon);
  8773. {$endregion}
  8774. {$region '生成显示网络硬盘下载文件任务列表的ListView'}
  8775. AddContacterListView(tsDownloadingFiles, '硬盘下载文件');
  8776. FLVNetWorkDiskDownloadingFiles := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8777. FLVNetWorkDiskDownloadingFiles.Align := alClient;
  8778. FContacterListViews.Delete(0);
  8779. FLVNetWorkDiskDownloadingFiles.LeavePicture := nil;
  8780. FLVNetWorkDiskDownloadingFiles.SelectedItemBackgroud.Graphic := nil;
  8781. FLVNetWorkDiskDownloadingFiles.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8782. FLVNetWorkDiskDownloadingFiles.Style := lsSmallHeadImage;
  8783. FLVNetWorkDiskDownloadingFiles.CaptionStyle := csDisplayName;
  8784. FLVNetWorkDiskDownloadingFiles.PopupMenu := ppNetWorkMisson;
  8785. FLVNetWorkDiskDownloadingFiles.HeadImageBorderColor := clWhite;
  8786. FLVNetWorkDiskDownloadingFiles.SelectedItemBorderInnerColor := clWhite;
  8787. FLVNetWorkDiskDownloadingFiles.SelectedItemBackColor := clWhite;
  8788. FLVNetWorkDiskDownloadingFiles.OnItemOnline := nil;
  8789. FLVNetWorkDiskDownloadingFiles.OnItemOffline := nil;
  8790. FLVNetWorkDiskDownloadingFiles.OnItemMouseEnter := nil;
  8791. FLVNetWorkDiskDownloadingFiles.OnItemMouseLeave := nil;
  8792. FLVNetWorkDiskDownloadingFiles.OnItemIconButtonClick := NDMissionItemIconButtonClick;
  8793. FLVNetWorkDiskDownloadingFiles.OnItemIconButtonDblClick := nil;
  8794. FLVNetWorkDiskDownloadingFiles.ShowMobileButton := False;
  8795. FLVNetWorkDiskDownloadingFiles.ShowTelButton := False;
  8796. FLVNetWorkDiskDownloadingFiles.ShowEmailButton := False;
  8797. FLVNetWorkDiskDownloadingFiles.ShowSMSButton := False;
  8798. FLVNetWorkDiskDownloadingFiles.ShowCameraButton := False;
  8799. FLVNetWorkDiskDownloadingFiles.ShowHeadImageButton := False;
  8800. FLVNetWorkDiskDownloadingFiles.AdjustPosition := False;
  8801. FLVNetWorkDiskDownloadingFiles.OnItemShowHint := ItemShowHint;
  8802. FLVNetWorkDiskDownloadingFiles.OnItemDoubleClick := nil;
  8803. FLVNetWorkDiskDownloadingFiles.OnSelectItemChanged := nil;
  8804. FLVNetWorkDiskDownloadingFiles.OnItemClick := nil;
  8805. FLVNetWorkDiskDownloadingFiles.OnItemMouseEnter := nil;
  8806. FLVNetWorkDiskDownloadingFiles.ShowSMSButton := True;
  8807. FLVNetWorkDiskDownloadingFiles.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CancelIcon);
  8808. {$endregion}
  8809. iIndex := AddContacterListView(tsCustomers, '客服人员');
  8810. FLVCustomers := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8811. FContacterListViews.Delete(iIndex);
  8812. FLVCustomers.AdjustPosition := False;
  8813. FLVCustomers.OnItemOnline := nil;
  8814. FLVCustomers.OnItemOffline := nil;
  8815. FLVCustomers.Style := lsSmallHeadImage;
  8816. FLVCustomers.Parent := tsCustomers;
  8817. FLVCustomers.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8818. FLVCustomers.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8819. iIndex := AddContacterListView(ScrollBoxLatests, LVLatests);
  8820. FLVLatests := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8821. FLVLatests.AdjustPosition := False;
  8822. FLVLatests.OnItemOnline := nil;
  8823. FLVLatests.OnItemOffline := nil;
  8824. FLVLatests.Parent := ScrollBoxLatests;
  8825. FLVLatests.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8826. FLVLatests.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8827. iIndex := AddContacterListView(ScrollBoxSearchMoreUser, LVMoreUsers);
  8828. FSearchListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8829. FSearchListView.OnItemOnline := nil;
  8830. FSearchListView.OnItemOffline := nil;
  8831. FSearchListView.OnItemIconButtonClick := nil;
  8832. FSearchListView.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8833. FSearchListView.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8834. FSearchListView.ShowTelButton := False;
  8835. FSearchListView.ShowCameraButton := False;
  8836. FSearchListView.ShowEmailButton := False;
  8837. FSearchListView.AdjustPosition := False;
  8838. iIndex := AddContacterListView(ScrollBoxSearchUser, LVSearch);
  8839. FSearchListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8840. FSearchListView.OnItemOnline := nil;
  8841. FSearchListView.OnItemOffline := nil;
  8842. ChangeUIColor(UIMainColor);
  8843. PostMessage(Handle, WM_SIZE, 0, 0);
  8844. Application.ProcessMessages;
  8845. Sleep(200);
  8846. SetUIState;
  8847. AddWebBrowserToPageControl('about:blank', -2);
  8848. lblWeatherCity.Transparent := True;
  8849. lblWeather.Transparent := True;
  8850. lblWeatheren.Transparent := True;
  8851. FToolBarButtonList.AddObject(LVMyContacters, MyContacters);
  8852. FToolBarButtonList.AddObject(LVMoreUsers, SysMsg);
  8853. FToolBarButtonList.AddObject(LVFriends, MyFriend);
  8854. FToolBarButtonList.AddObject(LvTeams, MyTeam);
  8855. FToolBarButtonList.AddObject(LvLatests, Latests);
  8856. FToolBarButtonIconList.AddObject(LVMyContacters, MyContactersIcon);
  8857. FToolBarButtonIconList.AddObject(LVMoreUsers, SysMsgIcon);
  8858. FToolBarButtonIconList.AddObject(LVFriends, MyFriendIcon);
  8859. FToolBarButtonIconList.AddObject(LvTeams, MyTeamIcon);
  8860. FToolBarButtonIconList.AddObject(LvLatests, LatestsIcon);
  8861. NotReadMessageBoxForm := TNotReadMessageBoxForm.Create(Self);
  8862. NotReadMessageBoxForm.Left := -1000;
  8863. NotReadMessageBoxForm.Top := -1000;
  8864. NotReadMessageBoxForm.Show;
  8865. NotReadMessageBoxForm.Hide;
  8866. tsContactersShow(tsContacters);
  8867. if ParamStr(1) = 'wscc://sso' then
  8868. begin
  8869. ca := DecodeString(ParamStr(2));
  8870. ca := URLDecode(ca);
  8871. //ca := copy(ca,pos('ca=',ca)+3,length(ca));
  8872. Sends := TStringList.Create;
  8873. IdHttp := TIdHTTP.Create(nil);
  8874. try
  8875. ResponeStr := Idhttp.post('http://' + RealICQClient.CaServerAddress + ':' + inttostr(RealICQClient.CaPort) + '/api/Structure/LoginByCA?ca=' + ca, Sends);
  8876. ResponeStr := UTF8Decode(ResponeStr);
  8877. try
  8878. jo := SO(ResponeStr);
  8879. CALoginName := jo['data.loginName'].AsString;
  8880. CAPassWord := jo['data.password'].AsString;
  8881. except
  8882. end;
  8883. finally
  8884. Freeandnil(IdHttp);
  8885. Sends.Free;
  8886. end;
  8887. if not UserIsLogined(CALoginName) then
  8888. RealICQClient.Login(CALoginName, CAPassWord, FLoginState, FLeaveMessage, FSavePassword, False, True)
  8889. else
  8890. begin
  8891. try
  8892. Application.Terminate;
  8893. except
  8894. end;
  8895. end;
  8896. end
  8897. else
  8898. begin
  8899. FAutoLogin := RealICQClient.AutoLogin;
  8900. FSavePassword := RealICQClient.SavedPassword;
  8901. SetLoginStateControlState;
  8902. if RealICQClient.AutoLogin and (RealICQClient.SavedPassword or RealICQClient.CALogin) then
  8903. RealICQClient.LoginAsSaved;
  8904. end;
  8905. tsCustomerService.PageControl := nil;
  8906. RealICQClient.OnGettedSysMsgInterfaces := RealICQClientGettedSysMsgInterfaces;
  8907. Application.ProcessMessages;
  8908. except
  8909. on E: Exception do
  8910. Error(E.Message, 'TMainForm.FormCreate');
  8911. end;
  8912. end;
  8913. //------------------------------------------------------------------------------
  8914. procedure TMainForm.FormDeactivate(Sender: TObject);
  8915. begin
  8916. if edWatchword.Visible then
  8917. edWatchwordExit(edWatchword);
  8918. end;
  8919. //------------------------------------------------------------------------------
  8920. procedure TMainForm.FormDestroy(Sender: TObject);
  8921. begin
  8922. try
  8923. if RealICQClient.Connected then
  8924. RealICQClient.Logout;
  8925. if AThreadPool <> nil then
  8926. AThreadPool.TerminateAllYarns;
  8927. FreeAndNil(FDownFile);
  8928. FHintWindow.ReleaseHandle;
  8929. FHintWindow.Free;
  8930. FGetUsersTask.Clear;
  8931. FreeAndNil(FGetUsersTask);
  8932. FServerInfoList.Clear;
  8933. FreeAndNil(FServerInfoList);
  8934. // FreeAndNil(FPCAMessage);
  8935. FreeAndNil(FOfflineAutoResponseTexts);
  8936. FNotAddedEmployeeList.Clear;
  8937. FreeAndNil(FNotAddedEmployeeList);
  8938. FSystemMessages.Clear;
  8939. FreeAndNil(FSystemMessages);
  8940. FToolBarButtonList.Clear;
  8941. FreeAndNil(FToolBarButtonList);
  8942. FToolBarButtonIconList.Clear;
  8943. FreeAndNil(FToolBarButtonIconList);
  8944. FNotReadMessages.Clear;
  8945. FreeAndNil(FNotReadMessages);
  8946. FContacterListViews.Clear;
  8947. FreeAndNil(FContacterListViews);
  8948. FContacterTreeViews.Clear;
  8949. FreeAndNil(FContacterTreeViews);
  8950. FWebTabs.Clear;
  8951. FreeAndNil(FWebTabs);
  8952. FGroups.Clear;
  8953. FreeAndNil(FGroups);
  8954. FFriendInfo.Clear;
  8955. FreeAndNil(FFriendInfo);
  8956. FManageGroupMsgList.Clear;
  8957. FreeAndNil(FManageGroupMsgList);
  8958. FManageGroupMemberMsgList.Clear;
  8959. FreeAndNil(FManageGroupMemberMsgList);
  8960. while FWebPanels.Count > 0 do
  8961. begin
  8962. try
  8963. FWebPanels.Objects[0].Free;
  8964. except
  8965. end;
  8966. FWebPanels.Delete(0);
  8967. end;
  8968. FWebPanels.Clear;
  8969. FreeAndNil(FWebPanels);
  8970. while FSystemNotices.Count > 0 do
  8971. begin
  8972. try
  8973. TSystemNotices(FSystemNotices[0]).Free;
  8974. except
  8975. end;
  8976. FSystemNotices.Delete(0);
  8977. end;
  8978. FSystemNotices.Clear;
  8979. FreeAndNil(FSystemNotices);
  8980. while FFaceList.Count > 0 do
  8981. begin
  8982. try
  8983. FFaceList.Objects[0].Free;
  8984. except
  8985. end;
  8986. FFaceList.Delete(0);
  8987. end;
  8988. FFaceList.Clear;
  8989. FreeAndNil(FFaceList);
  8990. while FTempFaceList.Count > 0 do
  8991. begin
  8992. try
  8993. FTempFaceList.Objects[0].Free;
  8994. except
  8995. end;
  8996. FTempFaceList.Delete(0);
  8997. end;
  8998. FTempFaceList.Clear;
  8999. FreeAndNil(FTempFaceList);
  9000. FFaceCategory.Clear;
  9001. FreeAndNil(FFaceCategory);
  9002. FreeAndNil(FInputFont);
  9003. FreeAndNil(FDBHistory);
  9004. if HookID <> 0 then
  9005. UnHookWindowsHookEx(HookID);
  9006. if HotKeyID_ReadMessage <> 0 then
  9007. begin
  9008. UnregisterHotKey(Handle, HotKeyID_ReadMessage);
  9009. DeleteAtom(HotKeyID_ReadMessage);
  9010. end;
  9011. if HotKeyID_CopyScreen <> 0 then
  9012. begin
  9013. UnregisterHotKey(Handle, HotKeyID_CopyScreen);
  9014. DeleteAtom(HotKeyID_CopyScreen);
  9015. end;
  9016. finally
  9017. GetDataModule.Uninstall;
  9018. end;
  9019. end;
  9020. //------------------------------------------------------------------------------
  9021. procedure TMainForm.FormResize(Sender: TObject);
  9022. var
  9023. iLoop: Integer;
  9024. ContacterTreeView: TRealICQContacterTreeView;
  9025. FriendTreeView: TRealICQContacterTreeView;
  9026. ListView: TRealICQContacterListView;
  9027. begin
  9028. ShowMeInformation;
  9029. if FContacterTreeViews = nil then
  9030. Exit;
  9031. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  9032. begin
  9033. ContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  9034. ContacterTreeView.ReDrawAll;
  9035. end;
  9036. {for iLoop := 0 to FContacterTreeViews.Count - 1 do
  9037. begin
  9038. FriendTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  9039. FriendTreeView.ReDrawAll;
  9040. end; }
  9041. for iLoop := 0 to FContacterListViews.Count - 1 do
  9042. begin
  9043. ListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  9044. ListView.ReDrawAll;
  9045. end;
  9046. if FLVNetWorkDisk <> nil then
  9047. FLVNetWorkDisk.ReDrawAll;
  9048. if FTVCustomerLatests <> nil then
  9049. FTVCustomerLatests.ReDrawAll;
  9050. pnlSearchMoreUser.Width := pnlSelectServer.Width - 5;
  9051. ImgLogining.Left := (pnlSearchMoreUser.Width - ImgLogining.Width) div 2;
  9052. { TODO -olqq -c : 二维码居中 2014/12/14 11:05:27 }
  9053. Image1.Left := (Self.Width - Image1.Width - 26) div 2;
  9054. end;
  9055. //------------------------------------------------------------------------------
  9056. procedure TMainForm.SaveWindowState;
  9057. begin
  9058. if WindowState <> wsMaximized then
  9059. begin
  9060. FMainFormLeft := Left;
  9061. FMainFormTop := Top;
  9062. FMainFormHeight := Height;
  9063. FMainFormWidth := Width - pnlMiddleRight.Width;
  9064. try
  9065. SaveDefaultConfigs;
  9066. except
  9067. end;
  9068. end;
  9069. end;
  9070. //------------------------------------------------------------------------------
  9071. procedure TMainForm.sbpNewWebTabClick(Sender: TObject);
  9072. begin
  9073. AddWebBrowserToPageControl('about:blank', -1);
  9074. end;
  9075. //------------------------------------------------------------------------------
  9076. procedure TMainForm.sbpSMSClick(Sender: TObject);
  9077. begin
  9078. OpenSMSForm('', True);
  9079. end;
  9080. //------------------------------------------------------------------------------
  9081. procedure TMainForm.FormShow(Sender: TObject);
  9082. begin
  9083. try
  9084. //tsCustomers.Parent := nil;
  9085. //tsCustomers.PageControl := nil;
  9086. //pgcMainWorkArea.RemoveControl(tsCustomers);
  9087. //FreeAndNil(tsCustomers);
  9088. except
  9089. end;
  9090. //tsNetWorkDisk.Parent := nil;
  9091. //tsNetWorkDisk.PageControl := nil;
  9092. //pgcMainWorkArea.RemoveControl(tsNetWorkDisk);
  9093. //FreeAndNil(tsNetWorkDisk);
  9094. ClearMemory;
  9095. actOpenMainForm.Execute;
  9096. end;
  9097. procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
  9098. begin
  9099. if FSearchListViewInVisible then
  9100. begin
  9101. edFilterKeyword.Text := '';
  9102. edFilterKeyword.Font.Color := clGray;
  9103. end;
  9104. Action := caNone;
  9105. if pnlMiddleRight.Visible then
  9106. begin
  9107. ShowOrHideMuiltiWeb;
  9108. Exit;
  9109. end;
  9110. ZoomEffect(Self, zaMinimize);
  9111. ShowWindow(Handle, SW_HIDE);
  9112. FHidden := True;
  9113. end;
  9114. //------------------------------------------------------------------------------
  9115. procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  9116. begin
  9117. SaveWindowState;
  9118. end;
  9119. //------------------------------------------------------------------------------
  9120. procedure TMainForm.actLoginExecute(Sender: TObject);
  9121. begin
  9122. end;
  9123. //------------------------------------------------------------------------------
  9124. procedure TMainForm.actRegExecute(Sender: TObject);
  9125. begin
  9126. if RegForm <> nil then
  9127. Exit;
  9128. RegForm := TRegForm.Create(Self);
  9129. try
  9130. if RegForm.ShowModal <> mrOK then
  9131. begin
  9132. RealICQClient.CancelReg;
  9133. end;
  9134. finally
  9135. FreeAndNil(RegForm);
  9136. end;
  9137. end;
  9138. //------------------------------------------------------------------------------
  9139. procedure TMainForm.actDelFriendExecute(Sender: TObject);
  9140. var
  9141. ItemIndex: Integer;
  9142. RealICQFriendTreeView: TRealICQContacterTreeView;
  9143. Friend: TRealICQEmployee;
  9144. begin
  9145. if MessageBox(Handle, '确实要将选中的用户从好友列表中删除吗?', '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  9146. Exit;
  9147. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9148. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9149. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  9150. if (Friend <> nil) then
  9151. begin
  9152. if Friend.BranchID = LVFriends then
  9153. RealICQClient.DelFriend(Friend.LoginName);
  9154. end;
  9155. end;
  9156. //------------------------------------------------------------------------------
  9157. procedure TMainForm.actRemoveUserExecute(Sender: TObject);
  9158. var
  9159. ItemIndex: Integer;
  9160. GroupName: string;
  9161. RealICQFriendTreeView: TRealICQContacterTreeView;
  9162. Friend: TRealICQEmployee;
  9163. MenuItem: TMenuItem;
  9164. begin
  9165. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9166. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9167. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  9168. if Friend = nil then
  9169. Exit;
  9170. GroupName := Friend.BranchID;
  9171. if MessageBox(Handle, PChar('确实要将选中的用户从' + GroupName + '删除吗?'), '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  9172. Exit;
  9173. if FShowGroup and (FGroups.IndexOf(GroupName) <> -1) then
  9174. begin
  9175. MenuItem := miGroup.Find(LVFriends);
  9176. miMoveGroupClick(MenuItem);
  9177. exit;
  9178. end;
  9179. {
  9180. Screen.Cursor := crHourGlass;
  9181. Application.ProcessMessages;
  9182. try
  9183. if GroupName = lvBlacklists then
  9184. begin
  9185. RealICQClient.DelBlacklists(Friend.LoginName);
  9186. ShowAddFriendWindow(Self, Friend.LoginName, Friend.DisplayName);
  9187. Sleep(15);
  9188. end;
  9189. finally
  9190. Screen.Cursor := crDefault;
  9191. end;
  9192. }
  9193. end;
  9194. //------------------------------------------------------------------------------
  9195. procedure TMainForm.actLogoutExecute(Sender: TObject);
  9196. begin
  9197. if GetTalkingFormCount > 0 then
  9198. begin
  9199. if MessageBox(Handle, '确实要注销吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  9200. Exit;
  9201. CloseAllTalkingForm;
  9202. end;
  9203. CloseAllSMSForm;
  9204. RealICQClient.Logout;
  9205. RealICQClient.FriendCount := 0;
  9206. FIsLogout := True;
  9207. end;
  9208. //------------------------------------------------------------------------------
  9209. procedure TMainForm.actLoginAsExecute(Sender: TObject);
  9210. begin
  9211. if RegForm <> nil then
  9212. begin
  9213. MessageBox(RegForm.Handle, '请先关闭新用户注册窗口', '提示', MB_ICONINFORMATION);
  9214. Exit;
  9215. end;
  9216. RealICQClient.LoginAsSaved;
  9217. end;
  9218. //------------------------------------------------------------------------------
  9219. procedure TMainForm.actOfflieAutoResponseExecute(Sender: TObject);
  9220. begin
  9221. if OptionsForm <> nil then
  9222. Exit;
  9223. OptionsForm := TOptionsForm.Create(Self);
  9224. try
  9225. OptionsForm.PageIndex := 11;
  9226. OptionsForm.ShowModal;
  9227. finally
  9228. FreeAndNil(OptionsForm);
  9229. end;
  9230. end;
  9231. procedure TMainForm.actOnlineExecute(Sender: TObject);
  9232. begin
  9233. RealICQClient.ChangeState(TRealICQLoginState((Sender as TAction).Tag), (Sender as TAction).Caption);
  9234. end;
  9235. //------------------------------------------------------------------------------
  9236. procedure TMainForm.actHiddenExecute(Sender: TObject);
  9237. begin
  9238. RealICQClient.ChangeState(stHidden, '');
  9239. end;
  9240. //------------------------------------------------------------------------------
  9241. procedure TMainForm.actLeaveExecute(Sender: TObject);
  9242. begin
  9243. RealICQClient.ChangeState(stLeave, (Sender as TAction).Caption);
  9244. end;
  9245. //------------------------------------------------------------------------------
  9246. procedure TMainForm.actHelpExecute(Sender: TObject);
  9247. begin
  9248. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar('http://www.lxtalk.com'),'',SW_SHOWMAXIMIZED);
  9249. //ShellExecute(handle, 'open',PChar(GetDefaultBrowser), PChar('http://www.lxtalk.com'),'',SW_SHOWMAXIMIZED);
  9250. end;
  9251. //------------------------------------------------------------------------------
  9252. procedure TMainForm.actOtherStateExecute(Sender: TObject);
  9253. var
  9254. LeaveMessage: string;
  9255. begin
  9256. LeaveMessage := Trim(ShowMyInputBox('其它状态', '请输入离开状态说明文字', '', 16));
  9257. if Length(LeaveMessage) > 0 then
  9258. RealICQClient.ChangeState(stLeave, LeaveMessage);
  9259. end;
  9260. //------------------------------------------------------------------------------
  9261. procedure TMainForm.RealICQClientLoginResult(Sender: TObject; LoginResultType: TRealICQLoginResultType; ResultMessage: string);
  9262. var
  9263. DBFileName: string;
  9264. hwnd: THandle;
  9265. begin
  9266. TimerForLogining.Enabled := False;
  9267. if not FCheckedUpdate then
  9268. begin
  9269. if not FileExists(ExtractFilePath(paramstr(0)) + 'Online.exe') then
  9270. DownLoadUpdateConfig
  9271. else
  9272. WinExec(PChar(ExtractFilePath(paramstr(0)) + 'Online.exe /S0 /C /Q'), SW_SHOW);
  9273. end;
  9274. FCheckedUpdate := not FCheckedUpdate;
  9275. case LoginResultType of
  9276. rtLoginOK, rtCanUpdate:
  9277. begin
  9278. Success('成功联上服务器!', 'TMainForm.RealICQClientLoginResult');
  9279. AddMessageHistory(smSimple, '登录至服务器', nil);
  9280. lblLoginState.Caption := '已登录,数据下载中...';
  9281. lblLoginState.Refresh;
  9282. lblNDState.Caption := RealICQClient.NetWorkDiskServerAddress + '(' + IntToStr(RealICQClient.NetWorkDiskServerPort) + ')';
  9283. DBFileName := RealICQClient.GetUserDir + PersonalMessageHistoryDBFile;
  9284. if not FileExists(DBFileName) then
  9285. CopyFile(PChar(ExtractFilePath(paramstr(0)) + MessageHistoryDBFile), PChar(DBFileName), False);
  9286. try
  9287. FDBHistory.LoginName := RealICQClient.LoginName;
  9288. FDBHistory.DBFileName := DBFileName;
  9289. except
  9290. on E: Exception do
  9291. begin
  9292. Error(E.Message, 'LoginResult 加载本地数据库失败');
  9293. end;
  9294. end;
  9295. // btShowMiniPage.Visible := RealICQClient.ShowMiniPage;
  9296. if RealICQClient.WorkingMode = wmPublic then
  9297. begin
  9298. {$region 'wmPublic工作模式'}
  9299. { AddContacterListView(navForContacters.Groups.Objects[0] as TScrollBox, LVFriends);
  9300. navForContacters.Groups[0] := LVFriends;
  9301. AddContacterListView(navForContacters.Groups.Objects[1] as TScrollBox, LVStrangers);
  9302. navForContacters.Groups[1] := LVStrangers;
  9303. AddContacterListView(navForContacters.Groups.Objects[2] as TScrollBox, LVBlacklists);
  9304. navForContacters.Groups[2] := LVBlacklists; }
  9305. {$endregion}
  9306. end
  9307. else if RealICQClient.WorkingMode = wmCorporation then
  9308. begin
  9309. {$region 'wmCorporation'}
  9310. FShowGroup := False;
  9311. AddFriendTreeView(ScrollBoxMyFriend, LVFriends);
  9312. AddContacterTreeView(ScrollBoxContacters, LVMyContacters);
  9313. AddContacterTreeView(ScrollBoxAddrBook, LVAddrBook);
  9314. /// <remarks>
  9315. /// LQQ
  9316. /// 把请求当前用户从RealICQClient移动到BranchService
  9317. /// </remarks>
  9318. TMessagesHander.GetHander.Init;
  9319. {$endregion}
  9320. end;
  9321. TMainFormController.GetController.LoginToAppCentre(RealICQClient.LoginName);
  9322. TTeamsAdapter.Start(RealICQClient.LoginName);
  9323. TGroupShareConfig.GetConfig.URL := RealICQClient.HeadImageURL;
  9324. end;
  9325. rtMustUpdate:
  9326. begin
  9327. //启动升级程序
  9328. hWnd := FindWindow(pchar('TUpdateFrm'), pchar(trim('自动更新')));
  9329. if hWnd = 0 then
  9330. WinExec('Update.exe', SW_SHOW);
  9331. end;
  9332. rtVersionError:
  9333. MessageBox(Handle, '抱歉,您当前使用的客户端版本不受支持', '登录失败', MB_ICONINFORMATION);
  9334. rtLoginErrorByDisplayName:
  9335. MessageBox(Handle, '存在姓名相同的用户,请使用登录名登录!', '登录失败', MB_ICONINFORMATION);
  9336. rtAuthorizationError:
  9337. begin
  9338. MessageBox(Handle, '用户名或密码错误', '登录失败', MB_ICONINFORMATION);
  9339. RealICQClient.ClearSavedPassword;
  9340. actLoginAs.Visible := False;
  9341. SetLoginControlsVisible(True);
  9342. end;
  9343. rtOther:
  9344. MessageBox(Handle, PChar(ResultMessage), '登录失败', MB_ICONINFORMATION);
  9345. end;
  9346. end;
  9347. //------------------------------------------------------------------------------
  9348. procedure TMainForm.RealICQClientLoginStateChanged(Sender: TObject);
  9349. begin
  9350. if not RealICQClient.Logined then
  9351. TimerForCheckLogoutTimeout.Enabled := False;
  9352. SetUIState;
  9353. ClearMemory;
  9354. end;
  9355. //------------------------------------------------------------------------------
  9356. procedure TMainForm.RealICQClientPleaseSendFaceToMe(Sender: TObject; ALoginName, AFaceMD5Code: string);
  9357. var
  9358. iIndex: Integer;
  9359. Face: TFace;
  9360. begin
  9361. iIndex := FFaceList.IndexOf(AFaceMD5Code);
  9362. if iIndex >= 0 then
  9363. begin
  9364. Face := FFaceList.Objects[iIndex] as TFace;
  9365. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, Face.FileName, foFace);
  9366. Exit;
  9367. end;
  9368. iIndex := FTempFaceList.IndexOf(AFaceMD5Code);
  9369. if iIndex >= 0 then
  9370. begin
  9371. Face := FTempFaceList.Objects[iIndex] as TFace;
  9372. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, Face.FileName, foFace);
  9373. Exit;
  9374. end;
  9375. if FileExists(FindRecvedFace(AFaceMD5Code)) then
  9376. begin
  9377. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, FindRecvedFace(AFaceMD5Code), foFace);
  9378. Exit;
  9379. end
  9380. end;
  9381. //------------------------------------------------------------------------------
  9382. procedure TMainForm.RealICQClientPleaseUploadTeamFace(Sender: TObject; MD5String: string; var FileName: string);
  9383. var
  9384. iIndex: Integer;
  9385. Face: TFace;
  9386. begin
  9387. iIndex := FFaceList.IndexOf(MD5String);
  9388. if iIndex >= 0 then
  9389. begin
  9390. Face := FFaceList.Objects[iIndex] as TFace;
  9391. FileName := Face.FileName;
  9392. Exit;
  9393. end;
  9394. iIndex := FTempFaceList.IndexOf(MD5String);
  9395. if iIndex >= 0 then
  9396. begin
  9397. Face := FTempFaceList.Objects[iIndex] as TFace;
  9398. FileName := Face.FileName;
  9399. Exit;
  9400. end;
  9401. if FileExists(FindRecvedFace(MD5String)) then
  9402. begin
  9403. FileName := FindRecvedFace(MD5String);
  9404. Exit;
  9405. end
  9406. end;
  9407. //------------------------------------------------------------------------------
  9408. procedure TMainForm.RealICQClientReConnectExecute(Sender: TObject; ASeconds: Integer);
  9409. begin
  9410. TimerForLogining.Enabled := False;
  9411. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  9412. TrayIcon.SetDefaultIcon;
  9413. lblLoginState.Caption := '连接已中断' + #$D#$A + IntToStr(ASeconds) + ' 秒后重新建立连接。';
  9414. lblLoginState.Visible := True;
  9415. SetLoginControlsVisible(False);
  9416. if not btLogin.Visible then
  9417. begin
  9418. btLogin.Visible := True;
  9419. btLogin.Caption := '取消(&C)';
  9420. btLogin.Refresh;
  9421. end;
  9422. lblReConnect.Visible := True;
  9423. TimerForCheckLogoutTimeout.Enabled := False;
  9424. if not RealICQClient.ReConnectExecuting then
  9425. RealICQClient.CancelReConnectAndLogin;
  9426. end;
  9427. //------------------------------------------------------------------------------
  9428. procedure TMainForm.RealICQClientRemovedUser(Sender: TObject; ALoginName: string);
  9429. var
  9430. itemIndex: Integer;
  9431. RealICQFriendTreeView: TRealICQContacterTreeView;
  9432. // Friend: TRealICQEmployee;
  9433. // Node: TTreeNode;
  9434. begin
  9435. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9436. if ItemIndex >= 0 then
  9437. begin
  9438. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9439. ItemIndex := RealICQFriendTreeView.EmployeeItems.IndexOf(ALoginName);
  9440. if ItemIndex >= 0 then
  9441. RealICQFriendTreeView.EmployeeItems.Delete(ItemIndex);
  9442. end;
  9443. // ShowNavBarNumeric;
  9444. end;
  9445. //------------------------------------------------------------------------------
  9446. procedure TMainForm.TimerForFlashTrayIconTimer(Sender: TObject);
  9447. var
  9448. Icon: TIcon;
  9449. Bitmap: TBitmap;
  9450. MessageID: string;
  9451. RealICQUser: TRealICQUser;
  9452. begin
  9453. if FNotReadMessages.Count = 0 then
  9454. begin
  9455. NotReadMessageBoxForm.Visible := False;
  9456. TimerForFlashTrayIcon.Enabled := False;
  9457. ShowMeInformation;
  9458. Exit;
  9459. end;
  9460. if not (RealICQClient.Logined and RealICQClient.Connected) then
  9461. begin
  9462. TimerForFlashTrayIcon.Enabled := False;
  9463. NotReadMessageBoxForm.Visible := False;
  9464. Exit;
  9465. end;
  9466. Icon := nil;
  9467. Bitmap := nil;
  9468. MessageID := FNotReadMessages.Strings[FNotReadMessages.Count - 1];
  9469. if AnsiSameStr(Copy(MessageID, 1, Length(SMSMessageID)), SMSMessageID) then
  9470. begin
  9471. Icon := TIcon.Create;
  9472. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSMessageIcon);
  9473. end
  9474. else if AnsiSameStr(Copy(MessageID, 1, Length(TeamMessageID)), TeamMessageID) then
  9475. begin
  9476. Icon := TIcon.Create;
  9477. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamIcon);
  9478. end
  9479. else if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  9480. begin
  9481. Icon := TIcon.Create;
  9482. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessageIcon);
  9483. end
  9484. else
  9485. begin
  9486. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(MessageID);
  9487. if FileExists(RealICQUser.HeadImageFile) then
  9488. begin
  9489. try
  9490. Bitmap := GetSamllBitmap(RealICQUser.HeadImageFile, 16, 16, False);
  9491. except
  9492. Icon := TIcon.Create;
  9493. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  9494. end;
  9495. end
  9496. else
  9497. begin
  9498. Icon := TIcon.Create;
  9499. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  9500. end;
  9501. end;
  9502. try
  9503. while ImgLstForFlashTrayIcon.Count > 1 do
  9504. ImgLstForFlashTrayIcon.Delete(1);
  9505. if Icon <> nil then
  9506. ImgLstForFlashTrayIcon.AddIcon(Icon)
  9507. else if Bitmap <> nil then
  9508. ImgLstForFlashTrayIcon.Add(Bitmap, nil);
  9509. finally
  9510. try
  9511. FreeAndNil(Bitmap);
  9512. FreeAndNil(Icon);
  9513. except
  9514. end;
  9515. end;
  9516. ImgLstForFlashTrayIcon.GetIcon(FFlashTrayIconIndex, TrayIcon.Icon);
  9517. TrayIcon.SetDefaultIcon;
  9518. if FFlashTrayIconIndex <> 0 then
  9519. FFlashTrayIconIndex := 0
  9520. else
  9521. FFlashTrayIconIndex := 1;
  9522. end;
  9523. //------------------------------------------------------------------------------
  9524. procedure TMainForm.TimerForLoginingTimer(Sender: TObject);
  9525. begin
  9526. ImgLstForLogining.GetIcon(FFlashTrayIconIndexAtLogining, TrayIcon.Icon);
  9527. TrayIcon.SetDefaultIcon;
  9528. Inc(FFlashTrayIconIndexAtLogining);
  9529. if FFlashTrayIconIndexAtLogining >= ImgLstForLogining.Count then
  9530. FFlashTrayIconIndexAtLogining := 0;
  9531. // TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  9532. // TrayIcon.SetDefaultIcon;
  9533. end;
  9534. procedure TMainForm.TimerForreconnectgroupTimer(Sender: TObject);
  9535. begin
  9536. if (realICQClient.Logined and realICQClient.Connected) then
  9537. begin
  9538. { TODO -olqq -c : 重连的时候,做下异常处理 2014/12/12 15:36:23 }
  9539. try
  9540. TTeamsAdapter.Start(RealICQClient.LoginName);
  9541. { TODO -olqq -c : 在procedure TGroup.OnOpen中有重复 2014/12/12 15:41:02 }
  9542. //WebSocketTeamSubscribe;
  9543. except
  9544. on E: Exception do
  9545. Log(E.Message, 'TMainForm.TimerForreconnectgroupTimer');
  9546. end;
  9547. end;
  9548. end;
  9549. //------------------------------------------------------------------------------
  9550. procedure TMainForm.StopFlashTeam(ATeamID: string);
  9551. var
  9552. ItemIndex: Integer;
  9553. ListItem: TRealICQContacterListItem;
  9554. begin
  9555. ItemIndex := FLVTeams.Items.IndexOf(ATeamID);
  9556. if ItemIndex >= 0 then
  9557. begin
  9558. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9559. ListItem.StopFlash;
  9560. end;
  9561. end;
  9562. procedure TMainForm.StopHeadImageFlash(AID: string);
  9563. var
  9564. ItemIndex: Integer;
  9565. ListItem: TRealICQContacterListItem;
  9566. begin
  9567. ItemIndex := FLVTeams.Items.IndexOf(AID);
  9568. if ItemIndex >= 0 then
  9569. begin
  9570. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9571. ListItem.StopFlash();
  9572. end;
  9573. end;
  9574. procedure TMainForm.SysMsgClick(Sender: TObject);
  9575. begin
  9576. RealICQClient.SendGetMoreServerList;
  9577. end;
  9578. procedure TMainForm.SysMsgIconClick(Sender: TObject);
  9579. begin
  9580. RealICQClient.SendGetMoreServerList;
  9581. end;
  9582. //------------------------------------------------------------------------------
  9583. procedure TMainForm.StopFlash(ALoginName: string);
  9584. var
  9585. ItemIndex: Integer;
  9586. RealICQContacterListView: TRealICQContacterListView;
  9587. RealICQContacterListItem: TRealICQContacterListItem;
  9588. RealICQFriendTreeView: TRealICQContacterTreeView;
  9589. RealICQContacterTreeView: TRealICQContacterTreeView;
  9590. Employee: TRealICQEmployee;
  9591. Friend: TRealICQEmployee;
  9592. begin
  9593. ItemIndex := FSearchListView.Items.IndexOf(ALoginName);
  9594. if ItemIndex >= 0 then
  9595. begin
  9596. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9597. RealICQContacterListItem.StopFlash;
  9598. end;
  9599. if (RealICQClient.WorkingMode = wmCorporation) or (FShowTree and (TFriendsService.GetService.IsFriend(ALoginName)) and (TWorkmatesService.GetService.IsWorkmate(ALoginName))) then
  9600. begin
  9601. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  9602. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9603. if RealICQContacterTreeView <> nil then
  9604. begin
  9605. Employee := RealICQContacterTreeView.GetEmployee(ALoginName);
  9606. if Employee <> nil then
  9607. Employee.StopFlash
  9608. else
  9609. begin
  9610. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9611. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9612. if RealICQFriendTreeView <> nil then
  9613. begin
  9614. Friend := RealICQFriendTreeView.GetEmployee(ALoginName);
  9615. if Friend <> nil then
  9616. Friend.StopFlash;
  9617. end;
  9618. end;
  9619. end;
  9620. end
  9621. else
  9622. begin
  9623. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  9624. if RealICQContacterListView <> nil then
  9625. begin
  9626. ItemIndex := RealICQContacterListView.Items.IndexOf(ALoginName);
  9627. if ItemIndex >= 0 then
  9628. begin
  9629. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9630. RealICQContacterListItem.StopFlash;
  9631. end;
  9632. end;
  9633. end;
  9634. end;
  9635. procedure TMainForm.WMHotKeyHandle(var Msg: TWMHotKey);
  9636. var
  9637. iLoop: Integer;
  9638. AForm: TTalkingForm;
  9639. begin
  9640. msg.Result := 1; //该消息已经处理
  9641. if msg.HotKey = HotKeyID_ReadMessage then
  9642. begin
  9643. TrayIconDblClick(TrayIcon);
  9644. end;
  9645. if msg.HotKey = HotKeyID_CopyScreen then
  9646. begin
  9647. for iLoop := 0 to TalkingForms.Count - 1 do
  9648. begin
  9649. AForm := TalkingForms[iLoop];
  9650. if AForm.Active then
  9651. begin
  9652. ShowCopyScreenForm(AForm);
  9653. Exit;
  9654. end;
  9655. end;
  9656. ShowCopyScreenForm(nil);
  9657. end;
  9658. end;
  9659. //------------------------------------------------------------------------------
  9660. procedure TMainForm.ShowRealICQMessage(RealICQMessage: TRealICQMessage; ShowSendFailed: Boolean; ARealICQClient: TRealICQClient);
  9661. var
  9662. LoginName: string;
  9663. iIndex, ItemIndex: Integer;
  9664. TalkingForm: TTalkingForm;
  9665. MessageList: TList;
  9666. NotReadMessage: TNotReadMessage;
  9667. RealICQContacterListView: TRealICQContacterListView;
  9668. RealICQContacterListItem: TRealICQContacterListItem;
  9669. RealICQContacterTreeView: TRealICQContacterTreeView;
  9670. Employee: TRealICQEmployee;
  9671. RealICQFriendTreeView: TRealICQContacterTreeView;
  9672. Friend: TRealICQEmployee;
  9673. NeedAddToNotReadMessages: Boolean;
  9674. begin
  9675. try
  9676. RealICQMessage.MessageStr := TTextMessageService.GetService.ContentFilter(RealICQMessage);
  9677. FDBHistory.SaveMessage('-1', RealICQMessage.Sender, RealICQMessage.Receiver, RealICQMessage.SendDateTime, RealICQMessage.FontStr, RealICQMessage.MessageStr, RealICQMessage.IsEncryMessage);
  9678. if RealICQMessage.IsEncryMessage then
  9679. RealICQMessage.ID := FDBHistory.GetMaxMessageId;
  9680. finally
  9681. if AnsiSameText(RealICQMessage.Sender, ARealICQClient.LoginName) then
  9682. LoginName := RealICQMessage.Receiver
  9683. else
  9684. LoginName := RealICQMessage.Sender;
  9685. TalkingForm := GetTalkingForm(LoginName, ARealICQClient);
  9686. if TalkingForm = nil then
  9687. NeedAddToNotReadMessages := True
  9688. else
  9689. NeedAddToNotReadMessages := not TalkingForm.CanWriteMessage;
  9690. if NeedAddToNotReadMessages then
  9691. begin
  9692. NotReadMessage := TNotReadMessage.Create;
  9693. NotReadMessage.FRealICQMessage := RealICQMessage;
  9694. NotReadMessage.FShowSendFailed := ShowSendFailed;
  9695. NotReadMessage.FRealICQClient := ARealICQClient;
  9696. iIndex := FNotReadMessages.IndexOf(LoginName);
  9697. if iIndex >= 0 then
  9698. begin
  9699. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  9700. MessageList.Add(NotReadMessage);
  9701. end
  9702. else
  9703. begin
  9704. if MessageBoxForm = nil then
  9705. begin
  9706. {$region '跳动头像'}
  9707. ItemIndex := FSearchListView.Items.IndexOf(LoginName);
  9708. if ItemIndex >= 0 then
  9709. begin
  9710. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9711. if FlashImageOnGetMessage then
  9712. RealICQContacterListItem.Flash(fsJump);
  9713. end;
  9714. if (RealICQClient.WorkingMode = wmCorporation) or (FShowTree and TUsersService.GetUsersService.IsWorkmateOrFriend(LoginName)) then
  9715. begin
  9716. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  9717. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9718. if RealICQContacterTreeView <> nil then
  9719. begin
  9720. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  9721. if Employee <> nil then
  9722. begin
  9723. if FlashImageOnGetMessage then
  9724. Employee.Flash(fsJump);
  9725. end
  9726. else
  9727. begin
  9728. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9729. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9730. if RealICQFriendTreeView <> nil then
  9731. begin
  9732. Friend := RealICQFriendTreeView.GetEmployee(LoginName);
  9733. if Friend <> nil then
  9734. if FlashImageOnGetMessage then
  9735. Friend.Flash(fsJump)
  9736. end;
  9737. end;
  9738. end;
  9739. end
  9740. else
  9741. begin
  9742. RealICQContacterListView := GetListViewByLoginName(LoginName);
  9743. if RealICQContacterListView <> nil then
  9744. begin
  9745. ItemIndex := RealICQContacterListView.Items.IndexOf(LoginName);
  9746. if ItemIndex >= 0 then
  9747. begin
  9748. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9749. if FlashImageOnGetMessage then
  9750. RealICQContacterListItem.Flash(fsJump);
  9751. end;
  9752. end; // if RealICQContacterListView <> nil ...
  9753. end;
  9754. {$endregion}
  9755. end;
  9756. MessageList := TList.Create;
  9757. MessageList.Add(NotReadMessage);
  9758. FNotReadMessages.AddObject(LoginName, MessageList);
  9759. end;
  9760. if MessageBoxForm <> nil then
  9761. begin
  9762. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  9763. FlashWindow(MessageBoxForm.Handle, True);
  9764. MessageBoxForm.ShowMessage(RealICQMessage.Sender, MTUser);
  9765. end
  9766. else if (not TimerForFlashTrayIcon.Enabled) then
  9767. TimerForFlashTrayIcon.Enabled := True;
  9768. if PlaySoundOnGetMessage then
  9769. PlayEventSound(FMessageEventSound);
  9770. NotReadMessageBoxForm.ShowNotReadMessage;
  9771. NotReadMessageBoxForm.Height := 0;
  9772. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  9773. end
  9774. else
  9775. begin
  9776. if (GetForegroundWindow <> TalkingForm.Handle) then
  9777. begin
  9778. FlashWindow(TalkingForm.Handle, True);
  9779. if PlaySoundOnGetMessage then
  9780. PlayEventSound(FMessageEventSound);
  9781. end;
  9782. TalkingForm.ShowMessage(RealICQMessage, ShowSendFailed);
  9783. end;
  9784. end;
  9785. end;
  9786. //------------------------------------------------------------------------------
  9787. procedure TMainForm.RealICQClientSendedSendFileRequest(Sender, FileTransmitter: TObject);
  9788. var
  9789. PtoPFileTransmitter: TPtoPFileTransmitter;
  9790. TalkingForm: TTalkingForm;
  9791. ALoginName: string;
  9792. RealICQUser: TRealICQUser;
  9793. ItemIndex: Integer;
  9794. RealICQContacterListItem: TRealICQContacterListItem;
  9795. begin
  9796. PtoPFileTransmitter := FileTransmitter as TPtoPFileTransmitter;
  9797. if PtoPFileTransmitter.Objective = foFace then
  9798. begin
  9799. TalkingForm := GetTalkingForm(PtoPFileTransmitter.LoginName, Sender as TRealICQClient);
  9800. if TalkingForm = nil then
  9801. Exit;
  9802. end
  9803. else
  9804. begin
  9805. TalkingForm := OpenTalkingForm(PtoPFileTransmitter.LoginName, True, Sender as TRealICQClient);
  9806. end;
  9807. if TalkingForm.CanWriteMessage then
  9808. TalkingForm.ShowSendedSendFileRequest(PtoPFileTransmitter);
  9809. {$region '更新“最近联系人列表”中的数据'}
  9810. if Sender = RealICQClient then
  9811. begin
  9812. ALoginName := PtoPFileTransmitter.LoginName;
  9813. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  9814. if RealICQUser <> nil then
  9815. begin
  9816. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  9817. if ItemIndex = -1 then
  9818. ItemIndex := FLVLatests.Items.Add(ALoginName);
  9819. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9820. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  9821. RealICQContacterListItem.MoveToTop;
  9822. end;
  9823. end;
  9824. {$endregion}
  9825. end;
  9826. //------------------------------------------------------------------------------
  9827. procedure TMainForm.RealICQClientSendedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  9828. begin
  9829. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  9830. end;
  9831. procedure TMainForm.RealICQClientCancelControlRemoteControlTransmite(Sender: TObject; ALoginName: string);
  9832. var
  9833. TalkingForm: TTalkingForm;
  9834. begin
  9835. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9836. if TalkingForm = nil then
  9837. Exit;
  9838. if TalkingForm.CanWriteMessage then
  9839. TalkingForm.ShowCancelControlRemoteControlTransmite;
  9840. end;
  9841. procedure TMainForm.RealICQClientCanceledSendFolder(Sender: TObject; AID: Cardinal; ALoginName: string);
  9842. var
  9843. ReceiveFolderRequestForm: TReceiveFolderRequestForm;
  9844. iLoop: Integer;
  9845. begin
  9846. for iLoop := 0 to ReceiveFolderForms.Count - 1 do
  9847. begin
  9848. ReceiveFolderRequestForm := TReceiveFolderRequestForm(ReceiveFolderForms[iLoop]);
  9849. if (ReceiveFolderRequestForm.FID = AID) and AnsiSameText(ALoginName, ReceiveFolderRequestForm.FLoginName) then
  9850. begin
  9851. ReceiveFolderRequestForm.CanceledSendFolder;
  9852. Break;
  9853. end;
  9854. end;
  9855. end;
  9856. procedure TMainForm.RealICQClientCancelSendFile(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  9857. var
  9858. TalkingForm: TTalkingForm;
  9859. iWaitTimes: Integer;
  9860. begin
  9861. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9862. if TalkingForm <> nil then
  9863. begin
  9864. if (GetForegroundWindow <> TalkingForm.Handle) then
  9865. begin
  9866. FlashWindow(TalkingForm.Handle, True);
  9867. if PlaySoundOnGetMessage then
  9868. PlayEventSound(FMessageEventSound);
  9869. end;
  9870. iWaitTimes := 0;
  9871. while not TalkingForm.CanWriteMessage do
  9872. begin
  9873. Application.ProcessMessages;
  9874. Inc(iWaitTimes);
  9875. if iWaitTimes > 1000 then
  9876. break;
  9877. Sleep(10);
  9878. end;
  9879. TalkingForm.ShowCancelSendFile(AOppositeID);
  9880. end;
  9881. end;
  9882. procedure TMainForm.RealICQClientChangePasswordResult(Sender: TObject; APassChanged: Boolean; ANewPassword: string);
  9883. begin
  9884. end;
  9885. //------------------------------------------------------------------------------
  9886. procedure TMainForm.RealICQClientGettedSendFileRequest(Sender: TObject; SendFileRequestInfo: TSendFileRequestInfo);
  9887. var
  9888. AShowActive: Boolean;
  9889. TalkingForm: TTalkingForm;
  9890. iWaitTimes: Integer;
  9891. ALoginName: string;
  9892. RealICQUser: TRealICQUser;
  9893. ItemIndex: Integer;
  9894. RealICQContacterListItem: TRealICQContacterListItem;
  9895. begin
  9896. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  9897. TalkingForm := GetTalkingForm(SendFileRequestInfo.LoginName, Sender as TRealICQClient);
  9898. if TalkingForm = nil then
  9899. begin
  9900. TalkingForm := OpenTalkingForm(SendFileRequestInfo.LoginName, not AShowActive, Sender as TRealICQClient);
  9901. end;
  9902. iWaitTimes := 0;
  9903. while not TalkingForm.CanWriteMessage do
  9904. begin
  9905. Application.ProcessMessages;
  9906. Inc(iWaitTimes);
  9907. if iWaitTimes > 1000 then
  9908. break;
  9909. Sleep(10);
  9910. end;
  9911. if (GetForegroundWindow <> TalkingForm.Handle) and (SendFileRequestInfo.Objective = foFile) then
  9912. begin
  9913. FlashWindow(TalkingForm.Handle, True);
  9914. if PlaySoundOnGetMessage then
  9915. PlayEventSound(FMessageEventSound);
  9916. end;
  9917. TalkingForm.ShowGettedSendFileRequest(SendFileRequestInfo);
  9918. {$region '更新“最近联系人列表”中的数据'}
  9919. if Sender = RealICQClient then
  9920. begin
  9921. ALoginName := SendFileRequestInfo.LoginName;
  9922. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  9923. if RealICQUser <> nil then
  9924. begin
  9925. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  9926. if ItemIndex = -1 then
  9927. ItemIndex := FLVLatests.Items.Add(ALoginName);
  9928. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9929. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  9930. RealICQContacterListItem.MoveToTop;
  9931. end;
  9932. end;
  9933. {$endregion}
  9934. end;
  9935. procedure TMainForm.RealICQClientGettedSendFolderRequest(Sender: TObject; AID, ACount: Cardinal; ALoginName: string; AFilesStream: TStream);
  9936. var
  9937. ReceiveFolderRequestForm: TReceiveFolderRequestForm;
  9938. begin
  9939. ReceiveFolderRequestForm := TReceiveFolderRequestForm.Create(Self);
  9940. ReceiveFolderRequestForm.FCount := ACount;
  9941. ReceiveFolderRequestForm.FID := AID;
  9942. ReceiveFolderRequestForm.FLoginName := ALoginName;
  9943. ReceiveFolderRequestForm.FFilesStream := AFilesStream;
  9944. ReceiveFolderRequestForm.Show;
  9945. ReceiveFolderRequestForm.BringToFront;
  9946. end;
  9947. procedure TMainForm.RealICQClientGettedSendOfflineFileRequest(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  9948. var
  9949. TalkingForm: TTalkingForm;
  9950. iWaitTimes: Integer;
  9951. begin
  9952. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9953. if TalkingForm <> nil then
  9954. begin
  9955. if (GetForegroundWindow <> TalkingForm.Handle) then
  9956. begin
  9957. FlashWindow(TalkingForm.Handle, True);
  9958. if PlaySoundOnGetMessage then
  9959. PlayEventSound(FMessageEventSound);
  9960. end;
  9961. iWaitTimes := 0;
  9962. while not TalkingForm.CanWriteMessage do
  9963. begin
  9964. Application.ProcessMessages;
  9965. Inc(iWaitTimes);
  9966. if iWaitTimes > 1000 then
  9967. break;
  9968. Sleep(10);
  9969. end;
  9970. TalkingForm.ShowSendOfflineFileRequest(AOppositeID);
  9971. end;
  9972. end;
  9973. //------------------------------------------------------------------------------
  9974. procedure TMainForm.RealICQClientSendMessageFailed(Sender: TObject; RealICQMessage: TRealICQMessage);
  9975. begin
  9976. ShowRealICQMessage(RealICQMessage, True, Sender as TRealICQClient);
  9977. end;
  9978. //------------------------------------------------------------------------------
  9979. procedure TMainForm.RealICQClientSendTeamMessageFailed(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  9980. begin
  9981. ShowRealICQTeamMessage(RealICQTeamMessage, True);
  9982. end;
  9983. //------------------------------------------------------------------------------
  9984. procedure TMainForm.RealICQClientShakeWindow(Sender: TObject; ALoginName: string);
  9985. var
  9986. TalkingForm: TTalkingForm;
  9987. iWaitTimes: Integer;
  9988. begin
  9989. if not MainForm.ShowShakeWindow then
  9990. Exit;
  9991. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  9992. if TalkingForm = nil then
  9993. begin
  9994. TalkingForm := OpenTalkingForm(ALoginName, True, Sender as TRealICQClient);
  9995. end;
  9996. iWaitTimes := 0;
  9997. while not TalkingForm.CanWriteMessage do
  9998. begin
  9999. Application.ProcessMessages;
  10000. Inc(iWaitTimes);
  10001. if iWaitTimes > 1000 then
  10002. break;
  10003. Sleep(10);
  10004. end;
  10005. if GetTickCount - TalkingForm.LastRecvShakeWindowTicket < 150000 then
  10006. Exit;
  10007. ForceForeGroundWindow(TalkingForm.Handle);
  10008. TalkingForm.ShowShakeWindow(False);
  10009. TalkingForm.LastRecvShakeWindowTicket := GetTickCount;
  10010. end;
  10011. //------------------------------------------------------------------------------
  10012. procedure TMainForm.RealICQClientSMSResult(Sender: TObject; AMessageID: Cardinal; AResult: Integer);
  10013. var
  10014. iIndex: Integer;
  10015. SMSMessage: TSMSMessage;
  10016. begin
  10017. iIndex := SMSMessages.IndexOf(IntToStr(AMessageID));
  10018. if iIndex >= 0 then
  10019. begin
  10020. SMSMessage := SMSMessages.Objects[iIndex] as TSMSMessage;
  10021. SMSMessage.Sended := AResult = 0;
  10022. SMSMessage.SMSForm.ShowSMSMessageResult(AMessageID, AResult);
  10023. end;
  10024. end;
  10025. //------------------------------------------------------------------------------
  10026. procedure TMainForm.RealICQClientTeamInfoReady(Sender: TObject; ARealICQTeam: TRealICQTeam);
  10027. var
  10028. iLoop, iIndex: Integer;
  10029. ListItem: TRealICQContacterListItem;
  10030. MemberList: TStringList;
  10031. begin
  10032. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  10033. if iIndex = -1 then
  10034. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  10035. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  10036. if ARealICQTeam.IsTempTeam then
  10037. ListItem.Watchword := ''
  10038. else
  10039. ListItem.Watchword := ARealICQTeam.TeamIntro;
  10040. ListItem.LoginState := stLeave;
  10041. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  10042. try
  10043. for iLoop := MemberList.Count - 1 downto 0 do
  10044. begin
  10045. if Length(Trim(MemberList[iLoop])) = 0 then
  10046. MemberList.Delete(iLoop);
  10047. end;
  10048. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  10049. finally
  10050. MemberList.Free;
  10051. end;
  10052. {try
  10053. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  10054. except
  10055. ListItem.HeadImagePicture.Graphic := nil;
  10056. end; }
  10057. if ARealICQTeam.IsTempTeam then
  10058. ListItem.DisplayName := '多人对话'
  10059. else
  10060. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  10061. ListItem.Data := ARealICQTeam;
  10062. ListItem.ReDrawItem;
  10063. ShowNavBarNumeric;
  10064. // UpdateTeamOptionsForm(ARealICQTeam);
  10065. UpdateTeamTalkingForm(ARealICQTeam);
  10066. end;
  10067. //------------------------------------------------------------------------------
  10068. procedure TMainForm.RealICQClientReceivedAdversement(Sender: TObject);
  10069. begin
  10070. if (not RealICQClient.MainFormAdversement.Visible) then
  10071. begin
  10072. if pnlAdvertisement.Height > 0 then
  10073. pnlAdvertisement.Height := 0;
  10074. end
  10075. else
  10076. begin
  10077. WebBrowserForAdvertisement.OnBeforeNavigate2 := nil;
  10078. pnlForHideWebBrowser.Visible := True;
  10079. pnlForHideWebBrowser.BringToFront;
  10080. WebBrowserForAdvertisement.OnDocumentComplete := WebBrowserForAdvertisementDocumentComplete;
  10081. WebBrowserForAdvertisement.Navigate(AnsiReplaceText(AnsiReplaceText(RealICQClient.MainFormAdversement.URL, '[%LoginName%]', RealICQClient.LoginName), '[%BranchID%]', RealICQClient.Me.BranchID));
  10082. pnlWebSearch.Top := pnlAdvertisement.Top + pnlAdvertisement.Height + 1;
  10083. end;
  10084. UpdateTalkingFormAdversement;
  10085. end;
  10086. //------------------------------------------------------------------------------
  10087. procedure TMainForm.RealICQClientReceivedCustomMessage(Sender: TObject; AContent: string);
  10088. var
  10089. Contents: TStringList;
  10090. LoginName: string;
  10091. SystemMessage: TRealICQSystemMessage;
  10092. jo: ISuperObject;
  10093. reg: TPerlRegEx;
  10094. begin
  10095. if AnsiSameText('ReGetCountByReceiver', AContent) then
  10096. begin
  10097. RealICQClient.SendGetNewInformation(0);
  10098. Exit;
  10099. end;
  10100. if AnsiSameText('ReGetAnnouncement', AContent) then
  10101. begin
  10102. RealICQClient.SendGetNewInformation(1);
  10103. Exit;
  10104. end;
  10105. AContent := AnsiReplaceStr(AContent, Chr(13), '');
  10106. Contents := RealICQUtils.SplitString(AContent, Chr(10));
  10107. try
  10108. //TODO: lqq 新消息通知接口
  10109. if (Contents.Count > 1) and (CompareText(Contents[0], 'SendNotify') = 0) then
  10110. begin
  10111. jo := SO(Contents[1]);
  10112. SystemMessage := TRealICQSystemMessage.Create;
  10113. SystemMessage.MessageID := GetTickCount;
  10114. Sleep(100);
  10115. SystemMessage.MessageType := mtBroadcast;
  10116. SystemMessage.AutoOpenWindow := True;
  10117. SystemMessage.Position := mpRightBottom;
  10118. SystemMessage.Left := 0;
  10119. SystemMessage.Top := 0;
  10120. SystemMessage.Width := 258;
  10121. SystemMessage.Height := 168;
  10122. SystemMessage.Delay := 0;
  10123. SystemMessage.MaxShowTimes := 0;
  10124. SystemMessage.Title := jo.S['title'];
  10125. SystemMessage.URL := jo.S['url'];
  10126. if jo.S['appkey'] = '' then
  10127. SystemMessage.Content := Format('<a target="_blank" href="%s" style="text-decoration: none;line-height:18px;">%s</a>', [SystemMessage.URL, jo.S['content']])
  10128. else
  10129. 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']]);
  10130. SystemMessage.AutoCloseTime := 0;
  10131. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10132. Exit;
  10133. end;
  10134. if Contents.Count >= 3 then
  10135. begin
  10136. { if AnsiSameText(Contents.Strings[0], 'CONFIRMDLG') then
  10137. begin
  10138. SystemMessage := TRealICQSystemMessage.Create;
  10139. SystemMessage.MessageID :=StrToInt(Contents.Strings[5]);// GetTickCount;
  10140. Sleep(100);
  10141. SystemMessage.MessageType := mtConfirmMsg;
  10142. SystemMessage.AutoOpenWindow := True;
  10143. SystemMessage.Position := mpCenter;
  10144. SystemMessage.Width := 278;
  10145. SystemMessage.Height := 178;
  10146. SystemMessage.Delay := 0;
  10147. SystemMessage.MaxShowTimes := 0;
  10148. SystemMessage.Content := Contents.Strings[2];
  10149. SystemMessage.Title := Contents.Strings[3];
  10150. SystemMessage.URL := Contents.Strings[4]+Chr(10)+Contents.Strings[6]+Chr(10)+Contents.Strings[7];
  10151. SystemMessage.AutoCloseTime :=120;
  10152. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10153. end; }
  10154. if AnsiSameText(Contents.Strings[0], 'RJOA') or AnsiSameText(Contents.Strings[0], 'RDOA') or AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10155. begin
  10156. SystemMessage := TRealICQSystemMessage.Create;
  10157. SystemMessage.MessageID := GetTickCount;
  10158. Sleep(100);
  10159. SystemMessage.MessageType := mtBroadcast;
  10160. if AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10161. SystemMessage.MessageType := mtAdvertisement;
  10162. SystemMessage.AutoOpenWindow := True;
  10163. SystemMessage.Position := mpRightBottom;
  10164. SystemMessage.Left := 0;
  10165. SystemMessage.Top := 0;
  10166. SystemMessage.Width := 258;
  10167. SystemMessage.Height := 168;
  10168. SystemMessage.Delay := 0;
  10169. SystemMessage.MaxShowTimes := 0;
  10170. SystemMessage.Title := '系统提醒';
  10171. reg := TPerlRegEx.Create;
  10172. try
  10173. reg.Subject := Contents.Strings[2];
  10174. reg.RegEx := '<[^>]+>';
  10175. reg.Replacement := '';
  10176. while reg.MatchAgain do
  10177. begin
  10178. if (Length(reg.Groups[0]) >= 3) and ((SameText(LeftStr(reg.Groups[0], 3), '<a ')) or (SameText(LeftStr(reg.Groups[0], 3), '<a>'))) then
  10179. Continue;
  10180. if (SameText(reg.Groups[0], '</a>')) then
  10181. Continue;
  10182. reg.Replace();
  10183. end;
  10184. SystemMessage.Content := '<p style="line-height:18px; text-indent:2em;">' + reg.Subject + '</p>';
  10185. finally
  10186. reg.Free;
  10187. end;
  10188. SystemMessage.URL := '';
  10189. SystemMessage.AutoCloseTime := 0;
  10190. if AnsiSameText(Contents.Strings[0], 'RDOA') or AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10191. begin
  10192. SystemMessage.URL := Contents.Strings[4];
  10193. if Contents.Strings[6] = '1' then
  10194. begin
  10195. LoginName := RealICQClient.LoginName;
  10196. if Pos('-', RealICQClient.LoginName) > 0 then
  10197. LoginName := Copy(RealICQClient.LoginName, Pos('-', RealICQClient.LoginName) + 1, Length(RealICQClient.LoginName));
  10198. SystemMessage.URL := SystemMessage.URL + Contents.Strings[5];
  10199. end;
  10200. SystemMessage.Title := Contents.Strings[7];
  10201. end
  10202. else
  10203. begin
  10204. if Contents.Count >= 7 then
  10205. SystemMessage.URL := Contents.Strings[3];
  10206. try
  10207. if Contents.Count >= 5 then
  10208. SystemMessage.Width := StrToInt(Contents.Strings[4]);
  10209. if Contents.Count >= 6 then
  10210. SystemMessage.Height := StrToInt(Contents.Strings[5]);
  10211. if Contents.Count >= 7 then
  10212. begin
  10213. if Contents.Strings[6] = '1' then
  10214. begin
  10215. TimerForShowSystemNotices.Enabled := False;
  10216. RealICQClient.SendGetNewInformation(1);
  10217. end
  10218. else
  10219. begin
  10220. RealICQClient.SendGetNewInformation(0);
  10221. end;
  10222. end
  10223. else
  10224. begin
  10225. RealICQClient.SendGetNewInformation(0);
  10226. end;
  10227. if Contents.Count >= 8 then
  10228. SystemMessage.Title := Contents.Strings[7];
  10229. except
  10230. end;
  10231. end;
  10232. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10233. end;
  10234. if AnsiSameText(Contents.Strings[0], 'LXUMC') then
  10235. begin
  10236. // if not MainForm.ShowFileTransCompleted then Exit;
  10237. SystemMessage := TRealICQSystemMessage.Create;
  10238. SystemMessage.MessageID := GetTickCount;
  10239. SystemMessage.MessageType := mtBroadcast;
  10240. SystemMessage.AutoOpenWindow := True;
  10241. SystemMessage.Position := mpRightBottom;
  10242. SystemMessage.Left := 0;
  10243. SystemMessage.Top := 0;
  10244. SystemMessage.Width := 258;
  10245. SystemMessage.Height := 148;
  10246. SystemMessage.Delay := 0;
  10247. SystemMessage.MaxShowTimes := 0;
  10248. SystemMessage.Title := '系统提醒';
  10249. SystemMessage.Content := Contents.Strings[2];
  10250. SystemMessage.URL := '';
  10251. SystemMessage.AutoCloseTime := 0;
  10252. if Contents.Count > 3 then
  10253. SystemMessage.Title := Contents.Strings[3];
  10254. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10255. end;
  10256. if AnsiSameText(Contents.Strings[0], 'EMAIL') then
  10257. begin
  10258. if AnsiSameText(Contents.Strings[1], '0') then
  10259. begin
  10260. spbEmail.Caption := '(' + Contents.Strings[2] + ')';
  10261. end
  10262. else if AnsiSameText(Contents.Strings[1], '1') then
  10263. begin
  10264. spbEmail.Caption := '(' + IntToStr(StrToInt(ReplaceStr(ReplaceStr(spbEmail.Caption, '(', ''), ')', '')) + 1) + ')';
  10265. SystemMessage := TRealICQSystemMessage.Create;
  10266. SystemMessage.MessageID := GetTickCount;
  10267. SystemMessage.MessageType := mtBroadcast;
  10268. SystemMessage.AutoOpenWindow := True;
  10269. SystemMessage.Position := mpRightBottom;
  10270. SystemMessage.Left := 0;
  10271. SystemMessage.Top := 0;
  10272. SystemMessage.Width := 258;
  10273. SystemMessage.Height := 148;
  10274. SystemMessage.Delay := 0;
  10275. SystemMessage.MaxShowTimes := 0;
  10276. SystemMessage.Title := '系统提醒';
  10277. if AnsiSameText(Copy(Contents.Strings[3], 1, 7), 'http://') then
  10278. begin
  10279. SystemMessage.Content := '您从 <a herf="' + Contents.Strings[3] + '">' + Contents.Strings[2] + '</a> 处收到一封新邮件!';
  10280. SystemMessage.URL := Contents.Strings[3];
  10281. end
  10282. else
  10283. begin
  10284. SystemMessage.Content := '您从 ' + Contents.Strings[3] + ' 处收到一封新邮件!';
  10285. SystemMessage.URL := '';
  10286. end;
  10287. SystemMessage.AutoCloseTime := 15;
  10288. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10289. end;
  10290. end;
  10291. end;
  10292. finally
  10293. FreeAndNil(Contents);
  10294. end;
  10295. end;
  10296. //------------------------------------------------------------------------------
  10297. procedure TMainForm.RealICQClientReceivedMessage(Sender: TObject; RealICQMessage: TRealICQMessage);
  10298. var
  10299. ItemIndex: Integer;
  10300. RealICQContacterListItem: TRealICQContacterListItem;
  10301. RealICQUser: TRealICQUser;
  10302. ALoginName: string;
  10303. begin
  10304. ShowRealICQMessage(RealICQMessage, False, Sender as TRealICQClient);
  10305. {$region '更新“最近联系人列表”中的数据'}
  10306. if Sender = RealICQClient then
  10307. begin
  10308. if not AnsiSameText(RealICQMessage.Sender, RealICQClient.LoginName) then
  10309. ALoginName := RealICQMessage.Sender
  10310. else
  10311. ALoginName := RealICQMessage.Receiver;
  10312. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10313. if RealICQUser <> nil then
  10314. begin
  10315. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10316. if ItemIndex = -1 then
  10317. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10318. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10319. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10320. RealICQContacterListItem.MoveToTop;
  10321. end;
  10322. end;
  10323. {$endregion}
  10324. end;
  10325. //------------------------------------------------------------------------------
  10326. procedure TMainForm.RealICQClientReceivedOfflineAutoResponseSet(Sender: TObject; AEnabled: Boolean; AText: string);
  10327. begin
  10328. actOfflieAutoResponse.Checked := AEnabled;
  10329. if OptionsForm <> nil then
  10330. begin
  10331. OptionsForm.GetSets;
  10332. end;
  10333. end;
  10334. //------------------------------------------------------------------------------
  10335. procedure TMainForm.RealICQClientReceivedOfflineFile(Sender: TObject; ASender, AFileName: string; AFileSize: Int64; ASendDateTime: TDateTime);
  10336. var
  10337. AShowActive: Boolean;
  10338. TalkingForm: TTalkingForm;
  10339. iWaitTimes: Integer;
  10340. ALoginName: string;
  10341. RealICQUser: TRealICQUser;
  10342. ItemIndex: Integer;
  10343. RealICQContacterListItem: TRealICQContacterListItem;
  10344. begin
  10345. if AnsiSameText(ASender, RealICQClient.Me.LoginName) then
  10346. Exit;
  10347. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  10348. TalkingForm := GetTalkingForm(ASender, RealICQClient);
  10349. if TalkingForm = nil then
  10350. begin
  10351. TalkingForm := OpenTalkingForm(ASender, not AShowActive, RealICQClient);
  10352. end;
  10353. iWaitTimes := 0;
  10354. while not TalkingForm.CanWriteMessage do
  10355. begin
  10356. Application.ProcessMessages;
  10357. Inc(iWaitTimes);
  10358. if iWaitTimes > 1000 then
  10359. break;
  10360. Sleep(10);
  10361. end;
  10362. if (GetForegroundWindow <> TalkingForm.Handle) then
  10363. begin
  10364. FlashWindow(TalkingForm.Handle, True);
  10365. if PlaySoundOnGetMessage then
  10366. PlayEventSound(FMessageEventSound);
  10367. end;
  10368. TFileTransmitAdapter.Receive(TalkingForm, AFileName, 0, ASender, '', ASendDateTime, Self.RealICQClient, AFileSize);
  10369. {$region '更新“最近联系人列表”中的数据'}
  10370. if Sender = RealICQClient then
  10371. begin
  10372. ALoginName := ASender;
  10373. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10374. if RealICQUser <> nil then
  10375. begin
  10376. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10377. if ItemIndex = -1 then
  10378. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10379. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10380. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10381. RealICQContacterListItem.MoveToTop;
  10382. end;
  10383. end;
  10384. {$endregion}
  10385. end;
  10386. //------------------------------------------------------------------------------
  10387. procedure TMainForm.RealICQClientReceivedServerList(Sender: TObject; AServerList: string);
  10388. var
  10389. ServerList: TStringList;
  10390. iLoop, chrPos: Integer;
  10391. MenuItem: TMenuItem;
  10392. ServerInfo: TServerInfo;
  10393. config: TConditionConfig;
  10394. begin
  10395. config := TConditionConfig.GetConfig;
  10396. while ppServerList.Items.Count > 0 do
  10397. ppServerList.Items.Delete(0);
  10398. ServerList := SplitString(AServerList, Chr(10));
  10399. try
  10400. iLoop := 0;
  10401. while iLoop < ServerList.Count - 1 do
  10402. begin
  10403. ServerInfo := TServerInfo.Create;
  10404. ServerInfo.ServerId := ServerList[iLoop];
  10405. Inc(iLoop);
  10406. ServerInfo.ServerName := ServerList[iLoop];
  10407. Inc(iLoop);
  10408. if config.OtherServersDisable and not (UpperCase(ServerInfo.ServerId) = UpperCase(RealICQClient.ServerID)) then
  10409. begin
  10410. Continue;
  10411. end;
  10412. MenuItem := TMenuItem.Create(ppServerList);
  10413. MenuItem.AutoHotkeys := maManual;
  10414. MenuItem.AutoLineReduction := maManual;
  10415. MenuItem.Caption := '&' + ServerInfo.ServerName;
  10416. MenuItem.Hint := ServerInfo.ServerId;
  10417. MenuItem.OnClick := miChangeServerClick;
  10418. MenuItem.Tag := iLoop;
  10419. if UpperCase(ServerInfo.ServerId) = UpperCase(RealICQClient.ServerID) then
  10420. begin
  10421. edServerList.Text := ServerInfo.ServerName;
  10422. ImgLoadingMoreBranchs.Visible := True;
  10423. ScrollBoxMoreUser.Visible := False;
  10424. //RealICQClient.SendGetMoreBranch(ServerInfo.ServerId);
  10425. RealICQClient.SendGetBranchs(ServerInfo.ServerId, 0);
  10426. FCurrentServerID := ServerInfo.ServerId;
  10427. //Todo: 调用Online.exe
  10428. if FileExists(ExtractFilePath(Application.ExeName) + 'Online.exe') then
  10429. TCheckRunProcessThread.Create('Online', ExtractFilePath(Application.ExeName) + 'Online.exe')
  10430. else
  10431. Self.PostUpdateLog;
  10432. end;
  10433. FServerInfoList.AddObject(ServerInfo.ServerId, ServerInfo);
  10434. ppServerList.Items.Add(MenuItem);
  10435. end;
  10436. finally
  10437. FreeAndNil(ServerList);
  10438. end;
  10439. end;
  10440. //------------------------------------------------------------------------------
  10441. procedure TMainForm.ShowRealICQTeamMessage(RealICQTeamMessage: TRealICQTeamMessage; ShowSendFailed: Boolean);
  10442. var
  10443. nTeamID: string;
  10444. iIndex, ItemIndex: Integer;
  10445. MessageList: TList;
  10446. TalkingForm: TTalkingForm;
  10447. NotReadTeamMessage: TNotReadTeamMessage;
  10448. NeedAddToNotReadMessages: Boolean;
  10449. ListItem: TRealICQContacterListItem;
  10450. ASave: Boolean;
  10451. begin
  10452. try
  10453. ASave := AutoSaveMessage;
  10454. if Copy(RealICQTeamMessage.MessageStr, 1, 11) = '<TeamShare>' then
  10455. begin
  10456. if Copy(RealICQTeamMessage.MessageStr, Length(RealICQTeamMessage.MessageStr) - 11, 12) = '</TeamShare>' then
  10457. begin
  10458. ASave := False;
  10459. end;
  10460. end;
  10461. if ASave then
  10462. begin
  10463. FDBHistory.SaveMessage(RealICQTeamMessage.TeamID, RealICQTeamMessage.Sender, RealICQClient.LoginName, RealICQTeamMessage.SendDateTime, RealICQTeamMessage.FontStr, RealICQTeamMessage.MessageStr, RealICQTeamMessage.IsEncryMessage);
  10464. if RealICQTeamMessage.IsEncryMessage then
  10465. RealICQTeamMessage.ID := FDBHistory.GetMaxMessageId;
  10466. end;
  10467. except
  10468. end;
  10469. nTeamID := RealICQTeamMessage.TeamID;
  10470. TalkingForm := GetTeamTalkingForm(nTeamID);
  10471. if TalkingForm = nil then
  10472. NeedAddToNotReadMessages := True
  10473. else
  10474. NeedAddToNotReadMessages := not TalkingForm.CanWriteMessage;
  10475. if NeedAddToNotReadMessages then
  10476. begin
  10477. NotReadTeamMessage := TNotReadTeamMessage.Create;
  10478. NotReadTeamMessage.FRealICQTeamMessage := RealICQTeamMessage;
  10479. NotReadTeamMessage.FShowSendFailed := ShowSendFailed;
  10480. iIndex := FNotReadMessages.IndexOf(TeamMessageID + nTeamID);
  10481. if iIndex >= 0 then
  10482. begin
  10483. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  10484. MessageList.Add(NotReadTeamMessage);
  10485. end
  10486. else
  10487. begin
  10488. {$region '跳动头像'}
  10489. ItemIndex := FLVTeams.Items.IndexOf(nTeamID);
  10490. if ItemIndex >= 0 then
  10491. begin
  10492. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10493. if FlashImageOnGetMessage then
  10494. ListItem.Flash(fsJump);
  10495. end;
  10496. {$endregion}
  10497. MessageList := TList.Create;
  10498. MessageList.Add(NotReadTeamMessage);
  10499. FNotReadMessages.AddObject(TeamMessageID + nTeamID, MessageList);
  10500. TimerForFlashTrayIcon.Enabled := True;
  10501. if PlaySoundOnGetMessage then
  10502. PlayEventSound(FMessageEventSound);
  10503. end;
  10504. if MessageBoxForm <> nil then
  10505. begin
  10506. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  10507. FlashWindow(MessageBoxForm.Handle, True);
  10508. MessageBoxForm.ShowMessage(RealICQTeamMessage.Sender, MTTeam);
  10509. Exit;
  10510. end
  10511. else if (not TimerForFlashTrayIcon.Enabled) then
  10512. TimerForFlashTrayIcon.Enabled := True;
  10513. NotReadMessageBoxForm.ShowNotReadMessage;
  10514. NotReadMessageBoxForm.Height := 0;
  10515. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10516. end
  10517. else
  10518. begin
  10519. if (GetForegroundWindow <> TalkingForm.Handle) then
  10520. begin
  10521. FlashWindow(TalkingForm.Handle, True);
  10522. if PlaySoundOnGetMessage then
  10523. PlayEventSound(FMessageEventSound);
  10524. end;
  10525. TalkingForm.ShowTeamMessage(RealICQTeamMessage, ShowSendFailed);
  10526. end;
  10527. end;
  10528. procedure TMainForm.RealICQClientReceivedSMS(Sender: TObject; ASMSSender, ASMSContent: string; ASMSDateTime: TDateTime);
  10529. var
  10530. NotReadSMSMessage: TNotReadSMSMessage;
  10531. SMSForm: TSMSForm;
  10532. ASender: string;
  10533. iLoop: Integer;
  10534. ARealICQUser: TRealICQUser;
  10535. NeedAddToNotReadMessages: Boolean;
  10536. MessageList: TList;
  10537. iIndex: Integer;
  10538. AUsers: TStringList;
  10539. begin
  10540. ASender := '';
  10541. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  10542. try
  10543. for iLoop := 0 to AUsers.Count - 1 do
  10544. begin
  10545. ARealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  10546. if Length(Trim(ARealICQUser.Mobile)) < 11 then
  10547. continue;
  10548. if Pos(ARealICQUser.Mobile, ASMSSender) > 0 then
  10549. begin
  10550. ASender := ARealICQUser.LoginName;
  10551. Break;
  10552. end;
  10553. if Length(ARealICQUser.Mobile) < 10 then
  10554. begin
  10555. if AnsiSameStr('1060578' + ARealICQUser.Mobile, ASMSSender) then
  10556. begin
  10557. ASender := ARealICQUser.LoginName;
  10558. Break;
  10559. end;
  10560. end;
  10561. end;
  10562. // if ASender = '' then
  10563. // ASender := ASMSSender;
  10564. finally
  10565. FreeAndNil(AUsers);
  10566. end;
  10567. SMSForm := GetSMSForm(ASender);
  10568. NotReadSMSMessage := TNotReadSMSMessage.Create;
  10569. NotReadSMSMessage.FSMSSender := ASMSSender;
  10570. NotReadSMSMessage.FSMSContent := ASMSContent;
  10571. NotReadSMSMessage.FSMSDateTime := ASMSDateTime;
  10572. iIndex := FNotReadMessages.IndexOf(SMSMessageID + ASender);
  10573. if iIndex >= 0 then
  10574. begin
  10575. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  10576. MessageList.Add(NotReadSMSMessage);
  10577. end
  10578. else
  10579. begin
  10580. MessageList := TList.Create;
  10581. MessageList.Add(NotReadSMSMessage);
  10582. FNotReadMessages.AddObject(SMSMessageID + ASender, MessageList);
  10583. TimerForFlashTrayIcon.Enabled := True;
  10584. if PlaySoundOnGetMessage then
  10585. PlayEventSound(FMessageEventSound);
  10586. end;
  10587. if SMSForm = nil then
  10588. NeedAddToNotReadMessages := True
  10589. else
  10590. NeedAddToNotReadMessages := not SMSForm.CanWriteMessage;
  10591. if NeedAddToNotReadMessages then
  10592. begin
  10593. TimerForFlashTrayIcon.Enabled := True;
  10594. if PlaySoundOnGetMessage then
  10595. PlayEventSound(FMessageEventSound);
  10596. if MessageBoxForm <> nil then
  10597. begin
  10598. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  10599. FlashWindow(MessageBoxForm.Handle, True);
  10600. MessageBoxForm.ShowMessage(ASender, MTSMS);
  10601. Exit;
  10602. end
  10603. else if (not TimerForFlashTrayIcon.Enabled) then
  10604. TimerForFlashTrayIcon.Enabled := True;
  10605. NotReadMessageBoxForm.ShowNotReadMessage;
  10606. NotReadMessageBoxForm.Height := 0;
  10607. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10608. end
  10609. else
  10610. begin
  10611. if (GetForegroundWindow <> SMSForm.Handle) then
  10612. begin
  10613. FlashWindow(SMSForm.Handle, True);
  10614. if PlaySoundOnGetMessage then
  10615. PlayEventSound(FMessageEventSound);
  10616. end;
  10617. //显示收到的短消息
  10618. SMSForm.LoadNotReadSMSMessages;
  10619. end;
  10620. end;
  10621. //------------------------------------------------------------------------------
  10622. procedure TMainForm.RealICQClientReceivedSystemMessage(Sender: TObject; ASystemMessage: TRealICQSystemMessage);
  10623. begin
  10624. if (ASystemMessage.MaxShowTimes = 0) or ((GetSystemMessageCounter(ASystemMessage.MessageID) < ASystemMessage.MaxShowTimes) and (ASystemMessage.MaxShowTimes > 0)) then
  10625. begin
  10626. try
  10627. FDBHistory.SaveSystemMessage(ASystemMessage.MessageID, ASystemMessage.MessageType, ASystemMessage.Position, ASystemMessage.Left, ASystemMessage.Top, ASystemMessage.Width, ASystemMessage.Height, ASystemMessage.Title, ASystemMessage.Content, ASystemMessage.URL, ASystemMessage.AutoCloseTime);
  10628. except
  10629. end;
  10630. FSystemMessages.Insert(0, ASystemMessage);
  10631. if TimerForShowSystemMessage.Enabled = False then
  10632. TimerForShowSystemMessage.Enabled := True;
  10633. end;
  10634. end;
  10635. //------------------------------------------------------------------------------
  10636. procedure TMainForm.ShowSystemMessage(ASystemMessage: TRealICQSystemMessage);
  10637. begin
  10638. try
  10639. OpenSystemMessageForm(IntToStr(ASystemMessage.MessageID), ASystemMessage.MessageType, ASystemMessage.Position, ASystemMessage.Left, ASystemMessage.Top, ASystemMessage.Width, ASystemMessage.Height, ASystemMessage.Title, ASystemMessage.Content, ASystemMessage.URL, ASystemMessage.AutoCloseTime);
  10640. IncSystemMessageCounter(ASystemMessage.MessageID);
  10641. finally
  10642. FreeAndNil(ASystemMessage);
  10643. end;
  10644. end;
  10645. //------------------------------------------------------------------------------
  10646. procedure TMainForm.TimerForShowSystemMessageTimer(Sender: TObject);
  10647. var
  10648. iLoop: Integer;
  10649. ASystemMessage: TRealICQSystemMessage;
  10650. begin
  10651. if FSystemMessages.Count = 0 then
  10652. TimerForShowSystemMessage.Enabled := False
  10653. else
  10654. begin
  10655. for iLoop := FSystemMessages.Count - 1 downto 0 do
  10656. begin
  10657. ASystemMessage := FSystemMessages[iLoop];
  10658. ASystemMessage.Delay := ASystemMessage.Delay - 0.2;
  10659. if ASystemMessage.Delay <= 0 then
  10660. begin
  10661. FSystemMessages.Delete(iLoop);
  10662. if ASystemMessage.AutoOpenWindow then
  10663. begin
  10664. ShowSystemMessage(ASystemMessage);
  10665. end
  10666. else
  10667. begin
  10668. FNotReadMessages.AddObject(SystemMessageID + IntToStr(ASystemMessage.MessageID), ASystemMessage);
  10669. TimerForFlashTrayIcon.Enabled := True;
  10670. if PlaySoundOnGetSystemMessage then
  10671. PlayEventSound(FSystemMessageEventSound);
  10672. NotReadMessageBoxForm.ShowNotReadMessage;
  10673. NotReadMessageBoxForm.Height := 0;
  10674. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10675. end;
  10676. end;
  10677. end;
  10678. if (self.MessageBoxForm <> nil) then
  10679. MessageBoxForm.ShowSystemMessages(FSystemMessages);
  10680. end;
  10681. end;
  10682. //------------------------------------------------------------------------------
  10683. procedure TMainForm.RealICQClientReceivedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  10684. begin
  10685. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  10686. end;
  10687. procedure TMainForm.RealICQClientReceivedVideoImage(Sender: TObject; ALoginName: string; ABitmap: TBitmap);
  10688. begin
  10689. end;
  10690. //------------------------------------------------------------------------------
  10691. procedure TMainForm.UpdateFriendNode(Friend: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  10692. var
  10693. GIFImage: TGIFImage;
  10694. jo: IsuperObject;
  10695. ARemarkTel, ARemarkMobile, ARemark: string;
  10696. begin
  10697. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10698. if jo <> nil then
  10699. begin
  10700. ARemark := jo.S['Remark'];
  10701. ARemarkTel := jo.S['Phone'];
  10702. ARemarkMobile := jo.S['Mobile'];
  10703. end;
  10704. Friend.HasCamera := RealICQUser.InstalledCamera;
  10705. Friend.Watchword := RealICQUser.Watchword;
  10706. Friend.LeaveMessage := RealICQUser.LeaveMessage;
  10707. Friend.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10708. Friend.TelephoneHint := '';
  10709. if Length(Trim(ARemarkTel)) > 0 then
  10710. begin
  10711. Friend.TelephoneHint := Friend.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10712. end;
  10713. if Length(Trim(RealICQUser.Tel)) > 0 then
  10714. begin
  10715. if Length(Trim(Friend.TelephoneHint)) > 0 then
  10716. Friend.TelephoneHint := Friend.TelephoneHint + ' ';
  10717. Friend.TelephoneHint := Friend.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10718. end;
  10719. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10720. begin
  10721. if Length(Trim(Friend.TelephoneHint)) > 0 then
  10722. Friend.TelephoneHint := Friend.TelephoneHint + ' ';
  10723. Friend.TelephoneHint := Friend.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10724. end;
  10725. Friend.HasMobilePhone := False;
  10726. Friend.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10727. Friend.HasSMS := (Length(Trim(RealICQUser.Mobile)) > 0);
  10728. if not Friend.HasTelephone then
  10729. Friend.HasTelephone := Friend.HasSMS;
  10730. Friend.Mobile := Trim(RealICQUser.Mobile);
  10731. Friend.Tel := Trim(RealICQUser.Tel);
  10732. if Length(Trim(ARemarkMobile)) > 0 then
  10733. Friend.MobilePhoneHint := Trim(ARemarkMobile)
  10734. else
  10735. Friend.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10736. Friend.HeadImageHint := '单击显示联系人卡片';
  10737. Friend.TelephoneHint := Friend.TelephoneHint;
  10738. Friend.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10739. Friend.SMSHint := Trim(Friend.MobilePhoneHint) + '(双击发送手机短信息)';
  10740. Friend.CameraHint := '双击发送视频对话邀请';
  10741. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slAllCannotSee) then
  10742. begin
  10743. Friend.TelephoneHint := '*';
  10744. Friend.MobilePhoneHint := '*';
  10745. Friend.SMSHint := '*';
  10746. end;
  10747. if FileExists(RealICQUser.HeadImageFile) then
  10748. begin
  10749. try
  10750. if (RealICQUser.HeadImageFileType = htGIF) then
  10751. begin
  10752. GIFImage := TGIFImage.Create;
  10753. GIFImage.Animate := False;
  10754. try
  10755. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10756. Friend.HeadImagePicture.Bitmap.Assign(GIFImage);
  10757. finally
  10758. GIFImage.Free;
  10759. end;
  10760. end
  10761. else
  10762. Friend.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10763. except
  10764. Friend.HeadImagePicture.Graphic := nil;
  10765. end;
  10766. end
  10767. else
  10768. Friend.HeadImagePicture.Graphic := nil;
  10769. Friend.DisplayName := RealICQUser.DisplayName;
  10770. Friend.LoginState := RealICQUser.LoginState;
  10771. Friend.Data := RealICQUser;
  10772. if AShowNavBarNumeric then
  10773. Friend.Update;
  10774. if AShowNavBarNumeric then
  10775. ShowNavBarNumeric;
  10776. end;
  10777. //------------------------------------------------------------------------------
  10778. procedure TMainForm.UpdateEmployeeNode(Employee: TRealICQEmployee; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean);
  10779. var
  10780. GIFImage: TGIFImage;
  10781. jo: ISuperObject;
  10782. ARemarkTel, ARemarkMobile, ARemark: string;
  10783. begin
  10784. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10785. if jo <> nil then
  10786. begin
  10787. ARemark := jo.S['Remark'];
  10788. ARemarkTel := jo.S['Phone'];
  10789. ARemarkMobile := jo.S['Mobile'];
  10790. end;
  10791. Employee.HasCamera := RealICQUser.InstalledCamera;
  10792. Employee.Watchword := RealICQUser.Watchword;
  10793. Employee.LeaveMessage := RealICQUser.LeaveMessage;
  10794. Employee.HasNewSNS := ShowSNS and RealICQUser.HasNewSNSUpdate;
  10795. Employee.NewSNSHint := '个人空间最近有更新,点击查看';
  10796. Employee.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10797. Employee.TelephoneHint := '';
  10798. if Length(Trim(ARemarkTel)) > 0 then
  10799. begin
  10800. Employee.TelephoneHint := Employee.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10801. end;
  10802. if Length(Trim(RealICQUser.Tel)) > 0 then
  10803. begin
  10804. if Length(Trim(Employee.TelephoneHint)) > 0 then
  10805. Employee.TelephoneHint := Employee.TelephoneHint + ' ';
  10806. Employee.TelephoneHint := Employee.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10807. end;
  10808. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10809. begin
  10810. if Length(Trim(Employee.TelephoneHint)) > 0 then
  10811. Employee.TelephoneHint := Employee.TelephoneHint + ' ';
  10812. Employee.TelephoneHint := Employee.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10813. end;
  10814. Employee.HasMobilePhone := False;
  10815. Employee.HasSMS := (Length(Trim(RealICQUser.Mobile)) > 0);
  10816. Employee.Tel := Trim(RealICQUser.Tel);
  10817. Employee.Mobile := Trim(RealICQUser.Mobile);
  10818. if Length(Trim(ARemarkMobile)) > 0 then
  10819. Employee.MobilePhoneHint := Trim(ARemarkMobile)
  10820. else
  10821. Employee.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10822. Employee.HeadImageHint := '单击显示联系人卡片';
  10823. Employee.TelephoneHint := Trim(Employee.TelephoneHint);
  10824. Employee.AddFriendHint := '双击添加好友';
  10825. Employee.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10826. Employee.SMSHint := Employee.MobilePhoneHint + '(双击发送手机短信息)';
  10827. Employee.CameraHint := '双击发送视频对话邀请';
  10828. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slAllCannotSee) and (Employee.LoginName <> MainForm.RealICQClient.Me.LoginName) then
  10829. begin
  10830. Employee.TelephoneHint := '*';
  10831. Employee.MobilePhoneHint := '*';
  10832. Employee.SMSHint := '*';
  10833. end;
  10834. if (TConditionConfig.GetConfig.UserInfoController) and (RealICQUser.Secret = slOnlyFriendCanSee) and not (TUsersService.GetUsersService.IsWorkmateOrFriend(Employee.LoginName)) then
  10835. begin
  10836. Employee.TelephoneHint := '*';
  10837. Employee.MobilePhoneHint := '*';
  10838. Employee.SMSHint := '*';
  10839. end;
  10840. if FileExists(RealICQUser.HeadImageFile) then
  10841. begin
  10842. try
  10843. if (RealICQUser.HeadImageFileType = htGIF) then
  10844. begin
  10845. GIFImage := TGIFImage.Create;
  10846. GIFImage.Animate := False;
  10847. try
  10848. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10849. Employee.HeadImagePicture.Bitmap.Assign(GIFImage);
  10850. finally
  10851. GIFImage.Free;
  10852. end;
  10853. end
  10854. else
  10855. Employee.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10856. except
  10857. Employee.HeadImagePicture.Graphic := nil;
  10858. end;
  10859. end
  10860. else
  10861. Employee.HeadImagePicture.Graphic := nil;
  10862. Employee.DisplayName := RealICQUser.DisplayName;
  10863. Employee.LoginState := RealICQUser.LoginState;
  10864. Employee.Data := RealICQUser;
  10865. if AShowNavBarNumeric then
  10866. Employee.Update;
  10867. if AShowNavBarNumeric then
  10868. ShowNavBarNumeric;
  10869. end;
  10870. //------------------------------------------------------------------------------
  10871. procedure TMainForm.BindUserDataToItem(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AShowNavBarNumeric: Boolean = True);
  10872. var
  10873. GIFImage: TGIFImage;
  10874. jo: ISuperObject;
  10875. ARemarkTel, ARemarkMobile, ARemark: string;
  10876. begin
  10877. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10878. if jo <> nil then
  10879. begin
  10880. ARemark := jo.S['Remark'];
  10881. ARemarkTel := jo.S['Phone'];
  10882. ARemarkMobile := jo.S['Mobile'];
  10883. end;
  10884. RealICQContacterListItem.HasCamera := RealICQUser.InstalledCamera;
  10885. RealICQContacterListItem.Watchword := RealICQUser.Watchword;
  10886. RealICQContacterListItem.LeaveMessage := RealICQUser.LeaveMessage;
  10887. RealICQContacterListItem.Branch := RealICQUser.Branch;
  10888. RealICQContacterListItem.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10889. RealICQContacterListItem.TelephoneHint := '';
  10890. if Length(Trim(ARemarkTel)) > 0 then
  10891. begin
  10892. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10893. end;
  10894. if Length(Trim(RealICQUser.Tel)) > 0 then
  10895. begin
  10896. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10897. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10898. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10899. end;
  10900. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10901. begin
  10902. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10903. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10904. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10905. end;
  10906. RealICQContacterListItem.HasMobilePhone := (Length(Trim(RealICQUser.Mobile)) > 0) or (Length(Trim(ARemarkMobile)) > 0);
  10907. RealICQContacterListItem.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10908. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasMobilePhone;
  10909. RealICQContacterListItem.HeadImageHint := '单击显示联系人卡片';
  10910. if Length(Trim(ARemarkMobile)) > 0 then
  10911. RealICQContacterListItem.MobilePhoneHint := Trim(ARemarkMobile)
  10912. else
  10913. RealICQContacterListItem.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10914. RealICQContacterListItem.Mobile := Trim(RealICQUser.Mobile);
  10915. RealICQContacterListItem.Tel := Trim(RealICQUser.Tel);
  10916. RealICQContacterListItem.HasMobilePhone := False;
  10917. RealICQContacterListItem.MobilePhoneHint := RealICQContacterListItem.MobilePhoneHint + '(双击发送手机短信息)';
  10918. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint;
  10919. RealICQContacterListItem.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10920. RealICQContacterListItem.SMSHint := RealICQContacterListItem.MobilePhoneHint;
  10921. RealICQContacterListItem.CameraHint := '双击发送视频对话邀请';
  10922. RealICQContacterListItem.HasTelephone := RealICQContacterListItem.HasTelephone and RealICQContacterListItem.ListView.ShowTelButton;
  10923. RealICQContacterListItem.HasMobilePhone := RealICQContacterListItem.HasMobilePhone and RealICQContacterListItem.ListView.ShowMobileButton;
  10924. RealICQContacterListItem.HasEmail := RealICQContacterListItem.HasEmail and RealICQContacterListItem.ListView.ShowEmailButton;
  10925. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasSMS and RealICQContacterListItem.ListView.ShowSMSButton;
  10926. if FileExists(RealICQUser.HeadImageFile) then
  10927. begin
  10928. try
  10929. if (RealICQUser.HeadImageFileType = htGIF) then
  10930. begin
  10931. GIFImage := TGIFImage.Create;
  10932. GIFImage.Animate := False;
  10933. try
  10934. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10935. RealICQContacterListItem.HeadImagePicture.Bitmap.Assign(GIFImage);
  10936. finally
  10937. GIFImage.Free;
  10938. end;
  10939. end
  10940. else
  10941. RealICQContacterListItem.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10942. except
  10943. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  10944. end;
  10945. end
  10946. else
  10947. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  10948. RealICQContacterListItem.DisplayName := RealICQUser.DisplayName;
  10949. RealICQContacterListItem.LoginState := RealICQUser.LoginState;
  10950. RealICQContacterListItem.Data := RealICQUser;
  10951. if AShowNavBarNumeric then
  10952. RealICQContacterListItem.ReDrawItem;
  10953. if AShowNavBarNumeric then
  10954. ShowNavBarNumeric;
  10955. end;
  10956. procedure TMainForm.BindUserDataToItemForGroup(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AGroupAlias: string; AShowNavBarNumeric: Boolean);
  10957. var
  10958. GIFImage: TGIFImage;
  10959. jo: IsuperObject;
  10960. ARemarkTel, ARemarkMobile, ARemark: string;
  10961. begin
  10962. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10963. if jo <> nil then
  10964. begin
  10965. ARemark := jo.S['Remark'];
  10966. ARemarkTel := jo.S['Phone'];
  10967. ARemarkMobile := jo.S['Mobile'];
  10968. end;
  10969. RealICQContacterListItem.HasCamera := RealICQUser.InstalledCamera;
  10970. RealICQContacterListItem.Watchword := RealICQUser.Watchword;
  10971. RealICQContacterListItem.LeaveMessage := RealICQUser.LeaveMessage;
  10972. RealICQContacterListItem.Branch := RealICQUser.Branch;
  10973. RealICQContacterListItem.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10974. RealICQContacterListItem.TelephoneHint := '';
  10975. if Length(Trim(ARemarkTel)) > 0 then
  10976. begin
  10977. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10978. end;
  10979. if Length(Trim(RealICQUser.Tel)) > 0 then
  10980. begin
  10981. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10982. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10983. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10984. end;
  10985. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10986. begin
  10987. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  10988. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  10989. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10990. end;
  10991. RealICQContacterListItem.HasMobilePhone := (Length(Trim(RealICQUser.Mobile)) > 0) or (Length(Trim(ARemarkMobile)) > 0);
  10992. RealICQContacterListItem.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10993. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasMobilePhone;
  10994. RealICQContacterListItem.HeadImageHint := '单击显示联系人卡片';
  10995. if Length(Trim(ARemarkMobile)) > 0 then
  10996. RealICQContacterListItem.MobilePhoneHint := Trim(ARemarkMobile)
  10997. else
  10998. RealICQContacterListItem.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10999. RealICQContacterListItem.Mobile := Trim(RealICQUser.Mobile);
  11000. RealICQContacterListItem.Tel := Trim(RealICQUser.Tel);
  11001. RealICQContacterListItem.HasMobilePhone := False;
  11002. RealICQContacterListItem.MobilePhoneHint := RealICQContacterListItem.MobilePhoneHint + '(双击发送手机短信息)';
  11003. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint;
  11004. RealICQContacterListItem.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  11005. RealICQContacterListItem.SMSHint := RealICQContacterListItem.MobilePhoneHint;
  11006. RealICQContacterListItem.CameraHint := '双击发送视频对话邀请';
  11007. RealICQContacterListItem.HasTelephone := RealICQContacterListItem.HasTelephone and RealICQContacterListItem.ListView.ShowTelButton;
  11008. RealICQContacterListItem.HasMobilePhone := RealICQContacterListItem.HasMobilePhone and RealICQContacterListItem.ListView.ShowMobileButton;
  11009. RealICQContacterListItem.HasEmail := RealICQContacterListItem.HasEmail and RealICQContacterListItem.ListView.ShowEmailButton;
  11010. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasSMS and RealICQContacterListItem.ListView.ShowSMSButton;
  11011. if FileExists(RealICQUser.HeadImageFile) then
  11012. begin
  11013. try
  11014. if (RealICQUser.HeadImageFileType = htGIF) then
  11015. begin
  11016. GIFImage := TGIFImage.Create;
  11017. GIFImage.Animate := False;
  11018. try
  11019. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  11020. RealICQContacterListItem.HeadImagePicture.Bitmap.Assign(GIFImage);
  11021. finally
  11022. GIFImage.Free;
  11023. end;
  11024. end
  11025. else
  11026. RealICQContacterListItem.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  11027. except
  11028. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11029. end;
  11030. end
  11031. else
  11032. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11033. RealICQContacterListItem.DisplayName := AGroupAlias; //RealICQUser.DisplayName;
  11034. RealICQContacterListItem.LoginState := RealICQUser.LoginState;
  11035. RealICQContacterListItem.Data := RealICQUser;
  11036. if AShowNavBarNumeric then
  11037. RealICQContacterListItem.ReDrawItem;
  11038. if AShowNavBarNumeric then
  11039. ShowNavBarNumeric;
  11040. end;
  11041. //------------------------------------------------------------------------------
  11042. procedure TMainForm.btCloseTopMessageClick(Sender: TObject);
  11043. begin
  11044. pnlForTopMessage.Visible := False;
  11045. FTopSystemMessage := nil;
  11046. end;
  11047. procedure TMainForm.btCustomerDisplayNameClick(Sender: TObject);
  11048. var
  11049. Point: TPoint;
  11050. begin
  11051. Point.X := 0;
  11052. Point.Y := btCustomerDisplayName.Height + 1;
  11053. Point := btCustomerDisplayName.ClientToScreen(Point);
  11054. ppChangeCustomerState.Popup(Point.X, Point.Y);
  11055. end;
  11056. procedure TMainForm.btCustomerLogoutClick(Sender: TObject);
  11057. begin
  11058. //
  11059. end;
  11060. procedure TMainForm.btLoginClick(Sender: TObject);
  11061. var
  11062. ca: ICAClient;
  11063. b: Boolean;
  11064. begin
  11065. if RealICQClient.Logining then
  11066. RealICQClient.CancelLogin
  11067. else if RealICQClient.ReConnectExecuting then
  11068. RealICQClient.CancelReConnectAndLogin
  11069. else if actLoginAs.Visible and actLoginAs.Enabled and FLoginAsSavePassword then
  11070. begin
  11071. actLoginAs.Execute
  11072. end
  11073. else if RealICQClient.Logined then
  11074. begin
  11075. RealICQClient.Logout;
  11076. end
  11077. else
  11078. begin
  11079. if GetCaConfig.GetEnable and RealICQClient.CALogin then
  11080. begin
  11081. b := actLoginAs.Enabled;
  11082. actLoginAs.Enabled := true;
  11083. actLoginAs.Execute;
  11084. actLoginAs.Enabled := b;
  11085. Exit;
  11086. end;
  11087. if Length(Trim(edLoginName.Text)) = 0 then
  11088. begin
  11089. MessageBox(Handle, '请输入用户名!', '提示', MB_ICONINFORMATION);
  11090. Exit;
  11091. end;
  11092. if Length(edPassword.Text) = 0 then
  11093. begin
  11094. MessageBox(Handle, '请输入密码!', '提示', MB_ICONINFORMATION);
  11095. Exit;
  11096. end;
  11097. RealICQClient.AutoLogin := FAutoLogin;
  11098. RealICQClient.Login(Trim(edLoginName.Text), edPassword.Text, FLoginState, FLeaveMessage, FSavePassword, False, False);
  11099. end;
  11100. end;
  11101. procedure TMainForm.btMainMenuClick(Sender: TObject);
  11102. var
  11103. Point: TPoint;
  11104. begin
  11105. edtSearchMoreUser.Text := '';
  11106. Point.X := 0;
  11107. Point.Y := btMainMenu.top;
  11108. Point := btMainMenu.ClientToScreen(Point);
  11109. ppMainMenu.Popup(Point.X, Point.Y - GetSystemMetrics(SM_CYMENU) * 10 - 8);
  11110. end;
  11111. procedure TMainForm.btnCALoginClick(Sender: TObject);
  11112. begin
  11113. RealICQClient.CALogin := not RealICQClient.CALogin;
  11114. // if RealICQClient.CALogin then
  11115. // begin
  11116. // ImgLstCheckStates.GetIcon(1, btnCaLogin.Icon);
  11117. //// edLoginName.Text := CA_TEXT;
  11118. // edLoginName.Enabled := False;
  11119. // edPassword.Enabled := False;
  11120. // spbChangeLoginName.Enabled := False;
  11121. // end
  11122. // else
  11123. // begin
  11124. // ImgLstCheckStates.GetIcon(0, btnCaLogin.Icon);
  11125. //// edLoginName.Text := '';
  11126. // edLoginName.Enabled := True;
  11127. // edPassword.Enabled := True;
  11128. // spbChangeLoginName.Enabled := True;
  11129. // end;
  11130. SetLoginStateControlState;
  11131. end;
  11132. //------------------------------------------------------------------------------
  11133. procedure TMainForm.cbxURLInputerDropDown(Sender: TObject);
  11134. var
  11135. iLoop: Integer;
  11136. Items: TStringList;
  11137. begin
  11138. Items := TStringList.Create;
  11139. try
  11140. GetIEHistory(Items);
  11141. cbxURLInputer.ItemsEx.Clear;
  11142. for iLoop := 0 to Items.Count - 1 do
  11143. begin
  11144. with cbxURLInputer.ItemsEx.Add do
  11145. begin
  11146. Caption := Items.Strings[iLoop];
  11147. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  11148. ImageIndex := 2
  11149. else if Copy(Caption, 1, 4) = 'ftp:' then
  11150. ImageIndex := 1
  11151. else
  11152. ImageIndex := 0;
  11153. end;
  11154. end;
  11155. finally
  11156. Items.Free;
  11157. end;
  11158. end;
  11159. //------------------------------------------------------------------------------
  11160. procedure TMainForm.cbxURLInputerKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  11161. begin
  11162. if Key = 13 then
  11163. spbGoClick(spbGo);
  11164. end;
  11165. //------------------------------------------------------------------------------
  11166. procedure TMainForm.cbxURLInputerSelect(Sender: TObject);
  11167. begin
  11168. spbGoClick(spbGo);
  11169. end;
  11170. //------------------------------------------------------------------------------
  11171. procedure TMainForm.SetStyleMenuChecked;
  11172. begin
  11173. case FLVStyle of
  11174. lsBigHeadImage:
  11175. actShowBigHeadImage.Checked := True;
  11176. lsMiddleHeadImage:
  11177. actShowMiddleHeadImage.Checked := True;
  11178. lsSmallHeadImage:
  11179. actShowSmallHeadImage.Checked := True;
  11180. lsNoHeadImage:
  11181. actShowNormalHeadImage.Checked := True;
  11182. end;
  11183. case FLVCaptionStyle of
  11184. csDisplayName:
  11185. actShowDisplayName.Checked := True;
  11186. csLoginName:
  11187. actShowLoginName.Checked := True;
  11188. csDisplayNameAndLoginName:
  11189. actShowAllName.Checked := True;
  11190. end;
  11191. actShowRemark.Checked := RealICQClient.ShowRemark;
  11192. end;
  11193. //------------------------------------------------------------------------------
  11194. procedure TMainForm.SetLoginStateMenuChecked;
  11195. var
  11196. LeaveMsg: string;
  11197. begin
  11198. actOnline.Checked := False;
  11199. actHidden.Checked := False;
  11200. actOffline.Checked := False;
  11201. actBusy.Checked := False;
  11202. actMute.Checked := False;
  11203. actLeave.Checked := False;
  11204. actRepast.Checked := False;
  11205. actPhone.Checked := False;
  11206. actMeeting.Checked := False;
  11207. actOtherState.Checked := False;
  11208. if RealICQClient.Me = nil then
  11209. begin
  11210. actOffline.Checked := True;
  11211. Exit;
  11212. end;
  11213. LeaveMsg := RealICQClient.Me.LeaveMessage;
  11214. if RealICQClient.Me.LoginState = stOnline then
  11215. actOnline.Checked := True
  11216. else if RealICQClient.Me.LoginState = stHidden then
  11217. actHidden.Checked := True
  11218. else if RealICQClient.Me.LoginState = stLeave then
  11219. begin
  11220. if AnsiSameText(actLeave.Caption, LeaveMsg) then
  11221. actLeave.Checked := True
  11222. else if AnsiSameText(actRepast.Caption, LeaveMsg) then
  11223. actRepast.Checked := True
  11224. else if AnsiSameText(actMeeting.Caption, LeaveMsg) then
  11225. actMeeting.Checked := True
  11226. else
  11227. actOtherState.Checked := True;
  11228. end
  11229. else if RealICQClient.Me.LoginState = stBusy then
  11230. begin
  11231. if AnsiSameText(actBusy.Caption, LeaveMsg) then
  11232. actBusy.Checked := True
  11233. else if AnsiSameText(actPhone.Caption, LeaveMsg) then
  11234. actPhone.Checked := True
  11235. else
  11236. actOtherState.Checked := True;
  11237. end
  11238. else if RealICQClient.Me.LoginState = stMute then
  11239. actMute.Checked := True
  11240. else
  11241. actOtherState.Checked := True;
  11242. end;
  11243. //------------------------------------------------------------------------------
  11244. procedure TMainForm.ShowMeInformation;
  11245. var
  11246. ADisplayName, ATrueDisplayName, AWatchword, AStateMsg: WideString;
  11247. HeadPic: TPicture;
  11248. GIFImage: TGIFImage;
  11249. begin
  11250. if RealICQClient.Me = nil then
  11251. Exit;
  11252. if FNotReadMessages.Count = 0 then
  11253. begin
  11254. case RealICQClient.Me.LoginState of
  11255. stOffline:
  11256. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  11257. stOnline:
  11258. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Online.ico');
  11259. stLeave:
  11260. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\leave.ico');
  11261. stBusy:
  11262. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Busy.ico');
  11263. stMute:
  11264. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Mute.ico');
  11265. stHidden:
  11266. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\invisible.ico');
  11267. end;
  11268. TrayIcon.SetDefaultIcon;
  11269. end;
  11270. if FileExists(RealICQClient.Me.HeadImageFile) then
  11271. begin
  11272. try
  11273. if (RealICQClient.Me.HeadImageFileType = htGIF) then
  11274. begin
  11275. GIFImage := TGIFImage.Create;
  11276. GIFImage.Animate := FShowGIFInMailForm and (RealICQClient.Me.LoginState <> stHidden);
  11277. try
  11278. GIFImage.LoadFromFile(RealICQClient.Me.HeadImageFile);
  11279. if GIFImage.Animate then
  11280. imgHead.Picture.Assign(GIFImage)
  11281. else
  11282. imgHead.Picture.Bitmap.Assign(GIFImage);
  11283. finally
  11284. GIFImage.Free;
  11285. end;
  11286. end
  11287. else
  11288. imgHead.Picture.LoadFromFile(RealICQClient.Me.HeadImageFile);
  11289. except
  11290. imgHead.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  11291. end;
  11292. end
  11293. else
  11294. begin
  11295. imgHead.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  11296. end;
  11297. {if RealICQClient.Me.LoginState = stHidden then
  11298. begin
  11299. HeadPic := TPicture.Create;
  11300. try
  11301. HeadPic.Bitmap.Assign(imgHead.Picture.Graphic);
  11302. Grayscale(HeadPic.Bitmap);
  11303. imgHead.Picture.Bitmap.Assign(HeadPic.Bitmap);
  11304. finally
  11305. HeadPic.Free;
  11306. end;
  11307. end;
  11308. imgLeave.Visible := False;}
  11309. case RealICQClient.Me.LoginState of
  11310. stOffline:
  11311. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Offline.ico');
  11312. stOnline:
  11313. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Online.ico');
  11314. stLeave:
  11315. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  11316. stBusy:
  11317. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Busy.ico');
  11318. stMute:
  11319. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Mute.ico');
  11320. stHidden:
  11321. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\invisible.ico');
  11322. end;
  11323. if (RealICQClient.Me.LoginState = stLeave) or (RealICQClient.Me.LoginState = stBusy) then
  11324. AStateMsg := RealICQClient.Me.LeaveMessage
  11325. else
  11326. AStateMsg := StateValues[Integer(RealICQClient.Me.LoginState)];
  11327. ATrueDisplayName := RealICQClient.Me.Nickname;
  11328. ADisplayName := ATrueDisplayName + '(' + AStateMsg + ')';
  11329. spbDisplayName.Hint := ADisplayName;
  11330. spbDisplayName.ShowHint := False;
  11331. TrayIcon.Hint := Application.Title + ' - ' + ADisplayName;
  11332. AWatchword := RealICQClient.Me.Watchword;
  11333. if Length(Trim(AWatchword)) = 0 then
  11334. AWatchword := '在此键入您的个性签名';
  11335. spbWatchword.Hint := AWatchword;
  11336. spbWatchword.ShowHint := False;
  11337. btn_lock_DisplayName.Caption := ADisplayName; // + Format('(%s)', [StateValues[Integer(RealICQClient.Me.LoginState)]]);
  11338. btn_lock_DisplayName.AutoSize := False;
  11339. btn_lock_DisplayName.AutoSize := True;
  11340. btn_lock_DisplayName.Update;
  11341. img_lock_HeadPrev.Picture := imgHead.Picture;
  11342. //字符串长度过长时,截短字符串并在后面显示“...”
  11343. while spbDisplayName.Canvas.TextWidth(ADisplayName) > pnlTop.Width - 86 do
  11344. begin
  11345. if Length(ATrueDisplayName) > 3 then
  11346. begin
  11347. if Copy(ATrueDisplayName, Length(ATrueDisplayName) - 2, Length(ATrueDisplayName)) = '...' then
  11348. ATrueDisplayName := Copy(ATrueDisplayName, 1, Length(ATrueDisplayName) - 3);
  11349. ATrueDisplayName := Copy(ATrueDisplayName, 1, Length(ATrueDisplayName) - 1) + '...';
  11350. end
  11351. else if Length(AStateMsg) > 3 then
  11352. begin
  11353. if Copy(AStateMsg, Length(AStateMsg) - 2, Length(AStateMsg)) = '...' then
  11354. AStateMsg := Copy(AStateMsg, 1, Length(AStateMsg) - 3);
  11355. AStateMsg := Copy(AStateMsg, 1, Length(AStateMsg) - 1) + '...';
  11356. end
  11357. else
  11358. break;
  11359. ADisplayName := ATrueDisplayName + '(' + AStateMsg + ')';
  11360. spbDisplayName.ShowHint := True;
  11361. end;
  11362. //字符串长度过长时,截短字符串并在后面显示“...”
  11363. while spbWatchword.Canvas.TextWidth(AWatchword) > pnlTop.Width - 86 do
  11364. begin
  11365. if Length(AWatchword) > 3 then
  11366. begin
  11367. if Copy(AWatchword, Length(AWatchword) - 2, Length(AWatchword)) = '...' then
  11368. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 3);
  11369. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 1) + '...';
  11370. end
  11371. else
  11372. break;
  11373. spbWatchword.ShowHint := True;
  11374. end;
  11375. spbDisplayName.Caption := ADisplayName;
  11376. spbWatchword.Caption := AWatchword;
  11377. edWatchword.Text := RealICQClient.Me.Watchword;
  11378. if OptionsForm <> nil then
  11379. begin
  11380. OptionsForm.ShowHeadImage;
  11381. OptionsForm.GetSets;
  11382. end;
  11383. SetLoginStateMenuChecked;
  11384. end;
  11385. //------------------------------------------------------------------------------
  11386. procedure TMainForm.RealICQClientGetDBProcedureResult(Sender: TObject; DBProcedureName, ArgIn, ArgOut: string);
  11387. var
  11388. WebPanel: TWebPanel;
  11389. WebTabAcount: TWebTabAcount;
  11390. StrList1, StrList2: TStringList;
  11391. iLoop, iIndex: Integer;
  11392. begin
  11393. if AnsiSameText(DBProcedureName, 'YJ_AddTempRemark') then
  11394. begin
  11395. 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);
  11396. end;
  11397. if AnsiSameText(DBProcedureName, 'GetWebTabAcounts') then
  11398. begin
  11399. StrList1 := SplitString(ArgOut, Chr(13));
  11400. for iLoop := 0 to StrList1.Count - 1 do
  11401. begin
  11402. if StrList1.Strings[iLoop] = '' then
  11403. Continue;
  11404. StrList2 := SplitString(StrList1.Strings[iLoop], Chr(10));
  11405. WebTabAcount := TWebTabAcount.Create;
  11406. try
  11407. WebTabAcount.FWebTabID := StrToInt(StrList2.Strings[0]);
  11408. WebTabAcount.FTitle := StrList2.Strings[1];
  11409. WebTabAcount.LoginName := StrList2.Strings[2];
  11410. WebTabAcount.FPassword := StrList2.Strings[3];
  11411. WebTabAcount.FExplain := StrList2.Strings[4];
  11412. iIndex := FWebPanels.IndexOf(IntToStr(WebTabAcount.FWebTabID));
  11413. if iIndex >= 0 then
  11414. begin
  11415. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  11416. WebPanel.FAcounts.Add(WebTabAcount);
  11417. end;
  11418. except
  11419. FreeAndNil(WebTabAcount);
  11420. end;
  11421. end;
  11422. end;
  11423. end;
  11424. procedure TMainForm.RealICQClientGetNotReadMessageCount(Sender: TObject; iCount: Integer);
  11425. begin
  11426. spbShowNotReadMessage.Caption := Format('(%d)', [iCount]);
  11427. end;
  11428. procedure TMainForm.RealICQClientGetSystemNoticesCount(Sender: TObject; iCount: Integer; NoticesRecords: array of TSystemNotices);
  11429. var
  11430. iLoop: Integer;
  11431. ANoticesRecord: TSystemNotices;
  11432. begin
  11433. FLastGetSystemNoticesTicket := GetTickCount;
  11434. while FSystemNotices.Count > 0 do
  11435. begin
  11436. ANoticesRecord := FSystemNotices[0];
  11437. FSystemNotices.Delete(0);
  11438. try
  11439. FreeAndNil(ANoticesRecord);
  11440. except
  11441. end;
  11442. end;
  11443. for iLoop := Low(NoticesRecords) to High(NoticesRecords) do
  11444. begin
  11445. ANoticesRecord := NoticesRecords[iLoop];
  11446. FSystemNotices.Add(ANoticesRecord);
  11447. end;
  11448. pnlForTopMessage.Visible := iCount > 0;
  11449. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  11450. FSystemNoticeIndex := 0;
  11451. if pnlForTopMessage.Visible then
  11452. begin
  11453. ShowSystemNotices;
  11454. end;
  11455. end;
  11456. procedure TMainForm.TimerForShowSystemNoticesTimer(Sender: TObject);
  11457. begin
  11458. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  11459. btNextLogClick(nil);
  11460. if GetTickCount - FLastGetSystemNoticesTicket > 60000 * 30 then
  11461. begin
  11462. TimerForShowSystemNotices.Enabled := False;
  11463. RealICQClient.SendGetNewInformation(1);
  11464. end;
  11465. end;
  11466. procedure TMainForm.TimerForShowUserCardTimer(Sender: TObject);
  11467. begin
  11468. TimerForShowUserCard.Enabled := False;
  11469. TimerForHideUserCard.Enabled := False;
  11470. if not Assigned(UserCardViewForm) then
  11471. UserCardViewForm := TUserCardViewForm.Create(Self);
  11472. // UserCardViewForm.LoginName := FNeedShowUserCardLoginName;
  11473. UserCardViewForm.TargetTop := FShowUserCardTargetTop;
  11474. UserCardViewForm.Update(FNeedShowUserCardLoginName);
  11475. // if not Assigned(UserCardForm) then UserCardForm := TUserCardForm.Create(Self);
  11476. // TUsersService.GetUsersService.GetOrRequestUser(FNeedShowUserCardLoginName, RealICQClient);
  11477. // UserCardForm.LoginName := FNeedShowUserCardLoginName;
  11478. // UserCardForm.TargetTop := FShowUserCardTargetTop;
  11479. end;
  11480. procedure TMainForm.ShowSystemNotices;
  11481. var
  11482. ANoticesRecord: TSystemNotices;
  11483. begin
  11484. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  11485. while ANoticesRecord.EndDate < Now do
  11486. begin
  11487. FSystemNotices.Delete(FSystemNoticeIndex);
  11488. FreeAndNil(ANoticesRecord);
  11489. if FSystemNotices.Count > 0 then
  11490. begin
  11491. if FSystemNoticeIndex >= FSystemNotices.Count then
  11492. FSystemNoticeIndex := FSystemNotices.Count - 1;
  11493. if FSystemNoticeIndex < 0 then
  11494. FSystemNoticeIndex := 0;
  11495. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  11496. end
  11497. else
  11498. begin
  11499. pnlForTopMessage.Visible := False;
  11500. TimerForShowSystemNotices.Enabled := False;
  11501. Exit;
  11502. end;
  11503. end;
  11504. lblLogsTitle.Caption := Format('系统公告(%d/%d)', [FSystemNoticeIndex + 1, FSystemNotices.Count]);
  11505. lblLogs.Caption := ANoticesRecord.Title;
  11506. lblLogs.Hint := ANoticesRecord.Title + '(有效期:' + DateTimeToStr(ANoticesRecord.EndDate) + ')';
  11507. TimerForShowSystemNotices.Enabled := False;
  11508. TimerForShowSystemNotices.Enabled := FSystemNotices.Count > 0;
  11509. end;
  11510. procedure TMainForm.btNextLogClick(Sender: TObject);
  11511. begin
  11512. Inc(FSystemNoticeIndex, 1);
  11513. if FSystemNoticeIndex >= FSystemNotices.Count then
  11514. FSystemNoticeIndex := 0;
  11515. ShowSystemNotices;
  11516. end;
  11517. procedure TMainForm.btn_lockClick(Sender: TObject);
  11518. var
  11519. iLoop: Integer;
  11520. AForm: TSMSForm;
  11521. begin
  11522. if Assigned(MessageBoxForm) then
  11523. MessageBoxForm.Hide;
  11524. if Assigned(MessagesManagerForm) then
  11525. MessagesManagerForm.Visible := False;
  11526. if Assigned(SearchForm) then
  11527. SearchForm.Visible := False;
  11528. for iLoop := SMSForms.Count - 1 downto 0 do
  11529. begin
  11530. AForm := SMSForms[iLoop];
  11531. AForm.Visible := False;
  11532. end;
  11533. pnlLocked.Visible := True;
  11534. pnlLocked.BringToFront;
  11535. ChangeTalkingFormVisible(False);
  11536. end;
  11537. procedure TMainForm.btn_unlockClick(Sender: TObject);
  11538. var
  11539. APassword: string;
  11540. iLoop: Integer;
  11541. AForm: TSMSForm;
  11542. begin
  11543. actOpenMainForm.Execute;
  11544. APassword := ShowMyInputBox(PChar('解锁'), PChar('请输入您的登录密码以解除锁定状态! '), '', 32);
  11545. if Trim(APassword) = '' then
  11546. Exit;
  11547. if AnsiSameText(APassword, MainForm.RealICQClient.Password) then
  11548. begin
  11549. ChangeTalkingFormVisible(True);
  11550. pnlLocked.Visible := False;
  11551. pnlMiddleClient.Visible := RealICQClient.Logined and RealICQClient.Connected;
  11552. if Assigned(MessagesManagerForm) then
  11553. MessagesManagerForm.Visible := True;
  11554. if Assigned(SearchForm) then
  11555. SearchForm.Visible := True;
  11556. for iLoop := SMSForms.Count - 1 downto 0 do
  11557. begin
  11558. AForm := SMSForms[iLoop];
  11559. AForm.Visible := True;
  11560. end;
  11561. end
  11562. else
  11563. begin
  11564. showmessage('您输入的密码有误! ');
  11565. end;
  11566. end;
  11567. procedure TMainForm.btPrevLogClick(Sender: TObject);
  11568. begin
  11569. Dec(FSystemNoticeIndex, 1);
  11570. if FSystemNoticeIndex < 0 then
  11571. FSystemNoticeIndex := FSystemNotices.Count - 1;
  11572. ShowSystemNotices;
  11573. end;
  11574. procedure TMainForm.spbShowNotReadMessageClick(Sender: TObject);
  11575. begin
  11576. { if MessageBoxForm=nil then
  11577. begin
  11578. MessageBoxForm:=TMessageBoxForm.Create(self);
  11579. end;
  11580. MessageBoxForm.Show; }
  11581. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(InBoxURL)])), '', SW_SHOWDEFAULT);
  11582. end;
  11583. //----------------------------------------------
  11584. procedure TMainForm.OpenNewWorkDisk(Path: string);
  11585. var
  11586. UserInfo: string;
  11587. C: TCopyDataStruct;
  11588. hwnd: THandle;
  11589. begin
  11590. WinExec(PChar(ExtractFilePath(Application.ExeName) + Path), sw_show);
  11591. UserInfo := RealICQClient.LoginName + #10 + RealICQClient.Password;
  11592. with c do
  11593. begin
  11594. dwData := WM_COPYDATA;
  11595. lpData := PChar(UserInfo + #0);
  11596. cbData := Length(UserInfo) + 2;
  11597. end;
  11598. hWnd := FindWindow(pchar('TMainForm'), pchar('网络存储'));
  11599. if hWnd <> 0 then
  11600. SendMessage(hwnd, WM_COPYDATA, 0, integer(@c));
  11601. end;
  11602. //---------------------------------------------------
  11603. procedure TMainForm.SaveBranchUserDataToXML(FileName: string);
  11604. var
  11605. iLoop: Integer;
  11606. XMLDocument: TXMLDocument;
  11607. Nodes, BranchsNode, BranchNode, UsersNode, UserNode: IXMLNode;
  11608. BranchInfo: TRealICQBranchInfo;
  11609. RealICQUser: TRealICQUser;
  11610. LoginName: string;
  11611. AUsers: TStringList;
  11612. begin
  11613. XMLDocument := TXMLDocument.Create(Self);
  11614. try
  11615. try
  11616. XMLDocument.Active := True;
  11617. if not FileExists(FileName) then
  11618. begin
  11619. XMLDocument.XML.Text := '<?xml version="1.0"?><Data>' + '<Branchs>' + '</Branchs>' + '<Users>' + '</Users></Data>';
  11620. XMLDocument.Active := True;
  11621. end
  11622. else
  11623. begin
  11624. XMLDocument.LoadFromFile(FileName);
  11625. end;
  11626. Nodes := XMLDocument.DocumentElement;
  11627. BranchsNode := Nodes.ChildNodes.Get(0);
  11628. UsersNode := Nodes.ChildNodes.Get(1);
  11629. BranchsNode.ChildNodes.Clear;
  11630. UsersNode.ChildNodes.Clear;
  11631. for iLoop := 0 to self.RealICQClient.Branchs.Count - 1 do
  11632. begin
  11633. BranchInfo := RealICQClient.Branchs.Objects[iLoop] as TRealICQBranchInfo;
  11634. BranchNode := BranchsNode.AddChild('Branch');
  11635. BranchNode.Attributes['ID'] := BranchInfo.ID;
  11636. BranchNode.Attributes['Name'] := BranchInfo.BranchName;
  11637. BranchNode.Attributes['ParentID'] := BranchInfo.ParentID;
  11638. end;
  11639. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  11640. try
  11641. for iLoop := 0 to AUsers.Count - 1 do
  11642. begin
  11643. RealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  11644. LoginName := RealICQUser.LoginName;
  11645. if AnsiPos('+', LoginName) > 0 then
  11646. LoginName := Copy(LoginName, AnsiPos('+', LoginName) + 1, Length(LoginName) - AnsiPos('+', LoginName));
  11647. UserNode := UsersNode.AddChild('User');
  11648. UserNode.Attributes['LoginName'] := LoginName;
  11649. UserNode.Attributes['DisplayName'] := RealICQUser.DisplayName;
  11650. UserNode.Attributes['BranchID'] := RealICQUser.BranchID;
  11651. end;
  11652. finally
  11653. FreeAndNil(AUsers);
  11654. end;
  11655. XMLDocument.SaveToFile(FileName);
  11656. except
  11657. on E: Exception do
  11658. showmessage(e.Message);
  11659. end;
  11660. finally
  11661. XMLDocument.Free;
  11662. end;
  11663. end;
  11664. //------网络存储-------------------------------------
  11665. procedure TMainForm.spbNetworkBackupClick(Sender: TObject);
  11666. var
  11667. UserInfo, LoginName: string;
  11668. C: TCopyDataStruct;
  11669. hwnd: THandle;
  11670. FilePath: string;
  11671. begin
  11672. FilePath := ExtractFilePath(paramstr(0)) + 'NetworkBackup\';
  11673. SaveBranchUserDataToXml(FilePath + 'BranchUsers.XML');
  11674. LoginName := RealICQClient.LoginName;
  11675. if AnsiPos('+', LoginName) > 0 then
  11676. LoginName := Copy(LoginName, AnsiPos('+', LoginName) + 1, Length(LoginName) - AnsiPos('+', LoginName));
  11677. WinExec(PChar(FilePath + 'NetworkBackup.exe ' + LoginName + ' ' + RealICQClient.Password), sw_show);
  11678. end;
  11679. procedure TMainForm.RealICQClientGettedAudioTransmiteConnectted(Sender: TObject; ALoginName: string);
  11680. var
  11681. TalkingForm: TTalkingForm;
  11682. begin
  11683. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11684. if TalkingForm = nil then
  11685. Exit;
  11686. if TalkingForm.CanWriteMessage then
  11687. TalkingForm.ShowGettedAudioTransmiteConnectted;
  11688. end;
  11689. //------------------------------------------------------------------------------
  11690. procedure TMainForm.RealICQClientGettedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  11691. var
  11692. AShowActive: Boolean;
  11693. TalkingForm: TTalkingForm;
  11694. iWaitTimes: Integer;
  11695. begin
  11696. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  11697. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11698. if TalkingForm = nil then
  11699. begin
  11700. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  11701. end;
  11702. iWaitTimes := 0;
  11703. while not TalkingForm.CanWriteMessage do
  11704. begin
  11705. Application.ProcessMessages;
  11706. Inc(iWaitTimes);
  11707. if iWaitTimes > 1000 then
  11708. break;
  11709. Sleep(10);
  11710. end;
  11711. if (GetForegroundWindow <> TalkingForm.Handle) then
  11712. begin
  11713. FlashWindow(TalkingForm.Handle, True);
  11714. if PlaySoundOnGetMessage then
  11715. PlayEventSound(FMessageEventSound);
  11716. end;
  11717. TalkingForm.ShowGettedAudioTransmiteRequest;
  11718. end;
  11719. //------------------------------------------------------------------------------
  11720. procedure TMainForm.RealICQClientGettedAudioTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  11721. var
  11722. TalkingForm: TTalkingForm;
  11723. begin
  11724. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11725. if TalkingForm = nil then
  11726. Exit;
  11727. if TalkingForm.CanWriteMessage then
  11728. TalkingForm.ShowGettedAudioTransmiteResponse(AAcceptted);
  11729. end;
  11730. //------显示全市页面查询结果------------------------------------------------------------------------
  11731. procedure TMainForm.RealICQClientSearchUserResult(Sender: TObject);
  11732. var
  11733. iIndex, iLoop: Integer;
  11734. ListItem: TRealICQContacterListItem;
  11735. RealICQUser: TRealICQUser;
  11736. Branch: TRealICQBranch;
  11737. RealICQContacterTreeView: TRealICQContacterTreeView;
  11738. begin
  11739. iIndex := FContacterListViews.IndexOf(LVMoreUsers);
  11740. FSearchMoreUserListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  11741. for iLoop := 0 to RealICQClient.SearchUsers.Count - 1 do
  11742. begin
  11743. RealICQUser := RealICQClient.SearchUsers.Objects[iLoop] as TRealICQUser;
  11744. iIndex := FSearchMoreUserListView.Items.IndexOf(RealICQUser.LoginName);
  11745. if iIndex = -1 then
  11746. begin
  11747. iIndex := FSearchMoreUserListView.Items.Add(RealICQUser.LoginName);
  11748. ListItem := FSearchMoreUserListView.Items.Objects[iIndex] as TRealICQContacterListItem;
  11749. ListItem.DisplayName := RealICQUser.DisplayName;
  11750. ListItem.LoginState := RealICQUser.LoginState;
  11751. ListItem.Data := RealICQUser;
  11752. Application.ProcessMessages;
  11753. end;
  11754. end;
  11755. RealICQContacterTreeView := FContacterTreeViews.Objects[FContacterTreeViews.IndexOf(LVMoreUsers)] as TRealICQContacterTreeView;
  11756. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  11757. begin
  11758. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  11759. if (AnsiPos(UpperCase(RealICQClient.KeyWord), UpperCase(Branch.BranchName)) > 0) or (AnsiPos(UpperCase(RealICQClient.KeyWord), GetPYIndexString(Branch.BranchName)) > 0) then
  11760. begin
  11761. iIndex := FSearchMoreUserListView.Items.Add(Branch.BranchName);
  11762. ListItem := FSearchMoreUserListView.Items.Objects[iIndex] as TRealICQContacterListItem;
  11763. ListItem.DisplayName := Branch.BranchName;
  11764. ListItem.LoginState := stOnline;
  11765. ListItem.StateIndex := 0;
  11766. ListItem.Data := Branch;
  11767. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  11768. end;
  11769. end;
  11770. PostMessage(FSearchMoreUserListView.Handle, WM_SIZE, 0, 0);
  11771. ImgLogining.Visible := False;
  11772. ScrollBoxSearchMoreUser.Visible := FSearchMoreUserListView.Items.Count > 0;
  11773. LblSearchHint.Visible := not ScrollBoxSearchMoreUser.Visible;
  11774. LblSearchHint.Caption := '没有找到相关记录';
  11775. end;
  11776. procedure TMainForm.RealICQClientSendedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  11777. var
  11778. TalkingForm: TTalkingForm;
  11779. begin
  11780. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11781. if TalkingForm = nil then
  11782. Exit;
  11783. if TalkingForm.CanWriteMessage then
  11784. TalkingForm.ShowSendedAudioTransmiteRequest;
  11785. end;
  11786. procedure TMainForm.RealICQClientSendedRemoteControlTransmiteControlRequest(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.ShowSendedRemoteControlTransmiteControlRequest;
  11795. end;
  11796. procedure TMainForm.RealICQClientSendedRemoteControlTransmiteRequest(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.ShowSendedRemoteControlTransmiteRequest;
  11805. end;
  11806. //------------------------------------------------------------------------------
  11807. procedure TMainForm.RealICQClientGettedCancelAudioTransmite(Sender: TObject; ALoginName: string);
  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.ShowCanceledAudioTransmite;
  11816. end;
  11817. procedure TMainForm.RealICQClientGettedCancelRemoteControlTransmite(Sender: TObject; ALoginName: string);
  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.ShowCanceledRemoteControlTransmite;
  11826. end;
  11827. //------------------------------------------------------------------------------
  11828. procedure TMainForm.RealICQClientGettedStopAudioTransmite(Sender: TObject; ALoginName: string; AIsStopper: 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.ShowStoppedAudioTransmite(AIsStopper);
  11837. end;
  11838. procedure TMainForm.RealICQClientGettedStopRemoteControlTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  11839. var
  11840. TalkingForm: TTalkingForm;
  11841. begin
  11842. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11843. if TalkingForm = nil then
  11844. Exit;
  11845. if TalkingForm.CanWriteMessage then
  11846. TalkingForm.ShowStoppedRemoteControlTransmite(AIsStopper);
  11847. end;
  11848. //------------------------------------------------------------------------------
  11849. procedure TMainForm.RealICQClientGettedVideoTransmiteConnectted(Sender: TObject; ALoginName: string; ASendBigBmp, ARecvBigBmp: Boolean);
  11850. var
  11851. TalkingForm: TTalkingForm;
  11852. begin
  11853. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11854. if TalkingForm = nil then
  11855. Exit;
  11856. if TalkingForm.CanWriteMessage then
  11857. TalkingForm.ShowGettedVideoTransmiteConnectted(ASendBigBmp, ARecvBigBmp);
  11858. end;
  11859. //------------------------------------------------------------------------------
  11860. procedure TMainForm.RealICQClientGettedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  11861. var
  11862. AShowActive: Boolean;
  11863. TalkingForm: TTalkingForm;
  11864. iWaitTimes: Integer;
  11865. begin
  11866. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  11867. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11868. if TalkingForm = nil then
  11869. begin
  11870. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  11871. end;
  11872. iWaitTimes := 0;
  11873. while not TalkingForm.CanWriteMessage do
  11874. begin
  11875. Application.ProcessMessages;
  11876. Inc(iWaitTimes);
  11877. if iWaitTimes > 1000 then
  11878. break;
  11879. Sleep(10);
  11880. end;
  11881. if (GetForegroundWindow <> TalkingForm.Handle) then
  11882. begin
  11883. FlashWindow(TalkingForm.Handle, True);
  11884. if PlaySoundOnGetMessage then
  11885. PlayEventSound(FMessageEventSound);
  11886. end;
  11887. TalkingForm.ShowGettedVideoTransmiteRequest;
  11888. end;
  11889. //------------------------------------------------------------------------------
  11890. procedure TMainForm.RealICQClientGettedVideoTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  11891. var
  11892. TalkingForm: TTalkingForm;
  11893. begin
  11894. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11895. if TalkingForm = nil then
  11896. Exit;
  11897. if TalkingForm.CanWriteMessage then
  11898. TalkingForm.ShowGettedVideoTransmiteResponse(AAcceptted);
  11899. end;
  11900. procedure TMainForm.RealICQClientGettedWebUrl(Sender: TObject);
  11901. begin
  11902. // if trim(RealICQClient.WeatherUrl)<>'' then
  11903. // begin
  11904. // FDownFile.OnComplete:=DownFileComplete;
  11905. // FDownFile.ThreadDownFile(RealICQClient.WeatherUrl,ExtractFilePath(Application.ExeName)+'Weather.txt');
  11906. // end;
  11907. end;
  11908. //------------------------------------------------------------------------------
  11909. procedure TMainForm.RealICQClientSendedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  11910. var
  11911. TalkingForm: TTalkingForm;
  11912. begin
  11913. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11914. if TalkingForm = nil then
  11915. Exit;
  11916. if TalkingForm.CanWriteMessage then
  11917. TalkingForm.ShowSendedVideoTransmiteRequest;
  11918. end;
  11919. //------------------------------------------------------------------------------
  11920. procedure TMainForm.RealICQClientGettedCancelVideoTransmite(Sender: TObject; ALoginName: string);
  11921. var
  11922. TalkingForm: TTalkingForm;
  11923. begin
  11924. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11925. if TalkingForm = nil then
  11926. Exit;
  11927. if TalkingForm.CanWriteMessage then
  11928. TalkingForm.ShowCanceledVideoTransmite;
  11929. end;
  11930. procedure TMainForm.RealICQClientGettedCanSendSMSCount(Sender: TObject);
  11931. begin
  11932. UpdateCanSendSMSCount;
  11933. end;
  11934. //------------------------------------------------------------------------------
  11935. procedure TMainForm.RealICQClientGettedStopVideoTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  11936. var
  11937. TalkingForm: TTalkingForm;
  11938. begin
  11939. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11940. if TalkingForm = nil then
  11941. Exit;
  11942. if TalkingForm.CanWriteMessage then
  11943. TalkingForm.ShowStoppedVideoTransmite(AIsStopper);
  11944. end;
  11945. //---显示黑名单-------------------------------------------------------------
  11946. procedure TMainForm.ShowBlacklists;
  11947. var
  11948. iLoop, ItemIndex: Integer;
  11949. RealICQUser: TRealICQUser;
  11950. FriendTreeView: TRealICQContacterTreeView;
  11951. Friend: TRealICQEmployee;
  11952. begin
  11953. SetFlashCaptionOnOnlineValue(False);
  11954. try
  11955. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  11956. FriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  11957. for iLoop := 0 to RealICQClient.Blacklists.Count - 1 do
  11958. begin
  11959. RealICQUser := RealICQClient.Blacklists.Objects[iLoop] as TRealICQUser;
  11960. if trim(RealICQUser.DisplayName) = '' then
  11961. TUsersService.GetUsersService.GetOrRequestUser(RealICQUser.LoginName, RealICQClient);
  11962. if (FriendTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then
  11963. Continue;
  11964. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  11965. Friend.BranchID := LVBlackLists;
  11966. FriendTreeView.AddEmployee(Friend);
  11967. UpdateFriendNode(Friend, RealICQUser, False);
  11968. end;
  11969. finally
  11970. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  11971. end;
  11972. end;
  11973. //------------------------------------------------------------------------------
  11974. procedure TMainForm.RealICQClientGettedBlacklists(Sender: TObject);
  11975. begin
  11976. ShowBlacklists;
  11977. end;
  11978. //-------显示与自己不同部门的联系人------------------------------
  11979. procedure TMainForm.RealICQClientGettedBranchUser(Sender: TObject);
  11980. var
  11981. iLoop, ItemIndex: Integer;
  11982. RealICQUser: TRealICQUser;
  11983. RealICQContacterTreeView: TRealICQContacterTreeView;
  11984. Employee: TRealICQEmployee;
  11985. TmpBranch, RootBranch: TRealICQBranch;
  11986. OnlineEmployee: Integer;
  11987. begin
  11988. // TmpBranch:=nil;
  11989. // RootBranch:=nil;
  11990. // ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  11991. // RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  11992. // RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  11993. // RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  11994. // RealICQContacterTreeView.AdjustPosition :=False;
  11995. // RealICQContacterTreeView.HideSystemScrollBar;
  11996. // pgcMainWorkArea.DisableAlign;
  11997. // RealICQContacterTreeView.BeginUpdate;
  11998. // try
  11999. // ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户');
  12000. // if ItemIndex>=0 then
  12001. // RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12002. // OnlineEmployee:=0;
  12003. //
  12004. // for iLoop:=0 to RealICQContacterTreeView.EmployeeItems.Count-1 do
  12005. // begin
  12006. // Employee:=RealICQContacterTreeView.EmployeeItems.Objects[iLoop] as TRealICQEmployee;
  12007. // if (Employee.LoginState <> stOffline) and (Employee.LoginState <> stHidden) then
  12008. // OnlineEmployee := OnlineEmployee + 1;
  12009. // end;
  12010. // for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12011. // begin
  12012. // TmpBranch:=RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  12013. // if not TmpBranch.IsGetUserList then
  12014. // begin
  12015. // TmpBranch.OnlineEmployee:=0;
  12016. // TmpBranch.EmployeeCount:=0;
  12017. // TmpBranch.IsGetUserList:=True;
  12018. // end;
  12019. // if (TmpBranch.ParentID='0') then
  12020. // RootBranch:=TmpBranch
  12021. // end;
  12022. // if RootBranch<>nil then
  12023. // begin
  12024. // RootBranch.OnlineEmployee:=OnlineEmployee;
  12025. // RootBranch.EmployeeCount:= RealICQContacterTreeView.EmployeeItems.Count;
  12026. // end;
  12027. // {$region '添加联系人'}
  12028. // for iLoop := RealICQClient.Friends.Count - 1 downto 0 do
  12029. // begin
  12030. // RealICQUser := RealICQClient.Friends.Objects[iLoop] as TRealICQUser;
  12031. // if (RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then Continue;
  12032. // if AnsiSameText(RealICQUser.BranchID, 'U') then Continue;
  12033. //
  12034. // Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12035. // Employee.BranchID := RealICQUser.BranchID;
  12036. // Employee.HasAddFreindButton:=False;
  12037. // Employee.HasEmail :=False;
  12038. // RealICQContacterTreeView.AddEmployee(Employee);
  12039. // if Assigned(Employee.Node.Parent) then
  12040. // begin
  12041. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12042. // end
  12043. // else
  12044. // FreeAndNil(Employee);
  12045. // end;
  12046. // {$endregion}
  12047. // PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12048. // finally
  12049. // RealICQContacterTreeView.EndUpdate;
  12050. // pgcMainWorkArea.EnableAlign;
  12051. // end;
  12052. end;
  12053. //------------------------------------------------------------------------------
  12054. procedure TMainForm.LoadLatests;
  12055. var
  12056. FLatestUsers: TStringList;
  12057. RealICQUser: TRealICQUser;
  12058. RealICQContacterListItem: TRealICQContacterListItem;
  12059. iLoop, ItemIndex: Integer;
  12060. LoginName: string;
  12061. begin
  12062. FLatestUsers := DBHistory.GetLatests(RealICQClient.LoginName);
  12063. try
  12064. for iLoop := 0 to FLatestUsers.Count - 1 do
  12065. begin
  12066. if iLoop >= 20 then
  12067. Break;
  12068. LoginName := FLatestUsers[iLoop];
  12069. if (AnsiPos('+', LoginName) <= 0) and (trim(RealICQClient.CenterServerID) <> '') then
  12070. LoginName := RealICQClient.CenterServerID + '+' + LoginName;
  12071. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  12072. if RealICQUser = nil then
  12073. Continue;
  12074. if not AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  12075. begin
  12076. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  12077. if ItemIndex = -1 then
  12078. ItemIndex := FLVLatests.Items.Add(RealICQUser.LoginName);
  12079. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  12080. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  12081. end;
  12082. end;
  12083. finally
  12084. FreeAndNil(FLatestUsers);
  12085. end;
  12086. end;
  12087. //------------------------------------------------------------------------------
  12088. procedure TMainForm.GetOtherBranchs;
  12089. var
  12090. iLoop: Integer;
  12091. RealICQUser: TRealICQUser;
  12092. ALoginNames: string;
  12093. begin
  12094. ALoginNames := '';
  12095. for iLoop := 0 to FNotAddedEmployeeList.Count - 1 do
  12096. begin
  12097. RealICQUser := FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  12098. ALoginNames := ALoginNames + RealICQUser.LoginName;
  12099. if (iLoop < FNotAddedEmployeeList.Count - 1) then
  12100. ALoginNames := ALoginNames + Chr(10);
  12101. end;
  12102. if (Length(Trim(ALoginNames)) > 0) then
  12103. RealICQClient.SendGetFriendsInfo(ALoginNames);
  12104. end;
  12105. //-----计算某个部门的总上线人数和总用户数-----------------------------------
  12106. procedure TMainForm.GetBranchEmpOnlineAndSum(Branchs: TStringList; BranchInfo: TRealICQBranchInfo; var OnlineEmployee, EmployeeCount: Integer);
  12107. var
  12108. iLoop: Integer;
  12109. TmpBranchInfo: TRealICQBranchInfo;
  12110. begin
  12111. OnlineEmployee := OnlineEmployee + BranchInfo.OnlineEmployee;
  12112. EmployeeCount := EmployeeCount + BranchInfo.EmployeeCount;
  12113. for iLoop := 0 to Branchs.Count - 1 do
  12114. begin
  12115. TmpBranchInfo := Branchs.Objects[iLoop] as TRealICQBranchInfo;
  12116. if TmpBranchInfo.ParentID = BranchInfo.ID then
  12117. begin
  12118. GetBranchEmpOnlineAndSum(Branchs, TmpBranchInfo, OnlineEmployee, EmployeeCount);
  12119. end;
  12120. end;
  12121. end;
  12122. //------------------------------------------------------------------------------
  12123. procedure TMainForm.ShowBranchAndUsers(ExpandSelfNode: Boolean = False);
  12124. var
  12125. iLoop, ItemIndex: Integer;
  12126. OnlineEmployee, EmployeeCount: Integer;
  12127. RealICQUser: TRealICQUser;
  12128. RealICQContacterTreeView: TRealICQContacterTreeView;
  12129. BranchInfo: TRealICQBranchInfo;
  12130. Branch: TRealICQBranch;
  12131. Employee: TRealICQEmployee;
  12132. ParentNode: TTreeNode;
  12133. begin
  12134. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  12135. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12136. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12137. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12138. RealICQContacterTreeView.AdjustPosition := False;
  12139. RealICQContacterTreeView.HideSystemScrollBar;
  12140. //pgcMainWorkArea.DisableAlign;
  12141. { TODO -olqq -c : 添加部门和用户 2015/3/14 17:03:49 }
  12142. { TODO -olqq -c : 需要考虑 2015/3/14 17:05:43 }
  12143. RealICQContacterTreeView.BeginUpdate;
  12144. try
  12145. // {$region '添加部门'}
  12146. for iLoop := 0 to RealICQClient.Branchs.Count - 1 do
  12147. begin
  12148. BranchInfo := RealICQClient.Branchs.Objects[iLoop] as TRealICQBranchInfo;
  12149. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12150. Continue;
  12151. OnlineEmployee := 0;
  12152. EmployeeCount := 0;
  12153. GetBranchEmpOnlineAndSum(RealICQClient.Branchs, BranchInfo, OnlineEmployee, EmployeeCount);
  12154. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12155. Branch.BranchID := BranchInfo.ID;
  12156. Branch.ParentID := BranchInfo.ParentID;
  12157. Branch.IsGetUserList := False;
  12158. Branch.OnlineEmployee := OnlineEmployee;
  12159. Branch.EmployeeCount := EmployeeCount;
  12160. RealICQContacterTreeView.AddBranch(Branch);
  12161. end;
  12162. //
  12163. // RealICQContacterTreeView.ReAlignBranchs;
  12164. // {$endregion}
  12165. // {$region '添加联系人'}
  12166. //
  12167. // for iLoop := RealICQClient.Friends.Count - 1 downto 0 do
  12168. // begin
  12169. // RealICQUser := RealICQClient.Friends.Objects[iLoop] as TRealICQUser;
  12170. //
  12171. // if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  12172. // begin
  12173. // ShowMeInformation;
  12174. // end;
  12175. // //if (RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then Continue;
  12176. //
  12177. // Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12178. // Employee.BranchID := RealICQUser.BranchID;
  12179. // Employee.HasEmail :=False;// (Length(Trim(RealICQUser.Email)) > 0);
  12180. // Employee.HasAddFreindButton:=False;
  12181. //
  12182. //
  12183. // if not AnsiSameText(Employee.BranchID, 'U') then
  12184. // begin
  12185. // RealICQContacterTreeView.AddEmployee(Employee);
  12186. // if Assigned(Employee.Node.Parent) then
  12187. // begin
  12188. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12189. // end
  12190. // else
  12191. // begin
  12192. // FreeAndNil(Employee);
  12193. // if AnsiPos('-',RealICQUser.LoginName)>0 then
  12194. // begin
  12195. // // RealICQClient.GetUserInformation(RealICQUser.LoginName,True);
  12196. // if (FNotAddedEmployeeList.IndexOf(RealICQUser.LoginName)) < 0 then
  12197. // FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  12198. // end;
  12199. // end;
  12200. // end
  12201. // else
  12202. // begin
  12203. //
  12204. // if AnsiPos('-',RealICQUser.LoginName)>0 then
  12205. // begin
  12206. // TUsersService.GetUsersService.RequestUserInformation(RealICQUser.LoginName, RealICQClient);
  12207. // if (FNotAddedEmployeeList.IndexOf(RealICQUser.LoginName)) < 0 then
  12208. // FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  12209. // end;
  12210. // end;
  12211. // end;
  12212. // {$endregion}
  12213. // {$region '展开自己所在的部门树'}
  12214. if ExpandSelfNode then
  12215. begin
  12216. Employee := RealICQContacterTreeView.GetEmployee(RealICQClient.Me.LoginName);
  12217. ParentNode := Employee.Node.Parent;
  12218. while ParentNode <> nil do
  12219. begin
  12220. ParentNode.Expanded := True;
  12221. Branch := ParentNode.Data;
  12222. Branch.IsGetUserList := True;
  12223. ParentNode := ParentNode.Parent;
  12224. end;
  12225. RealICQContacterTreeView.MoveScrollBarToTop;
  12226. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12227. end;
  12228. {$endregion}
  12229. finally
  12230. RealICQContacterTreeView.EndUpdate;
  12231. //pgcMainWorkArea.EnableAlign;
  12232. end;
  12233. GetOtherBranchs;
  12234. end;
  12235. //-------------
  12236. procedure TMainForm.ShowBranchAndFriends;
  12237. begin
  12238. end;
  12239. //------------------------------------------------------------------------------
  12240. procedure TMainForm.RealICQClientUsersBranchReady(Sender: TObject);
  12241. begin
  12242. //
  12243. end;
  12244. //------------------------------------------------------------------------------
  12245. procedure TMainForm.RealICQClientGettedFriendList(Sender: TObject);
  12246. begin
  12247. RealICQClient.OnGetCanSendSMSCount := Self.RealICQClientGettedCanSendSMSCount;
  12248. lblLoginState.Caption := '载入联系人列表...';
  12249. lblLoginState.Refresh;
  12250. try
  12251. if tsCustomers.Parent <> nil then
  12252. begin
  12253. tsCustomers.Parent := nil;
  12254. tsCustomers.PageControl := nil;
  12255. pgcMainWorkArea.RemoveControl(tsCustomers);
  12256. end;
  12257. except
  12258. end;
  12259. { TODO -olqq -c : 需要考虑 2015/3/14 17:06:30 }
  12260. //读取最近的联系人列表
  12261. try
  12262. LoadLatests;
  12263. except
  12264. end;
  12265. {$region '读取配置信息'}
  12266. try
  12267. //读取组配置信息
  12268. LoadGroupConfigs;
  12269. except
  12270. DeleteFile(TRealICQClient.GetUserDir + GroupConfigXMLFile);
  12271. LoadGroupConfigs;
  12272. end;
  12273. try
  12274. //读取样式
  12275. LoadStyleConfigs;
  12276. except
  12277. DeleteFile(TRealICQClient.GetUserDir + StyleConfigXMLFile);
  12278. LoadStyleConfigs;
  12279. end;
  12280. try
  12281. //读取热键设置
  12282. LoadHotKeyConfigs;
  12283. except
  12284. DeleteFile(TRealICQClient.GetUserDir + HotKeyConfigXMLFile);
  12285. LoadHotKeyConfigs;
  12286. end;
  12287. try
  12288. //读取消息提示和声音配置信息
  12289. LoadHintAndSoundConfigs;
  12290. except
  12291. DeleteFile(TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile);
  12292. LoadHintAndSoundConfigs;
  12293. end;
  12294. try
  12295. //读取文件传输配置选项
  12296. LoadReceiveFileConfigs;
  12297. except
  12298. DeleteFile(TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile);
  12299. LoadReceiveFileConfigs;
  12300. end;
  12301. try
  12302. //读取安全配置选项
  12303. LoadSafeConfigs;
  12304. except
  12305. DeleteFile(TRealICQClient.GetUserDir + SafeConfigXMLFile);
  12306. LoadSafeConfigs;
  12307. end;
  12308. try
  12309. //读取字体,表情等信息
  12310. LoadInputConfigs;
  12311. except
  12312. DeleteFile(TRealICQClient.GetUserDir + InputConfigXMLFile);
  12313. LoadInputConfigs;
  12314. end;
  12315. try
  12316. //读取出差设置
  12317. LoadOfflineAutoResponseSets;
  12318. except
  12319. DeleteFile(TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile);
  12320. LoadOfflineAutoResponseSets;
  12321. end;
  12322. {$endregion}
  12323. SetFlashCaptionOnOnlineValue(False);
  12324. FCanAlert := False;
  12325. // ShowBranchAndUsers(True);
  12326. try
  12327. //重新保存组成员列表
  12328. SaveGroupConfigs;
  12329. except
  12330. end;
  12331. FCanAlert := True;
  12332. ChangeUIColor(FUIMainColor);
  12333. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  12334. try
  12335. CheckCacheDir;
  12336. except
  12337. end;
  12338. try
  12339. ShowGroupInterface;
  12340. except
  12341. end;
  12342. spbShowNotReadMessage.Caption := Format('(%d)', [0]);
  12343. RealICQClient.SendGetNewInformation(0);
  12344. Sleep(50);
  12345. pnlForTopMessage.Visible := False;
  12346. RealICQClient.SendGetNewInformation(1);
  12347. if ScrollBoxTeam.Visible or PnlMoreUser.Visible or ScrollBoxMyFriend.Visible or ScrollBoxLatests.Visible then
  12348. else
  12349. SetToolBarState(MyContacters);
  12350. try
  12351. RealICQClientReceivedAdversement(nil);
  12352. except
  12353. end;
  12354. RealICQClient.SendGetMoreServerList;
  12355. // PostMessage(Handle, WM_SIZE, 0, 0);
  12356. //Application.ProcessMessages;
  12357. RealICQClient.SendGetWebUrl;
  12358. if FIsLogout then
  12359. RealICQClient.SendGetMoreServerList;
  12360. MainForm.RealICQClient.OnGettedAddrBookGroups := GettedAddrBookGroups;
  12361. MainForm.RealICQClient.OnManageAddrBookResult := GettedManageAddrBookResult;
  12362. RealICQClient.SendGetAddrBookGroup;
  12363. // if RealICQClient.ShowMiniPage then
  12364. // RealICQClient.SendGetNewInformation(2);
  12365. if TCustomerConfig.GetConfig.ShowGuideView then
  12366. btShowMiniPageClick(nil);
  12367. try
  12368. pgcMainWorkArea.ActivePageIndex := 0;
  12369. except
  12370. end;
  12371. end;
  12372. procedure TMainForm.TimerForGetBranchOnlineStatesTimer(Sender: TObject);
  12373. begin
  12374. miChangeServerClick(nil);
  12375. TimerForGetBranchUsersOnlineStates.Enabled := False;
  12376. TimerForGetBranchUsersOnlineStates.Enabled := True;
  12377. end;
  12378. procedure TMainForm.TimerForGetBranchUsersOnlineStatesTimer(Sender: TObject);
  12379. var
  12380. iLoop, ItemIndex: Integer;
  12381. RealICQContacterTreeView: TRealICQContacterTreeView;
  12382. Branch: TRealICQBranch;
  12383. StrBranchs: string;
  12384. begin
  12385. TimerForGetBranchUsersOnlineStates.Enabled := False;
  12386. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12387. if ItemIndex >= 0 then
  12388. begin
  12389. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12390. StrBranchs := '';
  12391. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12392. begin
  12393. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  12394. if Branch.Node.Expanded then
  12395. begin
  12396. StrBranchs := StrBranchs + Branch.BranchID + ',';
  12397. end;
  12398. end;
  12399. miChangeServerClick(nil);
  12400. if Length(StrBranchs) > 0 then
  12401. RealICQClient.SendGetMoreUser(StrBranchs, FCurrentServerID);
  12402. end;
  12403. end;
  12404. procedure TMainForm.btShowMiniPageClick(Sender: TObject);
  12405. var
  12406. AShowMiniPageSet, AShowMiniPageWhenEverLoginSet: Boolean;
  12407. jo: ISuperObject;
  12408. begin
  12409. jo := SO();
  12410. if TConditionConfig.GetConfig.RemoteUI then
  12411. begin
  12412. jo.S['url'] := Format('%s/guideview/index.html?v=%d', [TConditionConfig.GetConfig.RemoteUIHost, GetTickCount]);
  12413. end
  12414. else
  12415. jo.S['url'] := ExtractFilePath(paramstr(0)) + 'html/guideview/#/';
  12416. jo.S['caption'] := '引导页';
  12417. jo.B['center'] := True;
  12418. jo.B['unsizeable'] := True;
  12419. // if not Assigned(AGuideViewForm) then
  12420. AGuideViewForm := TGuideViewForm.Create(Self);
  12421. AGuideViewForm.SetFormInfo(jo.AsString);
  12422. AGuideViewForm.Show;
  12423. // AShowMiniPageSet := RealICQClient.ShowMiniPageSet;
  12424. // AShowMiniPageWhenEverLoginSet := RealICQClient.ShowMiniPageWhenEverLoginSet;
  12425. // try
  12426. // RealICQClient.ShowMiniPageSet := True;
  12427. // RealICQClient.ShowMiniPageWhenEverLoginSet := True;
  12428. // RealICQClientGettedMiniPageSets(nil);
  12429. // finally
  12430. // RealICQClient.ShowMiniPageSet := AShowMiniPageSet;
  12431. // RealICQClient.ShowMiniPageWhenEverLoginSet := AShowMiniPageWhenEverLoginSet;
  12432. // end;
  12433. end;
  12434. procedure TMainForm.RealICQClientGettedMiniPageSets(Sender: TObject);
  12435. var
  12436. SystemMessage: TRealICQSystemMessage;
  12437. UserLoginName: string;
  12438. begin
  12439. //if (Sender <> nil) then
  12440. if not RealICQClient.ShowMiniPageSet then
  12441. Exit;
  12442. SystemMessage := TRealICQSystemMessage.Create;
  12443. SystemMessage.MessageID := 10000;
  12444. SystemMessage.MessageType := mtAdvertisement;
  12445. SystemMessage.AutoOpenWindow := True;
  12446. SystemMessage.Position := mpCenter;
  12447. SystemMessage.Left := 0;
  12448. SystemMessage.Top := 0;
  12449. SystemMessage.Width := 618;
  12450. SystemMessage.Height := 465;
  12451. SystemMessage.Delay := 0;
  12452. SystemMessage.MaxShowTimes := 0;
  12453. SystemMessage.Title := '每日新闻';
  12454. SystemMessage.Content := '';
  12455. UserLoginName := MainForm.RealICQClient.LoginName;
  12456. if Pos('+', UserLoginName) > 0 then
  12457. UserLoginName := Copy(UserLoginName, Pos('+', UserLoginName) + 1, Length(UserLoginName));
  12458. //SystemMessage.URL := Format(MiniPageURL, [UserLoginName]);
  12459. SystemMessage.URL := Format(RealICQClient.WebAppBaseURL + MiniPageURL, [UserLoginName]);
  12460. SystemMessage.AutoCloseTime := 0;
  12461. if RealICQClient.ShowMiniPageWhenEverLoginSet then
  12462. SystemMessage.MaxShowTimes := 0
  12463. else
  12464. SystemMessage.MaxShowTimes := 1;
  12465. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  12466. end;
  12467. procedure TMainForm.RealICQClientGettedMoreBranchList(Sender: TObject);
  12468. var
  12469. iLoop, jLoop, ItemIndex: Integer;
  12470. RealICQContacterTreeView: TRealICQContacterTreeView;
  12471. BranchInfo: TRealICQBranchInfo;
  12472. Branch, TopBranch: TRealICQBranch;
  12473. OnlineEmployee, EmployeeCount: Integer;
  12474. AFinded: Boolean;
  12475. Employee: TRealICQEmployee;
  12476. begin
  12477. AFinded := False;
  12478. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12479. if ItemIndex >= 0 then
  12480. begin
  12481. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12482. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12483. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12484. for iLoop := 0 to RealICQClient.MoreBranchs.Count - 1 do
  12485. begin
  12486. BranchInfo := RealICQClient.MoreBranchs.Objects[iLoop] as TRealICQBranchInfo;
  12487. if BranchInfo.ParentID = '0' then
  12488. begin
  12489. for jLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12490. begin
  12491. Branch := RealICQContacterTreeView.BranchItems.Objects[jLoop] as TRealICQBranch;
  12492. if (Branch.ParentID = '0') and AnsiSameText(Branch.BranchID, BranchInfo.ID) then
  12493. begin
  12494. AFinded := True;
  12495. Break;
  12496. end;
  12497. end;
  12498. Break;
  12499. end;
  12500. end;
  12501. if not AFinded then
  12502. begin
  12503. try
  12504. RealICQContacterTreeView.Clear;
  12505. FreeAndNil(RealICQContacterTreeView);
  12506. FContacterTreeViews.Delete(ItemIndex);
  12507. except
  12508. Exit;
  12509. end;
  12510. end;
  12511. end;
  12512. if not AFinded then
  12513. ItemIndex := AddContacterTreeView(ScrollBoxMoreUser, LVMoreUsers)
  12514. else
  12515. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12516. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12517. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12518. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12519. RealICQContacterTreeView.AdjustPosition := False;
  12520. RealICQContacterTreeView.AutoChangeOnlineNumeric := False;
  12521. RealICQContacterTreeView.AutoCalculate := False;
  12522. if not AFinded then
  12523. begin
  12524. RealICQContacterTreeView.HideSystemScrollBar;
  12525. tsContacters.DisableAlign;
  12526. RealICQContacterTreeView.BeginUpdate;
  12527. end;
  12528. try
  12529. {$region '添加部门'}
  12530. for iLoop := 0 to RealICQClient.MoreBranchs.Count - 1 do
  12531. begin
  12532. BranchInfo := RealICQClient.MoreBranchs.Objects[iLoop] as TRealICQBranchInfo;
  12533. OnlineEmployee := 0;
  12534. EmployeeCount := 0;
  12535. //GetBranchEmpOnlineAndSum(RealICQClient.MoreBranchs, BranchInfo, OnlineEmployee,EmployeeCount);
  12536. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12537. begin
  12538. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12539. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12540. //Branch.EmployeeCount := EmployeeCount;
  12541. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12542. Branch.Update;
  12543. Continue;
  12544. end;
  12545. //-----------------------------------------------------------------
  12546. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12547. Branch.BranchID := BranchInfo.ID;
  12548. Branch.ParentID := BranchInfo.ParentID;
  12549. if Branch.ParentID = '0' then
  12550. begin
  12551. TopBranch := Branch;
  12552. //EmployeeCount:=EmployeeCount-BranchInfo.EmployeeCount;
  12553. if BranchInfo.EmployeeCount > 0 then
  12554. begin
  12555. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12556. end;
  12557. end;
  12558. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12559. //Branch.EmployeeCount:=EmployeeCount;
  12560. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12561. RealICQContacterTreeView.AddBranch(Branch);
  12562. Application.ProcessMessages;
  12563. end;
  12564. {$endregion}
  12565. if not AFinded then
  12566. begin
  12567. RealICQContacterTreeView.ReAlignBranchs;
  12568. if Assigned(TopBranch) then
  12569. TopBranch.Node.Expanded := True;
  12570. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12571. RealICQContacterTreeView.MoveScrollBarToTop;
  12572. end;
  12573. finally
  12574. if not AFinded then
  12575. begin
  12576. RealICQContacterTreeView.EndUpdate;
  12577. tsContacters.EnableAlign;
  12578. end;
  12579. end;
  12580. ImgLoadingMoreBranchs.Visible := False;
  12581. ScrollBoxMoreUser.Visible := True;
  12582. {TimerForGetBranchOnlineStates.Enabled := False;
  12583. TimerForGetBranchOnlineStates.Enabled := True;}
  12584. end;
  12585. //----用户单击部门------------------------------------
  12586. procedure TMainForm.NodeBranchClick(Sender: TObject; Branch: TRealICQBranch);
  12587. var
  12588. RealICQContacterTreeView: TRealICQContacterTreeView;
  12589. ItemIndex: Integer;
  12590. Employee: TRealICQEmployee;
  12591. BranchInfo: TRealICQBranchInfo;
  12592. begin
  12593. //-------获取指定部门下的用户------------------------------------------------
  12594. if (not Branch.IsGetUserList) then// and (FGetUsersTask.IndexOf(Branch.BranchID) < 0) then
  12595. begin
  12596. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12597. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12598. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12599. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12600. // BranchInfo := MainForm.RealICQClient.MoreBranchs.Objects[MainForm.RealICQClient.MoreBranchs.IndexOf(Branch.BranchID)] as TRealICQBranchInfo;
  12601. // FGetUsersTask.AddObject(Branch.BranchID, Branch);
  12602. // if (BranchInfo.IsGetUserList) then
  12603. // begin
  12604. // //RealICQContacterTreeView.ReCalculateEmployeeCount(Branch);
  12605. // RealICQClientGettedMoreUserList(nil)
  12606. // end
  12607. // else
  12608. if RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户') < 0 then
  12609. begin
  12610. Employee := TRealICQEmployee.Create('正在下载用户');
  12611. Employee.BranchID := Branch.BranchID;
  12612. RealICQContacterTreeView.AddEmployee(Employee);
  12613. Branch.Node.Expanded := True;
  12614. GetBranchUser(Branch);
  12615. Branch.IsGetUserList := True;
  12616. end;
  12617. end;
  12618. end;
  12619. //----------------------------------------------------------------------------
  12620. procedure TMainForm.GetBranchUser(Branch: TRealICQBranch);
  12621. var
  12622. RealICQContacterTreeView: TRealICQContacterTreeView;
  12623. iIndex: Integer;
  12624. begin
  12625. SetGetMoreUserEvent;
  12626. //iIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12627. //RealICQContacterTreeView := FContacterTreeViews.Objects[iIndex] as TRealICQContacterTreeView;
  12628. //RealICQContacterTreeView.ReCalculateEmployeeCount(Branch);
  12629. RealICQClient.SendGetBranchs(FCurrentServerID, StrToInt(Branch.BranchID));
  12630. Sleep(5);
  12631. RealICQClient.SendGetMoreUser(Branch.BranchID, FCurrentServerID);
  12632. end;
  12633. //----------------------------------------------------------------------
  12634. procedure TMainForm.RealICQClientGettedMoreUserList(Sender: TObject);
  12635. var
  12636. iLoop, ItemIndex: Integer;
  12637. RealICQUser: TRealICQUser;
  12638. RealICQContacterTreeView: TRealICQContacterTreeView;
  12639. Employee: TRealICQEmployee;
  12640. TmpBranch, Branch, TopBranch: TRealICQBranch;
  12641. ParentNode: TTreeNode;
  12642. BranchInfo: TRealICQBranchInfo;
  12643. begin
  12644. TmpBranch := nil;
  12645. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12646. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12647. RealICQContacterTreeView.AdjustPosition := False;
  12648. RealICQContacterTreeView.HideSystemScrollBar;
  12649. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  12650. RealICQContacterTreeView.OnItemOnline := nil;
  12651. RealICQContacterTreeView.OnItemOffline := nil;
  12652. tsContacters.DisableAlign;
  12653. RealICQContacterTreeView.BeginUpdate;
  12654. try
  12655. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户');
  12656. if ItemIndex >= 0 then
  12657. begin
  12658. Employee := RealICQContacterTreeView.GetEmployee('正在下载用户');
  12659. ParentNode := Employee.Node.Parent;
  12660. TmpBranch := TRealICQBranch(ParentNode.Data);
  12661. //BranchInfo:=MainForm.RealICQClient.MoreBranchs.Objects[MainForm.RealICQClient.MoreBranchs.IndexOf(TmpBranch.BranchID)] as TRealICQBranchInfo;
  12662. //BranchInfo.IsGetUserList:=True;
  12663. TmpBranch.IsGetUserList := True;
  12664. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12665. end;
  12666. // else if FGetUsersTask.Count > 0 then
  12667. // TmpBranch:=FGetUsersTask.Objects[FGetUsersTask.Count-1] as TRealICQBranch;
  12668. {$region '添加联系人'}
  12669. for iLoop := RealICQClient.MoreUsers.Count - 1 downto 0 do
  12670. begin
  12671. RealICQUser := RealICQClient.MoreUsers.Objects[iLoop] as TRealICQUser;
  12672. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(RealICQUser.BranchID);
  12673. if ItemIndex < 0 then
  12674. Continue;
  12675. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName);
  12676. if ItemIndex >= 0 then
  12677. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12678. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12679. Employee.BranchID := RealICQUser.BranchID;
  12680. Employee.HasAddFreindButton := True;
  12681. Employee.HasEmail := False;
  12682. if not TConditionConfig.GetConfig.UserInfoController then
  12683. Employee.SeeInfoPermissions := $00
  12684. else
  12685. Employee.SeeInfoPermissions := RealICQUser.SeeInfoPermissions;
  12686. RealICQContacterTreeView.AddEmployee(Employee);
  12687. UpdateEmployeeNode(Employee, RealICQUser, False);
  12688. end;
  12689. {$endregion}
  12690. {$region '添加部门'}
  12691. for iLoop := RealICQClient.MoreBranchs2.Count - 1 downto 0 do
  12692. begin
  12693. BranchInfo := RealICQClient.MoreBranchs2.Objects[iLoop] as TRealICQBranchInfo;
  12694. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12695. begin
  12696. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12697. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12698. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12699. Branch.Update;
  12700. Continue;
  12701. end;
  12702. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12703. Branch.BranchID := BranchInfo.ID;
  12704. Branch.ParentID := BranchInfo.ParentID;
  12705. if Branch.ParentID = '0' then
  12706. begin
  12707. TopBranch := Branch;
  12708. //EmployeeCount:=EmployeeCount-BranchInfo.EmployeeCount;
  12709. if BranchInfo.EmployeeCount > 0 then
  12710. begin
  12711. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12712. end;
  12713. end;
  12714. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12715. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12716. //if Branch.BranchID<>TmpBranch.BranchID then continue;
  12717. RealICQContacterTreeView.AddBranch(Branch);
  12718. Application.ProcessMessages;
  12719. end;
  12720. {$endregion}
  12721. if TmpBranch <> nil then
  12722. begin
  12723. TmpBranch.Node.Expanded := True;
  12724. TmpBranch.IsGetUserList := True;
  12725. // ItemIndex := FGetUsersTask.IndexOf(TmpBranch.BranchID);
  12726. // if ItemIndex >= 0 then FGetUsersTask.Delete(ItemIndex);
  12727. // if FGetUsersTask.Count > 0 then GetBranchUser(FGetUsersTask.Objects[0] as TRealICQBranch);
  12728. end;
  12729. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12730. finally
  12731. RealICQContacterTreeView.EndUpdate;
  12732. tsContacters.EnableAlign;
  12733. end;
  12734. end;
  12735. procedure TMainForm.RealICQClientGettedPermission(Sender: TObject);
  12736. begin
  12737. //
  12738. spbNetworkBackup.Visible := RealICQClient.UserPermission.EnableBackup;
  12739. end;
  12740. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteBeControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12741. var
  12742. TalkingForm: TTalkingForm;
  12743. begin
  12744. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12745. if TalkingForm = nil then
  12746. Exit;
  12747. if TalkingForm.CanWriteMessage then
  12748. TalkingForm.ShowGettedRemoteControlTransmiteControlBeControlResponse(AAcceptted);
  12749. end;
  12750. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteConnectted(Sender: TObject; ALoginName: string);
  12751. var
  12752. TalkingForm: TTalkingForm;
  12753. begin
  12754. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12755. if TalkingForm = nil then
  12756. Exit;
  12757. if TalkingForm.CanWriteMessage then
  12758. TalkingForm.ShowGettedRemoteControlTransmiteConnectted;
  12759. end;
  12760. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  12761. var
  12762. TalkingForm: TTalkingForm;
  12763. begin
  12764. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12765. if TalkingForm = nil then
  12766. Exit;
  12767. if TalkingForm.CanWriteMessage then
  12768. TalkingForm.ShowGettedRemoteControlTransmiteControlRequest;
  12769. end;
  12770. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12771. var
  12772. TalkingForm: TTalkingForm;
  12773. begin
  12774. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12775. if TalkingForm = nil then
  12776. Exit;
  12777. if TalkingForm.CanWriteMessage then
  12778. TalkingForm.ShowGettedRemoteControlTransmiteControlControlResponse(AAcceptted);
  12779. end;
  12780. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  12781. var
  12782. AShowActive: Boolean;
  12783. TalkingForm: TTalkingForm;
  12784. iWaitTimes: Integer;
  12785. begin
  12786. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  12787. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12788. if TalkingForm = nil then
  12789. begin
  12790. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  12791. end;
  12792. iWaitTimes := 0;
  12793. while not TalkingForm.CanWriteMessage do
  12794. begin
  12795. Application.ProcessMessages;
  12796. Inc(iWaitTimes);
  12797. if iWaitTimes > 1000 then
  12798. break;
  12799. Sleep(10);
  12800. end;
  12801. if (GetForegroundWindow <> TalkingForm.Handle) then
  12802. begin
  12803. FlashWindow(TalkingForm.Handle, True);
  12804. if PlaySoundOnGetMessage then
  12805. PlayEventSound(FMessageEventSound);
  12806. end;
  12807. TalkingForm.ShowGettedRemoteControlTransmiteRequest;
  12808. end;
  12809. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12810. var
  12811. TalkingForm: TTalkingForm;
  12812. begin
  12813. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12814. if TalkingForm = nil then
  12815. Exit;
  12816. if TalkingForm.CanWriteMessage then
  12817. TalkingForm.ShowGettedRemoteControlTransmiteResponse(AAcceptted);
  12818. end;
  12819. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenImage(Sender: TObject; ALoginName: string; ALeft, ATop, AWidth, AHeight: Integer; AP: TPoint; ABitmap: TBitmap);
  12820. begin
  12821. if RemoteControlForm = nil then
  12822. Exit;
  12823. RemoteControlForm.imgRCScreen.Picture.Bitmap.Canvas.CopyRect(Rect(ALeft, ATop, ALeft + AWidth, ATop + AHeight), ABitmap.canvas, Rect(0, 0, ABitmap.width, ABitmap.height)); //拷贝
  12824. end;
  12825. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenSize(Sender: TObject; ALoginName: string; AWidth, AHeight: Integer);
  12826. var
  12827. TalkingForm: TTalkingForm;
  12828. begin
  12829. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12830. if TalkingForm = nil then
  12831. Exit;
  12832. TalkingForm.ShowGettedRemoteControlTransmiteRecvedScreenSize(AWidth, AHeight);
  12833. end;
  12834. //------------------------------------------------------------------------------
  12835. procedure TMainForm.CheckCacheDir;
  12836. var
  12837. DSearchRec: TSearchRec;
  12838. FindResult: Integer;
  12839. begin
  12840. FindResult := FindFirst(CacheDir + '*' + CacheFileExt, faAnyFile, DSearchRec);
  12841. while FindResult = 0 do
  12842. begin
  12843. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  12844. begin
  12845. try
  12846. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  12847. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12848. except
  12849. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  12850. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12851. end;
  12852. end;
  12853. FindResult := FindNext(DSearchRec);
  12854. end;
  12855. FindResult := FindFirst(CacheDir + '*' + CacheResumeSizeFileExt, faAnyFile, DSearchRec);
  12856. while FindResult = 0 do
  12857. begin
  12858. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  12859. begin
  12860. try
  12861. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  12862. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12863. except
  12864. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  12865. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  12866. end;
  12867. end;
  12868. FindResult := FindNext(DSearchRec);
  12869. end;
  12870. if GetDirectorySize(CacheDir) > MaxCacheDirSize * 1024 * 1024 then
  12871. begin
  12872. if MessageBox(Handle, PChar('Cache目录的大小已经超过 ' + IntToStr(MaxCacheDirSize) + 'MB,是否打开Cache目录进行管理?'), '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_OK then
  12873. WinExec(PChar('explorer "' + CacheDir + '"'), SW_SHOWNORMAL);
  12874. end;
  12875. end;
  12876. //------------------------------------------------------------------------------
  12877. procedure TMainForm.ShowWebTabs;
  12878. var
  12879. iLoop: Integer;
  12880. TabSheet: TTabSheet;
  12881. Bitmap: TBitmap;
  12882. WebPanel: TWebPanel;
  12883. EUser, EPass: string;
  12884. begin
  12885. //先删除
  12886. try
  12887. for iLoop := 0 to FWebTabs.Count - 1 do
  12888. begin
  12889. TabSheet := FWebTabs[iLoop];
  12890. TabSheet.OnShow := nil;
  12891. TabSheet.PageControl := nil;
  12892. FreeAndNil(TabSheet);
  12893. end;
  12894. except
  12895. end;
  12896. FWebTabs.Clear;
  12897. //显示
  12898. pgcMainWorkArea.DisableAlign;
  12899. try
  12900. for iLoop := 0 to FWebPanels.Count - 1 do
  12901. begin
  12902. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12903. if (not WebPanel.Show) and (not WebPanel.MustShow) then
  12904. Continue;
  12905. if ((AnsiPos('邮件', WebPanel.FName) > 0) or (AnsiPos('邮箱', WebPanel.FName) > 0) or (AnsiPos('信箱', WebPanel.FName) > 0)) and (WebPanel.MustShow) then
  12906. begin
  12907. if WebPanel.UserIMLoginName then
  12908. EUser := RealICQClient.LoginName
  12909. else
  12910. EUser := WebPanel.CustomLoginName;
  12911. if WebPanel.UserIMPassword then
  12912. EPass := RealICQClient.Password
  12913. else
  12914. EPass := WebPanel.CustomPassword;
  12915. //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]));
  12916. end;
  12917. TabSheet := TTabSheet.Create(pgcMainWorkArea);
  12918. TabSheet.Parent := pgcMainWorkArea;
  12919. TabSheet.DoubleBuffered := True;
  12920. TabSheet.Caption := WebPanel.Name;
  12921. TabSheet.ShowHint := False;
  12922. if FileExists(WebPanel.Image) then
  12923. begin
  12924. Bitmap := GetSamllBitmap(WebPanel.Image, 32, 32, False);
  12925. try
  12926. try
  12927. Bitmap.LoadFromFile(WebPanel.Image);
  12928. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  12929. ImgLstPageControl.Add(Bitmap, nil);
  12930. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  12931. except
  12932. //
  12933. end;
  12934. finally
  12935. FreeAndNil(Bitmap);
  12936. end;
  12937. end
  12938. else
  12939. TabSheet.ImageIndex := 2; //?号图标
  12940. TabSheet.OnShow := WebTabShow;
  12941. TabSheet.Tag := iLoop;
  12942. TabSheet.PageControl := pgcMainWorkArea;
  12943. FWebTabs.Add(TabSheet);
  12944. end;
  12945. finally
  12946. pgcMainWorkArea.EnableAlign;
  12947. end;
  12948. end;
  12949. //------------------------------------------------------------------------------
  12950. procedure TMainForm.RealICQClientGetWebTabs(Sender: TObject; ATabCount: Integer; WebTabRecords: array of TWebTabRecord);
  12951. var
  12952. iLoop, jLoop: Integer;
  12953. WebTabRecord: TWebTabRecord;
  12954. WebPanel: TWebPanel;
  12955. FFinded: Boolean;
  12956. AWebPanels: TStringList;
  12957. begin
  12958. LoadWebPanelsFromXML;
  12959. AWebPanels := TStringList.Create;
  12960. for iLoop := 0 to FWebPanels.Count - 1 do
  12961. begin
  12962. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  12963. AWebPanels.AddObject(WebPanel.ID, WebPanel);
  12964. end;
  12965. FWebPanels.Clear;
  12966. for iLoop := Low(WebTabRecords) to High(WebTabRecords) do
  12967. begin
  12968. WebTabRecord := WebTabRecords[iLoop];
  12969. if AWebPanels.IndexOf(WebTabRecord.ID) < 0 then
  12970. begin
  12971. WebPanel := TWebPanel.Create;
  12972. //FWebPanels.AddObject(WebTabRecord.Name, WebPanel);
  12973. WebPanel.FUserIMLoginName := True;
  12974. WebPanel.FUserIMPassword := True;
  12975. WebPanel.FCustomLoginName := '';
  12976. WebPanel.FCustomPassword := '';
  12977. WebPanel.FShow := False;
  12978. end
  12979. else
  12980. begin
  12981. WebPanel := AWebPanels.Objects[AWebPanels.IndexOf(WebTabRecord.ID)] as TWebPanel;
  12982. end;
  12983. WebPanel.MustShow := WebTabRecord.MustShow;
  12984. if WebPanel.MustShow then
  12985. WebPanel.FShow := True;
  12986. WebPanel.FID := WebTabRecord.ID;
  12987. WebPanel.FName := WebTabRecord.Name;
  12988. WebPanel.FURL := WebTabRecord.URL;
  12989. WebPanel.FImage := WebTabRecord.IconFile;
  12990. WebPanel.Content := WebTabRecord.Content;
  12991. if AnsiSameText(WebTabRecord.Method, 'GET') then
  12992. WebPanel.FNavigateType := ntGET
  12993. else if AnsiSameText(WebTabRecord.Method, 'POST') then
  12994. WebPanel.FNavigateType := ntPOST
  12995. else
  12996. WebPanel.FNavigateType := ntFill;
  12997. WebPanel.FPostFields := WebTabRecord.PostFields;
  12998. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  12999. end;
  13000. {for iLoop := FWebPanels.Count - 1 downto 0 do
  13001. begin
  13002. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  13003. //if WebPanel.MustShow then
  13004. begin
  13005. FFinded := False;
  13006. for jLoop := Low(WebTabRecords) to High(WebTabRecords) do
  13007. begin
  13008. WebTabRecord := WebTabRecords[jLoop];
  13009. if AnsiSameStr(WebTabRecord.ID, WebPanel.ID) then
  13010. begin
  13011. FFinded := True;
  13012. Break;
  13013. end;
  13014. end;
  13015. if not FFinded then
  13016. begin
  13017. FreeAndNil(WebPanel);
  13018. FWebPanels.Delete(iLoop);
  13019. end;
  13020. end;
  13021. end; }
  13022. SaveWebPanelsToXML;
  13023. DisplayWebs := False;
  13024. ShowWebTabs;
  13025. DisplayWebs := True;
  13026. end;
  13027. //------------------------------------------------------------------------------
  13028. procedure TMainForm.RealICQClientInputting(Sender: TObject; ALoginName: string; AInputting: Boolean);
  13029. var
  13030. TalkingForm: TTalkingForm;
  13031. begin
  13032. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  13033. if TalkingForm = nil then
  13034. Exit;
  13035. TalkingForm.ShowInputting(AInputting);
  13036. end;
  13037. //------------------------------------------------------------------------------
  13038. procedure TMainForm.RealICQClientJoinedTeam(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13039. var
  13040. AlertMessage: string;
  13041. RealICQUser: TRealICQUser;
  13042. begin
  13043. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13044. if RealICQUser.DisplayName = '' then
  13045. AlertMessage := RealICQUser.LoginName
  13046. else
  13047. AlertMessage := RealICQUser.DisplayName;
  13048. if ARealICQTeam.IsTempTeam then
  13049. AlertMessage := AlertMessage + ' 将您添加进了 临时多人会话'
  13050. else
  13051. AlertMessage := AlertMessage + ' 将您添加进了群组: ' + ARealICQTeam.TeamCaption;
  13052. ShowNotifyAlertForm(AlertMessage);
  13053. AddMessageHistory(smSimple, AlertMessage, nil);
  13054. UpdateTeamTalkingForm(ARealICQTeam);
  13055. end;
  13056. //------------------------------------------------------------------------------
  13057. procedure TMainForm.RealICQClientJoinTeamRequest(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName, ATag: string);
  13058. begin
  13059. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ARealICQTeam.TeamCaption, ARealICQTeam.TeamID]), nil);
  13060. ShowJoinTeamRequestWindow(Self, ARealICQTeam.TeamID, ARealICQTeam.TeamCaption, ALoginName, ATag);
  13061. end;
  13062. //------------------------------------------------------------------------------
  13063. procedure TMainForm.RealICQClientJoinTeamResponse(Sender: TObject; ATeamID: string; ALoginName: string; ATag: string; AAcceptted: Boolean);
  13064. var
  13065. ATeam: TRealICQTeam;
  13066. begin
  13067. ATeam := TTeamsAdapter.GetTeam(ATeamID);
  13068. if ATeam = nil then
  13069. Exit;
  13070. if AAcceptted then
  13071. begin
  13072. AddMessageHistory(smSimple, ALoginName + ' 接受了您加入群组 ' + ATeam.TeamCaption + ' 的请求', nil);
  13073. ShowNotifyAlertForm(ALoginName + ' 接受您加入群组 ' + ATeam.TeamCaption + ' 的请求');
  13074. end
  13075. else
  13076. begin
  13077. if Length(ATag) = 0 then
  13078. ATag := '无';
  13079. AddMessageHistory(smSimple, ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption, nil);
  13080. ShowNotifyAlertForm(ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption + #$D#$A + '附言 :' + ATag);
  13081. end;
  13082. end;
  13083. //------------------------------------------------------------------------------
  13084. procedure TMainForm.RealICQClientTeamDisbanded(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13085. var
  13086. iIndex: Integer;
  13087. AlertMessage: string;
  13088. RealICQUser: TRealICQUser;
  13089. begin
  13090. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13091. if iIndex >= 0 then
  13092. begin
  13093. FLVTeams.Items.Delete(iIndex);
  13094. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13095. if RealICQUser = RealICQClient.Me then
  13096. AlertMessage := '您'
  13097. else if RealICQUser.DisplayName = '' then
  13098. AlertMessage := RealICQUser.LoginName
  13099. else
  13100. AlertMessage := RealICQUser.DisplayName;
  13101. if ARealICQTeam.IsTempTeam then
  13102. AlertMessage := AlertMessage + ' 解散了 多人对话'
  13103. else
  13104. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  13105. ShowNotifyAlertForm(AlertMessage);
  13106. AddMessageHistory(smSimple, AlertMessage, nil);
  13107. ShowNavBarNumeric;
  13108. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13109. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13110. UpdateTeamTalkingForm(ARealICQTeam);
  13111. end;
  13112. end;
  13113. procedure TMainForm.RealICQClientTeamQuitted(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName: string);
  13114. var
  13115. iIndex: Integer;
  13116. AlertMessage: string;
  13117. begin
  13118. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13119. if iIndex >= 0 then
  13120. begin
  13121. FLVTeams.Items.Delete(iIndex);
  13122. if ARealICQTeam.IsTempTeam then
  13123. AlertMessage := '您 退出了 多人对话'
  13124. else
  13125. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  13126. ShowNotifyAlertForm(AlertMessage);
  13127. AddMessageHistory(smSimple, AlertMessage, nil);
  13128. ShowNavBarNumeric;
  13129. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13130. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13131. UpdateTeamTalkingForm(ARealICQTeam);
  13132. end;
  13133. end;
  13134. //------------------------------------------------------------------------------
  13135. procedure TMainForm.SetFlashCaptionOnOnlineValue(Value: Boolean);
  13136. var
  13137. iLoop: Integer;
  13138. GroupName: string;
  13139. RealICQContacterListView: TRealICQContacterListView;
  13140. RealICQContacterTreeView: TRealICQContacterTreeView;
  13141. begin
  13142. for iLoop := 0 to FContacterListViews.Count - 1 do
  13143. begin
  13144. GroupName := FContacterListViews[iLoop];
  13145. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  13146. RealICQContacterListView.FlashCaptionOnOnline := Value and (GroupName <> LVStrangers) and (GroupName <> LVBlacklists) and (GroupName <> LVLatests);
  13147. end;
  13148. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  13149. begin
  13150. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  13151. RealICQContacterTreeView.FlashCaptionOnOnline := Value;
  13152. RealICQContacterTreeView.ReDrawAll;
  13153. end;
  13154. end;
  13155. //------------------------------------------------------------------------------
  13156. procedure TMainForm.RealICQClientUserExInformationChanged(Sender: TObject; RealICQUser: TRealICQUser);
  13157. begin
  13158. if (OptionsForm <> nil) and (RealICQUser = RealICQClient.Me) then
  13159. begin
  13160. OptionsForm.GetSets;
  13161. end;
  13162. // UpdateSeeInformationForm(RealICQUser);
  13163. UpdateTalkingForm(RealICQUser);
  13164. UpdateSMSForm(RealICQUser);
  13165. end;
  13166. //------------------------------------------------------------------------------
  13167. procedure TMainForm.RealICQClientUserInformationReady(Sender: TObject; RealICQUser: TRealICQUser);
  13168. var
  13169. ItemIndex: Integer;
  13170. RealICQContacterListItem: TRealICQContacterListItem;
  13171. RealICQContacterListView: TRealICQContacterListView;
  13172. RealICQFriendTreeView: TRealICQContacterTreeView;
  13173. RealICQContacterTreeView: TRealICQContacterTreeView;
  13174. Employee: TRealICQEmployee;
  13175. Friend: TRealICQEmployee;
  13176. iIndex, iLoop, jLoop: Integer;
  13177. GroupName: string;
  13178. GroupMembers: TStringList;
  13179. begin
  13180. if UserCardForm <> nil then
  13181. begin
  13182. if AnsiSameText(UserCardForm.LoginName, RealICQUser.LoginName) then
  13183. UserCardForm.LoginName := RealICQUser.LoginName;
  13184. end;
  13185. {$region '如果正处于过滤用户的状态,则同时也更新FSearchListView中的数据'}
  13186. if FSearchListViewInVisible then
  13187. begin
  13188. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  13189. if ItemIndex >= 0 then
  13190. begin
  13191. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13192. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13193. end;
  13194. end;
  13195. {$endregion}
  13196. {$region '更新“最近联系人列表”中的数据'}
  13197. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  13198. if ItemIndex >= 0 then
  13199. begin
  13200. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13201. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13202. end;
  13203. {$endregion}
  13204. if TUsersService.GetUsersService.IsWorkmateOrFriend(RealICQUser.LoginName) then
  13205. begin
  13206. {$region 'wmCorporation工作模式或采用了树型方式组织好友列表'}
  13207. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  13208. ShowMeInformation;
  13209. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  13210. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13211. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13212. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13213. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13214. if Employee <> nil then
  13215. begin
  13216. UpdateEmployeeNode(Employee, RealICQUser, True);
  13217. end;
  13218. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  13219. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13220. Friend := RealICQFriendTreeView.GetEmployee(RealICQUser.LoginName);
  13221. if Friend <> nil then
  13222. begin
  13223. UpdateFriendNode(Friend, RealICQUser, True);
  13224. end;
  13225. if RealICQClient.WorkingMode = wmCorporation then
  13226. begin
  13227. {$region '更新自定义组中的信息'}
  13228. for iLoop := 0 to FGroups.Count - 1 do
  13229. begin
  13230. GroupName := FGroups[iLoop];
  13231. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  13232. for jLoop := 0 to GroupMembers.Count - 1 do
  13233. begin
  13234. if AnsiSameText(GroupMembers[jLoop], RealICQClient.LoginName) then
  13235. begin
  13236. iIndex := FContacterListViews.IndexOf(GroupName);
  13237. if iIndex >= 0 then
  13238. begin
  13239. RealICQContacterListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  13240. if RealICQContacterListView.Items.IndexOf(RealICQClient.LoginName) = -1 then
  13241. RealICQContacterListView.Items.Add(RealICQClient.LoginName);
  13242. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  13243. if ItemIndex >= 0 then
  13244. begin
  13245. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13246. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13247. end;
  13248. end; //if
  13249. end; //if
  13250. end; //for jLoop
  13251. end; //for iLoop
  13252. {$endregion}
  13253. end;
  13254. {$endregion}
  13255. end;
  13256. if RealICQClient.MoreUsers.IndexOf(RealICQUser.LoginName) >= 0 then
  13257. begin
  13258. {$region '更新“全市”中的数据'}
  13259. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  13260. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13261. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13262. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13263. RealICQContacterTreeView.OnItemOnline := nil;
  13264. RealICQContacterTreeView.OnItemOffline := nil;
  13265. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  13266. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13267. if Employee <> nil then
  13268. begin
  13269. UpdateEmployeeNode(Employee, RealICQUser, True);
  13270. end;
  13271. {$endregion}
  13272. end;
  13273. // UpdateSeeInformationForm(RealICQUser);
  13274. UpdateTalkingForm(RealICQUser);
  13275. UpdateSMSForm(RealICQUser);
  13276. UpdateMemberInfoOfTeamOptionsForm(RealICQUser);
  13277. UpdateAddrBookInfo(RealICQUser);
  13278. end;
  13279. procedure TMainForm.UpdateAddrBookInfo(RealICQUser: TRealICQUser);
  13280. var
  13281. iLoop, ItemIndex: Integer;
  13282. Employee: TRealICQEmployee;
  13283. TmpRealICQUser: TRealICQUser;
  13284. RealICQContacterTreeView: TRealICQContacterTreeView;
  13285. begin
  13286. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  13287. if ItemIndex < 0 then
  13288. Exit;
  13289. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13290. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13291. if (Employee <> nil) then
  13292. begin
  13293. Employee.Mobile := RealICQUser.Mobile;
  13294. Employee.SMSHint := RealICQUser.Mobile;
  13295. Employee.Tel := RealICQUser.Tel;
  13296. Employee.Update;
  13297. end
  13298. else
  13299. Exit;
  13300. ItemIndex := MainForm.RealICQClient.AddrBookUsers.IndexOf(RealICQUser.LoginName);
  13301. if ItemIndex < 0 then
  13302. Exit;
  13303. TmpRealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[ItemIndex] as TRealICQUser;
  13304. TmpRealICQUser.Mobile := RealICQUser.Mobile;
  13305. TmpRealICQUser.Tel := RealICQUser.Tel;
  13306. end;
  13307. //------------------------------------------------------------------------------
  13308. procedure TMainForm.ShowNetWorkDiskSpaceInfo;
  13309. begin
  13310. lblNDSpaceSize.Caption := Format('%0fM/%dM', [RealICQNetWorkDiskClient.UsedSpaceSize / (1024 * 1024), RealICQNetWorkDiskClient.MaxSpaceSize div (1024 * 1024)]);
  13311. end;
  13312. //------------------------------------------------------------------------------
  13313. procedure TMainForm.RealICQNetWorkDiskClientConnectStateChanged(Sender: TObject);
  13314. begin
  13315. if tsNetWorkDisk.Parent = nil then
  13316. Exit;
  13317. try
  13318. FConfirmReplaceResult := -1;
  13319. if RealICQNetWorkDiskClient.Connectting then
  13320. begin
  13321. lblNDState.Caption := '正在连接...';
  13322. lblNDSpaceSize.Caption := '';
  13323. end
  13324. else if RealICQNetWorkDiskClient.Connected then
  13325. begin
  13326. lblNDState.Caption := '已连接';
  13327. ShowNetWorkDiskSpaceInfo;
  13328. end
  13329. else
  13330. begin
  13331. lblNDState.Caption := '连接已断开';
  13332. lblNDSpaceSize.Caption := '';
  13333. try
  13334. if FLVNetWorkDisk <> nil then
  13335. begin
  13336. FLVNetWorkDisk.Items.Clear;
  13337. FLVNetWorkDisk.ReDrawAll;
  13338. end;
  13339. except
  13340. end;
  13341. try
  13342. spbNDCancelAllClick(spbNDCancelAll);
  13343. except
  13344. end;
  13345. end;
  13346. spbNDMoveUp.Enabled := RealICQNetWorkDiskClient.Connected;
  13347. spbNDRefresh.Enabled := spbNDMoveUp.Enabled;
  13348. spbNDNewDir.Enabled := spbNDMoveUp.Enabled;
  13349. spbNDDelete.Enabled := spbNDMoveUp.Enabled;
  13350. shpNDDirBorder.Enabled := spbNDMoveUp.Enabled;
  13351. edNDDir.Enabled := spbNDMoveUp.Enabled;
  13352. spbNDUpload.Enabled := spbNDMoveUp.Enabled;
  13353. spbNDDownload.Enabled := spbNDMoveUp.Enabled;
  13354. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13355. spbNDConnect.Enabled := (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) and (RealICQClient.Connected);
  13356. spbNDDisconnect.Enabled := not spbNDConnect.Enabled and not RealICQNetWorkDiskClient.Connectting;
  13357. if not edNDDir.Enabled then
  13358. edNDDir.Text := '';
  13359. except
  13360. end;
  13361. end;
  13362. //------------------------------------------------------------------------------
  13363. procedure TMainForm.ItemShowHint(Sender: TObject; Item: TRealICQContacterListItem; var HintStr: string);
  13364. var
  13365. AFile: TRealICQNetWorkDiskFile;
  13366. ADirectory: TRealICQNetWorkDiskDirectory;
  13367. AUploadMission: TUploadMission;
  13368. ADownloadMission: TDownloadMission;
  13369. begin
  13370. if Item = nil then
  13371. Exit;
  13372. if Sender = FLVNetWorkDisk then
  13373. begin
  13374. if Copy(Item.LoginName, 1, 1) = 'D' then
  13375. begin
  13376. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  13377. HintStr := '目录名称: ' + Trim(ADirectory.Name) + #$D#$A;
  13378. HintStr := HintStr + '创建时间: ' + DateTimeToStr(ADirectory.CreateDate);
  13379. end
  13380. else if Copy(Item.LoginName, 1, 1) = 'F' then
  13381. begin
  13382. AFile := TRealICQNetWorkDiskFile(Item.Data);
  13383. HintStr := '文件名称: ' + Trim(AFile.Name) + #$D#$A;
  13384. HintStr := HintStr + '创建时间: ' + Trim(DateTimeToStr(AFile.CreateDate)) + #$D#$A;
  13385. HintStr := HintStr + '修改时间: ' + Trim(DateTimeToStr(AFile.ModifyDate)) + #$D#$A;
  13386. HintStr := HintStr + '大小: ' + Trim(Item.Watchword);
  13387. end;
  13388. end;
  13389. if Sender = FLVNetWorkDiskUploadingFiles then
  13390. begin
  13391. if AnsiSameText(HintStr, '取消') then
  13392. Exit;
  13393. AUploadMission := TUploadMission(Item.Data);
  13394. HintStr := AUploadMission.Name;
  13395. end;
  13396. if Sender = FLVNetWorkDiskDownloadingFiles then
  13397. begin
  13398. if AnsiSameText(HintStr, '取消') then
  13399. Exit;
  13400. ADownloadMission := TDownloadMission(Item.Data);
  13401. if ADownloadMission.FDownloadMissionType = mtDir then
  13402. HintStr := ADownloadMission.DirectoryName
  13403. else
  13404. HintStr := ADownloadMission.FileName;
  13405. end;
  13406. end;
  13407. procedure TMainForm.LblHintClick(Sender: TObject);
  13408. var
  13409. FAutoSaveMessage: Boolean;
  13410. begin
  13411. FAutoSaveMessage := AutoSaveMessage;
  13412. AutoSaveMessage := False;
  13413. try
  13414. RealICQClientReceivedSystemMessage(RealICQClient, FTopSystemMessage);
  13415. finally
  13416. btCloseTopMessageClick(nil);
  13417. AutoSaveMessage := FAutoSaveMessage;
  13418. end;
  13419. end;
  13420. //------------------------------------------------------------------------------
  13421. procedure TMainForm.NDSelectItemChanged(Item: TRealICQContacterListItem);
  13422. begin
  13423. if not pnlNDMissions.Visible then
  13424. begin
  13425. spbNDDelete.Enabled := (FLVNetWorkDisk <> nil) and (FLVNetWorkDisk.SelCount > 0);
  13426. spbNDDownload.Enabled := spbNDDelete.Enabled;
  13427. end;
  13428. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13429. end;
  13430. //------------------------------------------------------------------------------
  13431. procedure TMainForm.NDItemMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  13432. begin
  13433. end;
  13434. //------------------------------------------------------------------------------
  13435. procedure TMainForm.NDMissionItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  13436. var
  13437. UploadMission: TUploadMission;
  13438. DownloadMission: TDownloadMission;
  13439. AMissionID: string;
  13440. begin
  13441. if Sender = FLVNetWorkDiskUploadingFiles then
  13442. begin
  13443. try
  13444. if not Assigned(Item) then
  13445. Exit;
  13446. UploadMission := TUploadMission(Item.Data);
  13447. if not Assigned(UploadMission) then
  13448. Exit;
  13449. AMissionID := UploadMission.FID;
  13450. try
  13451. FLVNetWorkDiskUploadingFiles.Items.Delete(Item.ItemIndex);
  13452. FreeAndNil(UploadMission);
  13453. except
  13454. end;
  13455. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  13456. finally
  13457. CheckUploadMissions
  13458. end;
  13459. end;
  13460. if Sender = FLVNetWorkDiskDownloadingFiles then
  13461. begin
  13462. try
  13463. if not Assigned(Item) then
  13464. Exit;
  13465. FLVNetWorkDiskDownloadingFiles.Items.Delete(Item.ItemIndex);
  13466. DownloadMission := TDownloadMission(Item.Data);
  13467. FreeAndNil(DownloadMission);
  13468. RealICQNetWorkDiskClient.StopDownloader;
  13469. finally
  13470. CheckDownloadMissions
  13471. end;
  13472. end;
  13473. end;
  13474. //------------------------------------------------------------------------------
  13475. procedure TMainForm.NDMissionDropFiles(Sender: TObject; var Message: TMessage);
  13476. var
  13477. i: Integer;
  13478. p: array[0..1023] of Char;
  13479. AName: string;
  13480. begin
  13481. try
  13482. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  13483. begin
  13484. MessageBox(Handle, '抱歉,系统正忙!', '提示', MB_ICONINFORMATION);
  13485. Exit;
  13486. end;
  13487. i := DragQueryFile(Message.wParam, $FFFFFFFF, nil, 0);
  13488. for i := 0 to i - 1 do
  13489. begin
  13490. DragQueryFile(Message.wParam, i, p, 1024);
  13491. AName := StrPas(p);
  13492. if FileExists(AName) then
  13493. begin
  13494. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13495. end
  13496. else if DirectoryExists(AName) then
  13497. begin
  13498. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13499. end;
  13500. end;
  13501. finally
  13502. CheckUploadMissions;
  13503. DragFinish(Message.wParam);
  13504. Message.Result := 1;
  13505. end;
  13506. end;
  13507. //------------------------------------------------------------------------------
  13508. procedure TMainForm.miNDCancelClick(Sender: TObject);
  13509. var
  13510. ListItem: TRealICQContacterListItem;
  13511. UploadMission: TUploadMission;
  13512. DownloadMission: TDownloadMission;
  13513. iLoop: Integer;
  13514. begin
  13515. if TabSetNDMissions.TabIndex = 0 then
  13516. begin
  13517. for iLoop := FLVNetWorkDiskUploadingFiles.Items.Count - 1 downto 0 do
  13518. begin
  13519. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13520. if ListItem.Selected then
  13521. begin
  13522. UploadMission := TUploadMission(ListItem.Data);
  13523. if ListItem.LoginState = stOnline then
  13524. begin
  13525. if UploadMission.FUploadMissionType = mtFile then
  13526. begin
  13527. RealICQNetWorkDiskClient.CancelUploadingFile(UploadMission.FID);
  13528. Continue;
  13529. end;
  13530. end;
  13531. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13532. FreeAndNil(UploadMission);
  13533. end;
  13534. end;
  13535. CheckUploadMissions;
  13536. end;
  13537. if TabSetNDMissions.TabIndex = 1 then
  13538. begin
  13539. for iLoop := FLVNetWorkDiskDownloadingFiles.Items.Count - 1 downto 0 do
  13540. begin
  13541. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13542. if ListItem.Selected then
  13543. begin
  13544. DownloadMission := TDownloadMission(ListItem.Data);
  13545. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13546. FreeAndNil(DownloadMission);
  13547. if ListItem.LoginState = stOnline then
  13548. begin
  13549. RealICQNetWorkDiskClient.StopDownloader;
  13550. end;
  13551. end;
  13552. end;
  13553. CheckDownloadMissions;
  13554. end;
  13555. end;
  13556. //------------------------------------------------------------------------------
  13557. procedure TMainForm.spbNDMoveUpClick(Sender: TObject);
  13558. begin
  13559. if RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil then
  13560. begin
  13561. lblNDState.Caption := '正在载入...';
  13562. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13563. end;
  13564. end;
  13565. //------------------------------------------------------------------------------
  13566. procedure TMainForm.miNDRenameClick(Sender: TObject);
  13567. var
  13568. DirectoryName, FileName: string;
  13569. AFile: TRealICQNetWorkDiskFile;
  13570. ADirectory: TRealICQNetWorkDiskDirectory;
  13571. ListItem, ListItem1: TRealICQContacterListItem;
  13572. iLoop, jLoop: Integer;
  13573. begin
  13574. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13575. begin
  13576. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13577. if ListItem.Selected then
  13578. begin
  13579. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13580. begin
  13581. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  13582. DirectoryName := Trim(ShowMyInputBox('重命名目录', '请输入新的目录名称', ADirectory.Name, 200));
  13583. if AnsiSameStr(DirectoryName, ADirectory.Name) then
  13584. Exit;
  13585. if Length(DirectoryName) > 0 then
  13586. begin
  13587. 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
  13588. begin
  13589. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13590. Exit;
  13591. end;
  13592. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13593. begin
  13594. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13595. if ListItem1 = ListItem then
  13596. continue;
  13597. if Copy(ListItem1.LoginName, 1, 1) = 'D' then
  13598. begin
  13599. if AnsiSameText(DirectoryName, ListItem1.DisplayName) then
  13600. begin
  13601. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13602. Exit;
  13603. end;
  13604. end;
  13605. end;
  13606. RealICQNetWorkDiskClient.Rename(rtDir, ADirectory.ID, DirectoryName);
  13607. end;
  13608. end
  13609. else if Copy(ListItem.LoginName, 1, 1) = 'F' then
  13610. begin
  13611. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  13612. FileName := Trim(ShowMyInputBox('重命名文件', '请输入新的文件名称', AFile.Name, 200));
  13613. if AnsiSameStr(FileName, AFile.Name) then
  13614. Exit;
  13615. if Length(FileName) > 0 then
  13616. begin
  13617. 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
  13618. begin
  13619. MessageBox(Handle, '文件名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13620. Exit;
  13621. end;
  13622. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13623. begin
  13624. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13625. if ListItem1 = ListItem then
  13626. continue;
  13627. if Copy(ListItem1.LoginName, 1, 1) = 'F' then
  13628. begin
  13629. if AnsiSameText(FileName, ListItem1.DisplayName) then
  13630. begin
  13631. MessageBox(Handle, '指定的文件已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13632. Exit;
  13633. end;
  13634. end;
  13635. end;
  13636. RealICQNetWorkDiskClient.Rename(rtFile, AFile.ID, FileName);
  13637. end;
  13638. end;
  13639. Exit;
  13640. end;
  13641. end;
  13642. end;
  13643. //------------------------------------------------------------------------------
  13644. procedure TMainForm.spbNDNewDirClick(Sender: TObject);
  13645. var
  13646. DirectoryName: string;
  13647. iLoop: Integer;
  13648. ListItem: TRealICQContacterListItem;
  13649. begin
  13650. DirectoryName := Trim(ShowMyInputBox('新建目录', '请输入目录名称', '', 200));
  13651. if Length(DirectoryName) > 0 then
  13652. begin
  13653. 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
  13654. begin
  13655. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13656. Exit;
  13657. end;
  13658. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13659. begin
  13660. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13661. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13662. begin
  13663. if AnsiSameText(DirectoryName, ListItem.DisplayName) then
  13664. begin
  13665. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13666. Exit;
  13667. end;
  13668. end;
  13669. end;
  13670. RealICQNetWorkDiskClient.NewDirectory(DirectoryName);
  13671. end;
  13672. end;
  13673. //------------------------------------------------------------------------------
  13674. procedure TMainForm.spbNDRefreshClick(Sender: TObject);
  13675. begin
  13676. RealICQNetWorkDiskClient.Refresh;
  13677. end;
  13678. //------------------------------------------------------------------------------
  13679. procedure TMainForm.GoNextLevelUploadMissions(UploadMission: TUploadMission);
  13680. var
  13681. iLoop: Integer;
  13682. Missions: TStringList;
  13683. ListItem: TRealICQContacterListItem;
  13684. AUploadMission: TUploadMission;
  13685. DSearchRec: TSearchRec;
  13686. FindResult: Integer;
  13687. begin
  13688. if UploadMission.FUploadMissionType <> mtDir then
  13689. Exit;
  13690. Missions := TStringList.Create;
  13691. for iLoop := 0 to FLVNetWorkDiskUploadingFiles.Items.Count - 1 do
  13692. begin
  13693. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13694. AUploadMission := TUploadMission(ListItem.Data);
  13695. Missions.AddObject(AUploadMission.FID, AUploadMission);
  13696. try
  13697. FUploadMissions.Delete(FUploadMissions.IndexOf(AUploadMission.ID));
  13698. except
  13699. end;
  13700. end;
  13701. FSavedUploadMissions.Add(Missions);
  13702. FLVNetWorkDiskUploadingFiles.Items.Clear;
  13703. FindResult := FindFirst(UploadMission.FName + '\*.*', faDirectory, DSearchRec);
  13704. while FindResult = 0 do
  13705. begin
  13706. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13707. begin
  13708. if DirectoryExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13709. begin
  13710. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13711. end;
  13712. end;
  13713. FindResult := FindNext(DSearchRec);
  13714. end;
  13715. FindResult := FindFirst(UploadMission.FName + '\*.*', faAnyFile - faDirectory, DSearchRec);
  13716. while FindResult = 0 do
  13717. begin
  13718. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13719. begin
  13720. if FileExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13721. begin
  13722. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13723. end;
  13724. end;
  13725. FindResult := FindNext(DSearchRec);
  13726. end;
  13727. CheckUploadMissions;
  13728. end;
  13729. //------------------------------------------------------------------------------
  13730. procedure TMainForm.CheckUploadMissions;
  13731. var
  13732. ListItem: TRealICQContacterListItem;
  13733. UploadMission: TUploadMission;
  13734. Missions: TStringList;
  13735. iLoop: Integer;
  13736. ADirectory: TRealICQNetWorkDiskDirectory;
  13737. AFile: TRealICQNetWorkDiskFile;
  13738. Finded: Boolean;
  13739. MessageBoxResult: Integer;
  13740. ConfirmReplaceNDFileForm: TConfirmReplaceNDFileForm;
  13741. begin
  13742. if FLVNetWorkDiskUploadingFiles.OnlineNumeric = 0 then
  13743. begin
  13744. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  13745. begin
  13746. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  13747. UploadMission := TUploadMission(ListItem.Data);
  13748. if UploadMission.UploadMissionType = mtFile then
  13749. begin
  13750. with ListItem do
  13751. begin
  13752. LoginState := stOnline;
  13753. HasSMS := True;
  13754. Watchword := '';
  13755. SMSHint := '取消';
  13756. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13757. ReDrawItem;
  13758. end;
  13759. for iLoop := RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 downto 0 do
  13760. begin
  13761. AFile := RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop];
  13762. if AnsiSameText(ExtractFileName(AFile.Name), ExtractFileName(UploadMission.Name)) then
  13763. begin
  13764. if FConfirmReplaceResult <> mrYesToAll then
  13765. begin
  13766. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  13767. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(AFile.Name)]);
  13768. try
  13769. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  13770. finally
  13771. FreeAndNil(ConfirmReplaceNDFileForm);
  13772. end;
  13773. end;
  13774. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  13775. begin
  13776. //FreeAndNil(AFile);
  13777. RealICQNetWorkDiskClient.Delete('F' + IntToStr(AFile.ID));
  13778. Sleep(100);
  13779. Application.ProcessMessages;
  13780. Break;
  13781. end
  13782. else if FConfirmReplaceResult = mrNO then
  13783. begin
  13784. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  13785. FreeAndNil(UploadMission);
  13786. CheckUploadMissions;
  13787. Exit;
  13788. end
  13789. else if FConfirmReplaceResult = mrCancel then
  13790. begin
  13791. spbNDCancelAllClick(spbNDCancelAll);
  13792. Exit;
  13793. end;
  13794. end;
  13795. end;
  13796. while True do
  13797. begin
  13798. try
  13799. RealICQNetWorkDiskClient.UploadFile(UploadMission.Name, UploadMission.DirectoryID, UploadMission.ID);
  13800. Break;
  13801. except
  13802. on E: Exception do
  13803. begin
  13804. MessageBoxResult := MessageBox(Handle, PChar('上传文件时出错:'#$D#$A#$D#$A + E.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  13805. if MessageBoxResult = ID_ABORT then
  13806. begin
  13807. spbNDCancelAllClick(spbNDCancelAll);
  13808. Exit;
  13809. end
  13810. else if MessageBoxResult = ID_RETRY then
  13811. begin
  13812. Continue;
  13813. end
  13814. else if MessageBoxResult = ID_IGNORE then
  13815. begin
  13816. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  13817. FreeAndNil(UploadMission);
  13818. CheckUploadMissions;
  13819. Exit;
  13820. end;
  13821. end;
  13822. end; //try
  13823. end; //while
  13824. end
  13825. else
  13826. begin
  13827. with ListItem do
  13828. begin
  13829. LoginState := stOnline;
  13830. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13831. ReDrawItem;
  13832. end;
  13833. Finded := False;
  13834. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  13835. begin
  13836. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop];
  13837. if Length(ExtractFileName(UploadMission.Name)) > 0 then
  13838. begin
  13839. if AnsiSameText(ADirectory.Name, ExtractFileName(UploadMission.Name)) then
  13840. begin
  13841. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  13842. Finded := True;
  13843. end;
  13844. end
  13845. else
  13846. begin
  13847. if AnsiSameText(ADirectory.Name, '[' + Copy(UploadMission.Name, 1, 1) + ']') then
  13848. begin
  13849. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  13850. Finded := True;
  13851. end;
  13852. end;
  13853. end;
  13854. if not Finded then
  13855. begin
  13856. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  13857. RealICQNetWorkDiskClient.NewDirectory('[' + Copy(UploadMission.Name, 1, 1) + ']')
  13858. else
  13859. RealICQNetWorkDiskClient.NewDirectory(ExtractFileName(UploadMission.Name));
  13860. end;
  13861. end;
  13862. end;
  13863. end;
  13864. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  13865. if FLVNetWorkDiskUploadingFiles.Items.Count = 0 then
  13866. begin
  13867. if FSavedUploadMissions.Count > 0 then
  13868. begin
  13869. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  13870. begin
  13871. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  13872. begin
  13873. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13874. Missions := TStringList(FSavedUploadMissions[FSavedUploadMissions.Count - 1]);
  13875. FSavedUploadMissions.Remove(Missions);
  13876. for iLoop := 0 to Missions.Count - 1 do
  13877. begin
  13878. UploadMission := Missions.Objects[iLoop] as TUploadMission;
  13879. AddUploadMission(UploadMission.UploadMissionType, UploadMission.DirectoryID, UploadMission.Name, False);
  13880. FreeAndNil(UploadMission);
  13881. end;
  13882. Missions.Clear;
  13883. FreeAndNil(Missions);
  13884. CheckUploadMissions;
  13885. Exit;
  13886. end;
  13887. end;
  13888. end
  13889. else
  13890. begin
  13891. RealICQNetWorkDiskClient.GetUsedSpaceSize;
  13892. end;
  13893. end;
  13894. CheckNDControlState;
  13895. end;
  13896. //------------------------------------------------------------------------------
  13897. procedure TMainForm.CheckNDControlState;
  13898. begin
  13899. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count = 0) and (FLVNetWorkDiskDownloadingFiles.Items.Count = 0) and (FSavedUploadMissions.Count = 0) and (FSavedDownloadMissions.Count = 0) then
  13900. begin
  13901. pnlNDMissions.Visible := False;
  13902. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13903. end;
  13904. spbNDMoveUp.Enabled := not pnlNDMissions.Visible;
  13905. spbNDNewDir.Enabled := not pnlNDMissions.Visible;
  13906. spbNDDelete.Enabled := not pnlNDMissions.Visible;
  13907. spbNDUpload.Enabled := not pnlNDMissions.Visible;
  13908. spbNDDownload.Enabled := not pnlNDMissions.Visible;
  13909. spbNDRefresh.Enabled := not pnlNDMissions.Visible;
  13910. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13911. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  13912. if not pnlNDMissions.Visible then
  13913. begin
  13914. FConfirmReplaceResult := -1;
  13915. FLastDownloadDirectory := '';
  13916. NDSelectItemChanged(nil);
  13917. end;
  13918. end;
  13919. //------------------------------------------------------------------------------
  13920. procedure TMainForm.AddUploadMission(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string; CheckMission: Boolean = True);
  13921. var
  13922. UploadMission: TUploadMission;
  13923. ItemIndex: Integer;
  13924. ListItem: TRealICQContacterListItem;
  13925. begin
  13926. UploadMission := TUploadMission.Create(AUploadMissionType, ADirectoryID, AName);
  13927. if FUploadMissions.IndexOf(UploadMission.ID) >= 0 then
  13928. begin
  13929. MessageBox(Handle, PChar(AName + ' 已在任务队列中!'), '提示', MB_ICONINFORMATION);
  13930. Exit;
  13931. end;
  13932. FUploadMissions.AddObject(UploadMission.ID, UploadMission);
  13933. if not pnlNDMissions.Visible then
  13934. pnlNDMissions.Visible := True;
  13935. TabSetNDMissions.TabIndex := 0;
  13936. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13937. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  13938. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(UploadMission.ID);
  13939. if ItemIndex >= 0 then
  13940. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  13941. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.Add(UploadMission.ID);
  13942. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13943. with ListItem do
  13944. begin
  13945. LoginState := stOffline;
  13946. Data := UploadMission;
  13947. DisplayName := (UploadMission.Name);
  13948. Watchword := '队列中';
  13949. if UploadMission.UploadMissionType = mtFile then
  13950. begin
  13951. try
  13952. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(UploadMission.Name));
  13953. except
  13954. end;
  13955. end;
  13956. ReDrawItem;
  13957. end;
  13958. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  13959. if CheckMission then
  13960. CheckUploadMissions;
  13961. end;
  13962. //------------------------------------------------------------------------------
  13963. procedure TMainForm.AddDownloadMission(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = ''; CheckMission: Boolean = True);
  13964. var
  13965. DownloadMission: TDownloadMission;
  13966. ItemIndex: Integer;
  13967. ListItem: TRealICQContacterListItem;
  13968. begin
  13969. DownloadMission := TDownloadMission.Create(ADownloadMissionType, ADirectoryName, AFileID, AFileName);
  13970. if not pnlNDMissions.Visible then
  13971. pnlNDMissions.Visible := True;
  13972. TabSetNDMissions.TabIndex := 1;
  13973. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  13974. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  13975. ItemIndex := FLVNetWorkDiskDownloadingFiles.Items.Add(DownloadMission.ID);
  13976. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13977. with ListItem do
  13978. begin
  13979. LoginState := stOffline;
  13980. Data := DownloadMission;
  13981. Watchword := '队列中';
  13982. if DownloadMission.DownloadMissionType = mtFile then
  13983. begin
  13984. DisplayName := (DownloadMission.FileName);
  13985. try
  13986. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(DownloadMission.FileName));
  13987. except
  13988. end;
  13989. end
  13990. else
  13991. begin
  13992. DisplayName := (DownloadMission.DirectoryName);
  13993. end;
  13994. ReDrawItem;
  13995. end;
  13996. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  13997. if CheckMission then
  13998. CheckDownloadMissions;
  13999. end;
  14000. //------------------------------------------------------------------------------
  14001. procedure TMainForm.CheckDownloadMissions;
  14002. var
  14003. iLoop, jLoop: Integer;
  14004. ListItem: TRealICQContacterListItem;
  14005. DownloadMission: TDownloadMission;
  14006. ADownloadMission: TDownloadMission;
  14007. ADirectory: TRealICQNetWorkDiskDirectory;
  14008. Missions: TStringList;
  14009. begin
  14010. if FLVNetWorkDiskDownloadingFiles.OnlineNumeric = 0 then
  14011. begin
  14012. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14013. begin
  14014. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14015. DownloadMission := TDownloadMission(ListItem.Data);
  14016. if DownloadMission.DownloadMissionType = mtFile then
  14017. begin
  14018. with ListItem do
  14019. begin
  14020. LoginState := stOnline;
  14021. HasSMS := True;
  14022. Watchword := '';
  14023. SMSHint := '取消';
  14024. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14025. ReDrawItem;
  14026. end;
  14027. if FileExists(DownloadMission.FFileName) then
  14028. begin
  14029. if FConfirmReplaceResult <> mrYesToAll then
  14030. begin
  14031. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  14032. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(DownloadMission.FFileName)]);
  14033. try
  14034. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  14035. finally
  14036. FreeAndNil(ConfirmReplaceNDFileForm);
  14037. end;
  14038. end;
  14039. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  14040. begin
  14041. end
  14042. else if FConfirmReplaceResult = mrNO then
  14043. begin
  14044. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14045. FreeAndNil(DownloadMission);
  14046. CheckDownloadMissions;
  14047. Exit;
  14048. end
  14049. else if FConfirmReplaceResult = mrCancel then
  14050. begin
  14051. spbNDCancelAllClick(spbNDCancelAll);
  14052. Exit;
  14053. end;
  14054. end;
  14055. try
  14056. RealICQNetWorkDiskClient.DownloadFile(DownloadMission.FFileID, DownloadMission.FFileName);
  14057. except
  14058. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14059. FreeAndNil(DownloadMission);
  14060. CheckDownloadMissions;
  14061. Exit;
  14062. end;
  14063. end
  14064. else
  14065. begin
  14066. with ListItem do
  14067. begin
  14068. LoginState := stOnline;
  14069. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14070. ReDrawItem;
  14071. end;
  14072. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14073. begin
  14074. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14075. if AnsiSameText(ExtractFileName(ADirectory.Name), ExtractFileName(DownloadMission.DirectoryName)) then
  14076. begin
  14077. if not DirectoryExists(DownloadMission.DirectoryName) then
  14078. CreateDir(DownloadMission.DirectoryName);
  14079. FLastDownloadDirectory := DownloadMission.DirectoryName;
  14080. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14081. FreeAndNil(DownloadMission);
  14082. Missions := TStringList.Create;
  14083. for jLoop := 0 to FLVNetWorkDiskDownloadingFiles.Items.Count - 1 do
  14084. begin
  14085. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[jLoop] as TRealICQContacterListItem;
  14086. ADownloadMission := TDownloadMission(ListItem.Data);
  14087. Missions.AddObject(ADownloadMission.FID, ADownloadMission);
  14088. end;
  14089. FSavedDownloadMissions.Add(Missions);
  14090. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  14091. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14092. Exit;
  14093. end;
  14094. end;
  14095. end;
  14096. end;
  14097. end;
  14098. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  14099. if FLVNetWorkDiskDownloadingFiles.Items.Count = 0 then
  14100. begin
  14101. if FSavedDownloadMissions.Count > 0 then
  14102. begin
  14103. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  14104. begin
  14105. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  14106. begin
  14107. FLastDownloadDirectory := '';
  14108. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  14109. Missions := TStringList(FSavedDownloadMissions[FSavedDownloadMissions.Count - 1]);
  14110. FSavedDownloadMissions.Remove(Missions);
  14111. for iLoop := 0 to Missions.Count - 1 do
  14112. begin
  14113. DownloadMission := Missions.Objects[iLoop] as TDownloadMission;
  14114. AddDownloadMission(DownloadMission.DownloadMissionType, DownloadMission.DirectoryName, DownloadMission.FileID, DownloadMission.FileName, False);
  14115. FreeAndNil(DownloadMission);
  14116. end;
  14117. Missions.Clear;
  14118. FreeAndNil(Missions);
  14119. CheckDownloadMissions;
  14120. Exit;
  14121. end;
  14122. end;
  14123. end;
  14124. end;
  14125. CheckNDControlState;
  14126. end;
  14127. //------------------------------------------------------------------------------
  14128. procedure TMainForm.spbNDUploadClick(Sender: TObject);
  14129. var
  14130. iLoop: Integer;
  14131. begin
  14132. MainForm.FormStyle := fsNormal;
  14133. try
  14134. if UploadFileOpenDialog.Execute then
  14135. begin
  14136. for iLoop := 0 to UploadFileOpenDialog.Files.Count - 1 do
  14137. begin
  14138. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadFileOpenDialog.Files.Strings[iLoop], False);
  14139. end;
  14140. end;
  14141. finally
  14142. // if MainForm.AlwaysOnTop then
  14143. // MainForm.FormStyle := fsStayOnTop
  14144. // else
  14145. // MainForm.FormStyle := fsNormal;
  14146. CheckUploadMissions;
  14147. end;
  14148. end;
  14149. procedure TMainForm.spbNextClick(Sender: TObject);
  14150. var
  14151. TabSheet: TTabSheet;
  14152. WebBrowser: TWebBrowser;
  14153. begin
  14154. try
  14155. TabSheet := pgcMultiWeb.ActivePage;
  14156. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14157. if WebBrowser.Busy then
  14158. WebBrowser.Stop;
  14159. WebBrowser.GoForward;
  14160. except
  14161. end;
  14162. end;
  14163. function TMainForm.GetDefaultBrowser: string;//获取默认浏览器
  14164. var
  14165. reg: TRegistry;
  14166. begin
  14167. reg := TRegistry.Create;
  14168. try
  14169. {reg.RootKey := HKEY_CLASSES_ROOT;
  14170. reg.OpenKey('HTTP\shell\open\ddeexec\Application',false);
  14171. result:=reg.ReadString('');
  14172. reg.CloseKey; }
  14173. reg.RootKey := HKEY_CLASSES_ROOT;
  14174. reg.OpenKey('http\\shell\\open\\command', false);
  14175. result := reg.ReadString('');
  14176. result := Copy(result, Pos('"', result) + 1, Length(result) - 1);
  14177. result := Copy(result, 1, Pos('"', result) - 1);
  14178. reg.CloseKey;
  14179. finally
  14180. if (result = '') then
  14181. result := 'IEXPLORE.EXE';
  14182. reg.Free;
  14183. end;
  14184. end;
  14185. //---用户自助管理平台--------------------------------------
  14186. procedure TMainForm.spbPersonManageClick(Sender: TObject);
  14187. //var
  14188. // EncryptStr,
  14189. // Md5Pwd,
  14190. // Url,
  14191. // TmpStr:String;
  14192. begin
  14193. //Md5Pwd:=Md5En(RealICQClient.Password);
  14194. //TmpStr:='{'+RealICQClient.Me.LoginName+'}{'+Md5Pwd+'}';
  14195. //EncryptStr:=StrToBase64(Encrypt(TmpStr,'B77A5C561934E089'));
  14196. //Url:=RealICQClient.PersonManageUrl+'?'+ EncryptStr;
  14197. // ShellExecute(handle,'open', 'IEXPLORE.EXE', 'http://www.baidu.com', nil,SW_SHOWNORMAL);//
  14198. // ShellExecute(handle, 'open','http://220.191.210.103:8080/Default.aspx?url=', '','',SW_SHOWDEFAULT);
  14199. //MessageBox(Handle, PChar(RealICQClient.WebAppBaseURL), '提示', MB_ICONQUESTION);
  14200. //MessageBox(Handle, PChar(LoginURL), '提示', MB_ICONQUESTION);
  14201. //ShellExecute(handle, 'open', PChar(GetDefaultBrowser),PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), ''])), '',SW_SHOWDEFAULT);
  14202. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(LoginURL)])), '', SW_SHOWDEFAULT);
  14203. end;
  14204. procedure TMainForm.spbPrevClick(Sender: TObject);
  14205. var
  14206. TabSheet: TTabSheet;
  14207. WebBrowser: TWebBrowser;
  14208. begin
  14209. try
  14210. TabSheet := pgcMultiWeb.ActivePage;
  14211. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14212. if WebBrowser.Busy then
  14213. WebBrowser.Stop;
  14214. WebBrowser.GoBack;
  14215. except
  14216. end;
  14217. end;
  14218. procedure TMainForm.spbPrintPrevClick(Sender: TObject);
  14219. var
  14220. TabSheet: TTabSheet;
  14221. WebBrowser: TWebBrowser;
  14222. begin
  14223. MainForm.FormStyle := fsNormal;
  14224. try
  14225. try
  14226. TabSheet := pgcMultiWeb.ActivePage;
  14227. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14228. if WebBrowser.QueryStatusWB(OLECMDID_PRINTPREVIEW) = 3 then
  14229. WebBrowser.ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT, EmptyParam, EmptyParam);
  14230. except
  14231. end;
  14232. finally
  14233. // if MainForm.AlwaysOnTop then
  14234. // MainForm.FormStyle := fsStayOnTop
  14235. // else
  14236. // MainForm.FormStyle := fsNormal;
  14237. end;
  14238. end;
  14239. procedure TMainForm.spbRefreshBranchUsersClick(Sender: TObject);
  14240. begin
  14241. //
  14242. {TimerForGetBranchOnlineStates.Enabled := False;
  14243. TimerForGetBranchOnlineStates.Enabled := True;}
  14244. miChangeServerClick(nil);
  14245. TimerForGetBranchUsersOnlineStates.Enabled := False;
  14246. TimerForGetBranchUsersOnlineStates.Enabled := True;
  14247. end;
  14248. procedure TMainForm.spbRefreshClick(Sender: TObject);
  14249. var
  14250. TabSheet: TTabSheet;
  14251. WebBrowser: TWebBrowser;
  14252. begin
  14253. try
  14254. TabSheet := pgcMultiWeb.ActivePage;
  14255. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14256. if WebBrowser.Busy then
  14257. WebBrowser.Stop;
  14258. WebBrowser.Refresh;
  14259. except
  14260. end;
  14261. end;
  14262. //------------------------------------------------------------------------------
  14263. procedure TMainForm.RealICQNetWorkDiskClientNewDirResult(Sender: TObject; Directory: TRealICQNetWorkDiskDirectory);
  14264. var
  14265. ItemIndex: Integer;
  14266. ListItem: TRealICQContacterListItem;
  14267. UploadMission: TUploadMission;
  14268. NDDirName: string;
  14269. begin
  14270. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14271. begin
  14272. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14273. UploadMission := TUploadMission(ListItem.Data);
  14274. if UploadMission.UploadMissionType = mtDir then
  14275. begin
  14276. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14277. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14278. else
  14279. NDDirName := ExtractFileName(UploadMission.Name);
  14280. if AnsiSameText(NDDirName, Directory.Name) and (Directory.ParentID = UploadMission.DirectoryID) then
  14281. begin
  14282. RealICQNetWorkDiskClient.GetDirectory(Directory);
  14283. Exit;
  14284. end;
  14285. end;
  14286. end;
  14287. if Directory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14288. Exit;
  14289. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(Directory.ID));
  14290. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14291. with ListItem do
  14292. begin
  14293. LoginState := stOnline;
  14294. Data := Directory;
  14295. DisplayName := Directory.Name;
  14296. ReDrawItem;
  14297. end;
  14298. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14299. end;
  14300. //------------------------------------------------------------------------------
  14301. procedure TMainForm.RealICQNetWorkDiskClientNoSpace(Sender: TObject);
  14302. begin
  14303. ShowNetWorkDiskSpaceInfo;
  14304. spbNDCancelAllClick(spbNDCancelAll);
  14305. MessageBox(Handle, '抱歉!您的网络硬盘空间不足,任务已取消!', '提示', MB_ICONINFORMATION);
  14306. end;
  14307. //------------------------------------------------------------------------------
  14308. procedure TMainForm.RealICQNetWorkDiskClientRenamedDir(Sender: TObject; ADirectory: TRealICQNetWorkDiskDirectory);
  14309. var
  14310. ItemIndex: Integer;
  14311. ListItem: TRealICQContacterListItem;
  14312. begin
  14313. FLVNetWorkDisk.AdjustPosition := False;
  14314. try
  14315. if ADirectory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14316. Exit;
  14317. ItemIndex := FLVNetWorkDisk.Items.IndexOf('D' + IntToStr(ADirectory.ID));
  14318. if ItemIndex < 0 then
  14319. Exit;
  14320. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14321. with ListItem do
  14322. begin
  14323. LoginState := stOnline;
  14324. Data := ADirectory;
  14325. DisplayName := ADirectory.Name;
  14326. ReDrawItem;
  14327. end;
  14328. finally
  14329. FLVNetWorkDisk.AdjustPosition := True;
  14330. end;
  14331. end;
  14332. //------------------------------------------------------------------------------
  14333. procedure TMainForm.RealICQNetWorkDiskClientRenamedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile);
  14334. var
  14335. ItemIndex: Integer;
  14336. ListItem: TRealICQContacterListItem;
  14337. begin
  14338. FLVNetWorkDisk.AdjustPosition := False;
  14339. try
  14340. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14341. Exit;
  14342. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14343. if ItemIndex < 0 then
  14344. Exit;
  14345. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14346. with ListItem do
  14347. begin
  14348. LoginState := stLeave;
  14349. Data := AFile;
  14350. DisplayName := AFile.Name;
  14351. try
  14352. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14353. except
  14354. end;
  14355. ReDrawItem;
  14356. end;
  14357. finally
  14358. FLVNetWorkDisk.AdjustPosition := True;
  14359. end;
  14360. end;
  14361. //------------------------------------------------------------------------------
  14362. procedure TMainForm.RealICQNetWorkDiskClientUploadedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile; AMissionID: string);
  14363. var
  14364. iLoop: Integer;
  14365. ItemIndex: Integer;
  14366. ListItem: TRealICQContacterListItem;
  14367. UploadMission: TUploadMission;
  14368. AFile1: TRealICQNetWorkDiskFile;
  14369. Finded: Boolean;
  14370. begin
  14371. try
  14372. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14373. if ItemIndex >= 0 then
  14374. begin
  14375. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14376. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14377. UploadMission := TUploadMission(ListItem.Data);
  14378. FreeAndNil(UploadMission);
  14379. end;
  14380. FLVNetWorkDisk.AdjustPosition := False;
  14381. try
  14382. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14383. Exit;
  14384. Finded := False;
  14385. ListItem := nil;
  14386. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14387. begin
  14388. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14389. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14390. begin
  14391. AFile1 := TRealICQNetWorkDiskFile(ListItem.Data);
  14392. if AnsiSameText(AFile1.Name, AFile.Name) then
  14393. begin
  14394. Finded := True;
  14395. Break;
  14396. end;
  14397. end;
  14398. end;
  14399. if not Finded then
  14400. begin
  14401. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14402. if ItemIndex >= 0 then
  14403. begin
  14404. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14405. Finded := True;
  14406. end;
  14407. end;
  14408. if not Finded then
  14409. begin
  14410. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14411. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14412. end;
  14413. with ListItem do
  14414. begin
  14415. LoginState := stLeave;
  14416. Data := AFile;
  14417. DisplayName := AFile.Name;
  14418. if AFile.Size >= 1024 * 1024 then
  14419. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14420. else if AFile.Size >= 1024 then
  14421. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14422. else
  14423. Watchword := IntToStr(AFile.Size) + 'B';
  14424. try
  14425. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14426. except
  14427. end;
  14428. ReDrawItem;
  14429. end;
  14430. finally
  14431. FLVNetWorkDisk.AdjustPosition := True;
  14432. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14433. ShowNetWorkDiskSpaceInfo;
  14434. end;
  14435. finally
  14436. CheckUploadMissions;
  14437. end;
  14438. end;
  14439. //------------------------------------------------------------------------------
  14440. procedure TMainForm.RealICQNetWorkDiskClientUploadFileAborted(Sender: TObject; AMissionID: string);
  14441. var
  14442. ItemIndex: Integer;
  14443. ListItem: TRealICQContacterListItem;
  14444. UploadMission: TUploadMission;
  14445. begin
  14446. try
  14447. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14448. if ItemIndex >= 0 then
  14449. begin
  14450. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14451. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14452. UploadMission := TUploadMission(ListItem.Data);
  14453. FreeAndNil(UploadMission);
  14454. end;
  14455. finally
  14456. CheckUploadMissions;
  14457. end;
  14458. end;
  14459. //------------------------------------------------------------------------------
  14460. procedure TMainForm.RealICQNetWorkDiskClientUploadingFile(Sender: TObject; ATransmitter: TResponsionStreamTransmitter; ATransmittedSize: Int64);
  14461. var
  14462. ItemIndex: Integer;
  14463. ListItem: TRealICQContacterListItem;
  14464. Completed: Integer;
  14465. ASpeed: Cardinal;
  14466. SpeedStr: string;
  14467. begin
  14468. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf((ATransmitter as TNetWorkFileTransmitter).MissionID);
  14469. if ItemIndex >= 0 then
  14470. begin
  14471. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14472. with ListItem do
  14473. begin
  14474. Completed := ATransmittedSize * 100 div ATransmitter.StreamLength;
  14475. try
  14476. ASpeed := Round(ATransmittedSize div ((GetTickCount - ATransmitter.StartTicket) div 1000) * 1.2);
  14477. except
  14478. Exit;
  14479. end;
  14480. if ASpeed > 1000 * 1000 then
  14481. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14482. else if ASpeed > 1000 then
  14483. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14484. else
  14485. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14486. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14487. DisplayName := DisplayName + ((ATransmitter as TNetWorkFileTransmitter).FileName);
  14488. ReDrawItem;
  14489. end;
  14490. end;
  14491. end;
  14492. function ServiceGetStatus(sMachine, sService: string): DWord;
  14493. var
  14494. //service control
  14495. //manager handle
  14496. schm,
  14497. //service handle
  14498. schs: SC_Handle;
  14499. //service status
  14500. ss: TServiceStatus;
  14501. //current service status
  14502. dwStat: DWord;
  14503. begin
  14504. dwStat := 0;
  14505. //connect to the service
  14506. //control manager
  14507. schm := OpenSCManager(pchar(sMachine), Nil, SC_MANAGER_CONNECT);
  14508. //if successful...
  14509. if (schm > 0) then
  14510. begin
  14511. //open a handle to
  14512. //the specified service
  14513. schs := OpenService(schm, PChar(sService), SERVICE_QUERY_STATUS);
  14514. //if successful...
  14515. if (schs > 0) then
  14516. begin
  14517. //retrieve the current status
  14518. //of the specified service
  14519. if (QueryServiceStatus(schs, ss)) then
  14520. begin
  14521. dwStat := ss.dwCurrentState;
  14522. end;
  14523. //close service handle
  14524. CloseServiceHandle(schs);
  14525. end;
  14526. // close service control
  14527. // manager handle
  14528. CloseServiceHandle(schm);
  14529. end;
  14530. Result := dwStat;
  14531. end;
  14532. function ServiceUninstalled(sMachine, sService: string): boolean;
  14533. begin
  14534. Result := 0 = ServiceGetStatus(sMachine, sService);
  14535. end;
  14536. //------------------------------------------------------------------------------
  14537. //调用360杀毒软件
  14538. //------------------------------------------------------------------------------
  14539. procedure TMainForm.spb360SDClick(Sender: TObject);
  14540. begin
  14541. //
  14542. end;
  14543. //------------------------------------------------------------------------------
  14544. //调用360安全卫士
  14545. //------------------------------------------------------------------------------
  14546. procedure TMainForm.spb360SafeClick(Sender: TObject);
  14547. var
  14548. URL: string;
  14549. TempReg: TRegistry;
  14550. safePath: string;
  14551. begin
  14552. URL := 'http://' + self.RealICQClient.RemoteAddress + '/client/setup.exe';
  14553. try
  14554. TempReg := TRegistry.Create;
  14555. try
  14556. TempReg.RootKey := HKEY_LOCAL_MACHINE;
  14557. if not TempReg.OpenKey('\Software\360Safe\menuext\LiveUpdate360', False) then
  14558. //DownloadUpdate(URL)
  14559. else
  14560. begin
  14561. safePath := ExtractFilePath(TempReg.ReadString('Application'));
  14562. //WinExec(PChar(safePath+'\360Safe.exe'),SW_SHOW);
  14563. end;
  14564. finally
  14565. TempReg.Free;
  14566. end;
  14567. except
  14568. end;
  14569. end;
  14570. //------------------------------------------------------------------------------
  14571. procedure TMainForm.spbNDDeleteClick(Sender: TObject);
  14572. var
  14573. ListItem: TRealICQContacterListItem;
  14574. iLoop: Integer;
  14575. AList: string;
  14576. begin
  14577. if FLVNetWorkDisk.SelCount <= 0 then
  14578. Exit;
  14579. if (GetKeyState(VK_Shift) and - 128) = 0 then
  14580. begin
  14581. if MessageBox(Handle, '确认要删除选中的文件吗?', '提示', MB_ICONQUESTION or MB_OKCANCEL) <> ID_OK then
  14582. Exit;
  14583. end;
  14584. AList := '';
  14585. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14586. begin
  14587. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14588. if ListItem.Selected then
  14589. begin
  14590. AList := AList + ListItem.LoginName + Chr(10);
  14591. end;
  14592. if Length(AList) >= 1024 then
  14593. begin
  14594. RealICQNetWorkDiskClient.Delete(AList);
  14595. AList := '';
  14596. Sleep(1000);
  14597. end;
  14598. end;
  14599. if Length(AList) > 0 then
  14600. RealICQNetWorkDiskClient.Delete(AList);
  14601. end;
  14602. //------------------------------------------------------------------------------
  14603. procedure TMainForm.spbNDDisconnectClick(Sender: TObject);
  14604. begin
  14605. RealICQNetWorkDiskClient.Logout;
  14606. end;
  14607. //------------------------------------------------------------------------------
  14608. procedure TMainForm.spbNDDownloadClick(Sender: TObject);
  14609. var
  14610. iLoop: Integer;
  14611. ListItem: TRealICQContacterListItem;
  14612. Dir: string;
  14613. AFile: TRealICQNetWorkDiskFile;
  14614. ADirectory: TRealICQNetWorkDiskDirectory;
  14615. begin
  14616. if FLVNetWorkDisk.SelCount = 0 then
  14617. Exit;
  14618. if FLVNetWorkDisk.SelCount = 1 then
  14619. begin
  14620. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14621. begin
  14622. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14623. if ListItem.Selected then
  14624. begin
  14625. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14626. begin
  14627. NDItemDoubleClick(ListItem);
  14628. Exit;
  14629. end;
  14630. end;
  14631. end;
  14632. end;
  14633. MainForm.FormStyle := fsNormal;
  14634. try
  14635. if SelectDirectory('请选择目录', '', Dir) then
  14636. begin
  14637. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14638. begin
  14639. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14640. if ListItem.Selected then
  14641. begin
  14642. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14643. begin
  14644. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14645. AddDownloadMission(mtDir, Dir + '\' + ADirectory.Name, 0, '', False);
  14646. end
  14647. else
  14648. begin
  14649. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14650. AddDownloadMission(mtFile, ExtractFilePath(Dir), AFile.ID, Dir + '\' + AFile.Name, False);
  14651. end;
  14652. end;
  14653. end; //for
  14654. CheckDownloadMissions;
  14655. end;
  14656. finally
  14657. // if MainForm.AlwaysOnTop then
  14658. // MainForm.FormStyle := fsStayOnTop
  14659. // else
  14660. // MainForm.FormStyle := fsNormal;
  14661. end;
  14662. end;
  14663. //------------------------------------------------------------------------------
  14664. procedure TMainForm.NDItemDoubleClick(Item: TRealICQContacterListItem);
  14665. var
  14666. AFile: TRealICQNetWorkDiskFile;
  14667. ADirectory: TRealICQNetWorkDiskDirectory;
  14668. begin
  14669. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  14670. begin
  14671. Exit;
  14672. end;
  14673. if Copy(Item.LoginName, 1, 1) = 'D' then
  14674. begin
  14675. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  14676. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14677. end
  14678. else if Copy(Item.LoginName, 1, 1) = 'F' then
  14679. begin
  14680. AFile := TRealICQNetWorkDiskFile(Item.Data);
  14681. MainForm.FormStyle := fsNormal;
  14682. try
  14683. DownloadFileSaveDialog.FileName := AFile.Name;
  14684. if DownloadFileSaveDialog.Execute then
  14685. begin
  14686. AddDownloadMission(mtFile, ExtractFilePath(DownloadFileSaveDialog.FileName), AFile.ID, DownloadFileSaveDialog.FileName, True);
  14687. end;
  14688. finally
  14689. // if MainForm.AlwaysOnTop then
  14690. // MainForm.FormStyle := fsStayOnTop
  14691. // else
  14692. // MainForm.FormStyle := fsNormal;
  14693. end;
  14694. end;
  14695. end;
  14696. //------------------------------------------------------------------------------
  14697. procedure TMainForm.RealICQNetWorkDiskClientDeleteResult(Sender: TObject; AList: string);
  14698. var
  14699. AStringList: TStringList;
  14700. iLoop, iIndex: Integer;
  14701. begin
  14702. AStringList := SplitString(AList, Chr(10));
  14703. FLVNetWorkDisk.DisableAlign;
  14704. try
  14705. for iLoop := 0 to AStringList.Count - 1 do
  14706. begin
  14707. iIndex := FLVNetWorkDisk.Items.IndexOf(AStringList.Strings[iLoop]);
  14708. if iIndex >= 0 then
  14709. FLVNetWorkDisk.Items.Delete(iIndex);
  14710. end;
  14711. finally
  14712. FLVNetWorkDisk.EnableAlign;
  14713. FreeAndNil(AStringList);
  14714. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14715. ShowNetWorkDiskSpaceInfo;
  14716. NDSelectItemChanged(nil);
  14717. end;
  14718. end;
  14719. //------------------------------------------------------------------------------
  14720. procedure TMainForm.RealICQNetWorkDiskClientDirectoryListReady(Sender: TObject);
  14721. var
  14722. iLoop, ItemIndex: Integer;
  14723. AFile: TRealICQNetWorkDiskFile;
  14724. ADirectory: TRealICQNetWorkDiskDirectory;
  14725. ListItem: TRealICQContacterListItem;
  14726. Bitmap: TBitmap;
  14727. UploadMission: TUploadMission;
  14728. NDDirName: string;
  14729. begin
  14730. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  14731. edNDDir.Text := '';
  14732. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory;
  14733. while ADirectory <> nil do
  14734. begin
  14735. edNDDir.Text := ADirectory.Name + '\' + edNDDir.Text;
  14736. ADirectory := ADirectory.Parent;
  14737. end;
  14738. try
  14739. FLVNetWorkDisk.AdjustPosition := False;
  14740. FLVNetWorkDisk.DisableAlign;
  14741. FLVNetWorkDisk.Items.Clear;
  14742. NDSelectItemChanged(nil);
  14743. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14744. begin
  14745. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14746. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(ADirectory.ID));
  14747. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14748. with ListItem do
  14749. begin
  14750. LoginState := stOnline;
  14751. Data := ADirectory;
  14752. DisplayName := ADirectory.Name;
  14753. end;
  14754. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, 0, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14755. lblNDState.Update;
  14756. end;
  14757. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 do
  14758. begin
  14759. AFile := TRealICQNetWorkDiskFile(RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop]);
  14760. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14761. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14762. with ListItem do
  14763. begin
  14764. LoginState := stLeave;
  14765. Data := AFile;
  14766. DisplayName := AFile.Name;
  14767. if AFile.Size >= 1024 * 1024 then
  14768. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14769. else if AFile.Size >= 1024 then
  14770. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14771. else
  14772. Watchword := IntToStr(AFile.Size) + 'B';
  14773. try
  14774. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14775. except
  14776. end;
  14777. FreeAndNil(Bitmap);
  14778. end;
  14779. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14780. lblNDState.Update;
  14781. end;
  14782. finally
  14783. FLVNetWorkDisk.ReDrawAll;
  14784. FLVNetWorkDisk.EnableAlign;
  14785. FLVNetWorkDisk.AdjustPosition := True;
  14786. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14787. end;
  14788. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14789. begin
  14790. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14791. UploadMission := TUploadMission(ListItem.Data);
  14792. if UploadMission.UploadMissionType = mtDir then
  14793. begin
  14794. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14795. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14796. else
  14797. NDDirName := ExtractFileName(UploadMission.Name);
  14798. if AnsiSameText(NDDirName, RealICQNetWorkDiskClient.CurrentDirectory.Name) and (RealICQNetWorkDiskClient.CurrentDirectory.ParentID = UploadMission.DirectoryID) then
  14799. begin
  14800. try
  14801. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  14802. except
  14803. end;
  14804. try
  14805. GoNextLevelUploadMissions(UploadMission);
  14806. finally
  14807. FreeAndNil(UploadMission);
  14808. end;
  14809. Exit;
  14810. end;
  14811. end;
  14812. end;
  14813. if Length(Trim(FLastDownloadDirectory)) > 0 then
  14814. begin
  14815. if (DirectoryExists(FLastDownloadDirectory)) then
  14816. begin
  14817. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14818. begin
  14819. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14820. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14821. begin
  14822. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14823. AddDownloadMission(mtDir, FLastDownloadDirectory + '\' + ADirectory.Name, 0, '', False);
  14824. end
  14825. else
  14826. begin
  14827. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14828. AddDownloadMission(mtFile, ExtractFilePath(FLastDownloadDirectory), AFile.ID, FLastDownloadDirectory + '\' + AFile.Name, False);
  14829. end;
  14830. end; //for
  14831. CheckDownloadMissions;
  14832. end;
  14833. end;
  14834. end;
  14835. //------------------------------------------------------------------------------
  14836. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileAborted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14837. begin
  14838. end;
  14839. //------------------------------------------------------------------------------
  14840. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileCompleted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14841. var
  14842. ListItem: TRealICQContacterListItem;
  14843. DownloadMission: TDownloadMission;
  14844. MessageBoxResult: Integer;
  14845. begin
  14846. if not RealICQNetWorkDiskClient.Connected then
  14847. Exit;
  14848. try
  14849. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14850. begin
  14851. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14852. DownloadMission := TDownloadMission(ListItem.Data);
  14853. if DownloadMission.FFileID = AFileDownloader.FileID then
  14854. begin
  14855. if not AFileDownloader.Completed then
  14856. begin
  14857. if AFileDownloader.Exp <> nil then
  14858. begin
  14859. MessageBoxResult := MessageBox(Handle, PChar('下载文件时出错:'#$D#$A#$D#$A + AFileDownloader.Exp.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  14860. if MessageBoxResult = ID_ABORT then
  14861. begin
  14862. spbNDCancelAllClick(spbNDCancelAll);
  14863. Exit;
  14864. end
  14865. else if MessageBoxResult = ID_RETRY then
  14866. begin
  14867. CheckDownloadMissions;
  14868. Exit;
  14869. end
  14870. else if MessageBoxResult = ID_IGNORE then
  14871. begin
  14872. end;
  14873. end;
  14874. end;
  14875. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14876. FreeAndNil(DownloadMission);
  14877. end;
  14878. end;
  14879. except
  14880. end;
  14881. CheckDownloadMissions;
  14882. end;
  14883. //------------------------------------------------------------------------------
  14884. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileTransmitting(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  14885. var
  14886. ListItem: TRealICQContacterListItem;
  14887. Completed: Integer;
  14888. ASpeed: Cardinal;
  14889. SpeedStr: string;
  14890. begin
  14891. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14892. begin
  14893. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14894. with ListItem do
  14895. begin
  14896. Completed := AFileDownloader.RecvedSize * 100 div AFileDownloader.FileSize;
  14897. try
  14898. ASpeed := Round(AFileDownloader.RecvedSize div ((GetTickCount - AFileDownloader.StartTicket) div 1000) * 1.2);
  14899. except
  14900. Exit;
  14901. end;
  14902. if ASpeed > 1000 * 1000 then
  14903. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14904. else if ASpeed > 1000 then
  14905. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14906. else
  14907. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14908. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14909. DisplayName := DisplayName + (AFileDownloader.LocalFileName);
  14910. ReDrawItem;
  14911. end;
  14912. end;
  14913. end;
  14914. //------------------------------------------------------------------------------
  14915. procedure TMainForm.RealICQNetWorkDiskClientGettedUsedSpaceSize(Sender: TObject);
  14916. begin
  14917. ShowNetWorkDiskSpaceInfo;
  14918. end;
  14919. //------------------------------------------------------------------------------
  14920. procedure TMainForm.RealICQNetWorkDiskClientLoginFailed(Sender: TObject; E: Exception);
  14921. begin
  14922. lblNDState.Caption := '连接失败(' + E.Message + ')';
  14923. end;
  14924. //------------------------------------------------------------------------------
  14925. procedure TMainForm.RealICQNetWorkDiskClientLoginResult(Sender: TObject; LoginResultType: Byte);
  14926. begin
  14927. if LoginResultType = 0 then
  14928. begin
  14929. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory);
  14930. end
  14931. else if LoginResultType = 1 then
  14932. begin
  14933. lblNDState.Caption := '连接失败,服务器版本错误';
  14934. end
  14935. else if LoginResultType = 2 then
  14936. begin
  14937. lblNDState.Caption := '连接失败,用户验证错误';
  14938. end;
  14939. end;
  14940. //------------------------------------------------------------------------------
  14941. procedure TMainForm.RealICQClientBeDropped(Sender: TObject; Excuse: string);
  14942. begin
  14943. MessageBox(Handle, PChar(Excuse), '你已被强制下线', MB_ICONINFORMATION or MB_OK);
  14944. TTeamsAdapter.Stop;
  14945. end;
  14946. //------------------------------------------------------------------------------
  14947. procedure TMainForm.RealICQClientDownloadFile(Sender: TObject; AFileName: string);
  14948. var
  14949. iLoop: Integer;
  14950. WebPanel: TWebPanel;
  14951. TabSheet: TTabSheet;
  14952. Bitmap: TBitmap;
  14953. begin
  14954. for iLoop := 0 to FWebTabs.Count - 1 do
  14955. begin
  14956. TabSheet := FWebTabs[iLoop];
  14957. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  14958. if AnsiSameText(WebPanel.Image, AFileName) then
  14959. begin
  14960. Bitmap := TBitmap.Create;
  14961. try
  14962. try
  14963. Bitmap.LoadFromFile(AFileName);
  14964. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  14965. ImgLstPageControl.Add(Bitmap, Bitmap);
  14966. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  14967. except
  14968. end;
  14969. finally
  14970. FreeAndNil(Bitmap);
  14971. end;
  14972. end;
  14973. end;
  14974. end;
  14975. //------------------------------------------------------------------------------
  14976. procedure TMainForm.RealICQClientDownloadTeamFace(Sender: TObject; AFileName: string);
  14977. begin
  14978. ShowGettedFace(AFileName);
  14979. end;
  14980. //------------------------------------------------------------------------------
  14981. procedure TMainForm.RealICQClientLoginFailed(Sender: TObject; E: Exception);
  14982. begin
  14983. TimerForLogining.Enabled := False;
  14984. SetUIState;
  14985. MessageBox(Handle, PChar('抱歉,您现在无法登录至服务器: ' + E.Message), '登录失败', MB_ICONINFORMATION or MB_OK);
  14986. end;
  14987. //------------------------------------------------------------------------------
  14988. procedure TMainForm.actShowLoginNameExecute(Sender: TObject);
  14989. var
  14990. iLoop: Integer;
  14991. RealICQContacterListView: TRealICQContacterListView;
  14992. RealICQContacterTreeView: TRealICQContacterTreeView;
  14993. begin
  14994. for iLoop := 0 to FContacterListViews.Count - 1 do
  14995. begin
  14996. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  14997. RealICQContacterListView.CaptionStyle := csLoginName;
  14998. end;
  14999. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15000. begin
  15001. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15002. RealICQContacterTreeView.CaptionStyle := csLoginName;
  15003. RealICQContacterTreeView.ReDrawAll;
  15004. end;
  15005. FLVCaptionStyle := csLoginName;
  15006. SaveStyleConfigs;
  15007. end;
  15008. //------------------------------------------------------------------------------
  15009. procedure TMainForm.actShowDisplayNameExecute(Sender: TObject);
  15010. var
  15011. iLoop: Integer;
  15012. RealICQContacterListView: TRealICQContacterListView;
  15013. RealICQContacterTreeView: TRealICQContacterTreeView;
  15014. begin
  15015. for iLoop := 0 to FContacterListViews.Count - 1 do
  15016. begin
  15017. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15018. RealICQContacterListView.CaptionStyle := csDisplayName;
  15019. end;
  15020. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15021. begin
  15022. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15023. RealICQContacterTreeView.CaptionStyle := csDisplayName;
  15024. RealICQContacterTreeView.ReDrawAll;
  15025. end;
  15026. FLVCaptionStyle := csDisplayName;
  15027. SaveStyleConfigs;
  15028. end;
  15029. //------------------------------------------------------------------------------
  15030. procedure TMainForm.actShowGIFInMailFormExecute(Sender: TObject);
  15031. begin
  15032. actShowGIFInMailForm.Checked := not actShowGIFInMailForm.Checked;
  15033. FShowGIFInMailForm := actShowGIFInMailForm.Checked;
  15034. SaveStyleConfigs;
  15035. if RealICQClient.Me = nil then
  15036. Exit;
  15037. if RealICQClient.Me.HeadImageFileType = htGIF then
  15038. begin
  15039. ShowMeInformation;
  15040. end;
  15041. end;
  15042. //------------------------------------------------------------------------------
  15043. procedure TMainForm.actShowGIFInTalkingFormExecute(Sender: TObject);
  15044. begin
  15045. actShowGIFInTalkingForm.Checked := not actShowGIFInTalkingForm.Checked;
  15046. FShowGIFInTalkingForm := actShowGIFInTalkingForm.Checked;
  15047. SaveStyleConfigs;
  15048. UpdateAllTakingFormGIFHeadImage;
  15049. end;
  15050. //------------------------------------------------------------------------------
  15051. procedure TMainForm.actShowGroupExecute(Sender: TObject);
  15052. begin
  15053. FShowGroup := not FShowGroup;
  15054. actShowGroup.Checked := FShowGroup;
  15055. SaveIfShowGroupConfig;
  15056. ShowGroupInterface;
  15057. end;
  15058. //------------------------------------------------------------------------------
  15059. function TMainForm.GetSelectedLoginName: string;
  15060. var
  15061. GroupIndex, iLoop: Integer;
  15062. GroupName: string;
  15063. ListView: TRealICQContacterListView;
  15064. ListItem: TRealICQContacterListItem;
  15065. ItemIndex: Integer;
  15066. RealICQFriendTreeView: TRealICQContacterTreeView;
  15067. RealICQContacterTreeView: TRealICQContacterTreeView;
  15068. Employee: TRealICQEmployee;
  15069. Friend: TRealICQEmployee;
  15070. begin
  15071. Result := '';
  15072. if FSearchListViewInVisible then
  15073. begin
  15074. for iLoop := 0 to FSearchListView.Items.Count - 1 do
  15075. begin
  15076. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15077. if ListItem.Selected then
  15078. begin
  15079. Result := ListItem.LoginName;
  15080. Exit;
  15081. end;
  15082. end;
  15083. end;
  15084. GroupName := GetActiveTabSheetName;
  15085. if GroupName = LVMyContacters then
  15086. begin
  15087. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  15088. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15089. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15090. if Employee <> nil then
  15091. begin
  15092. Result := Employee.LoginName;
  15093. end;
  15094. Exit;
  15095. end;
  15096. if GroupName = LVMoreUsers then
  15097. begin
  15098. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  15099. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15100. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15101. if Employee <> nil then
  15102. begin
  15103. Result := Employee.LoginName;
  15104. end;
  15105. Exit;
  15106. end;
  15107. if GroupName = LVFriends then
  15108. begin
  15109. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  15110. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15111. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  15112. if Friend <> nil then
  15113. begin
  15114. Result := Friend.LoginName;
  15115. end;
  15116. Exit;
  15117. end;
  15118. GroupIndex := FContacterListViews.IndexOf(GroupName);
  15119. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  15120. for iLoop := 0 to ListView.Items.Count - 1 do
  15121. begin
  15122. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15123. if ListItem.Selected then
  15124. begin
  15125. Result := ListItem.LoginName;
  15126. Break;
  15127. end;
  15128. end;
  15129. end;
  15130. //------------------------------------------------------------------------------
  15131. procedure TMainForm.actShowHistoryExecute(Sender: TObject);
  15132. var
  15133. LoginName: string;
  15134. begin
  15135. LoginName := GetSelectedLoginName;
  15136. if LoginName <> '' then
  15137. begin
  15138. OpenMessagesManagerForm;
  15139. Application.ProcessMessages;
  15140. MessagesManagerForm.ShowUsersMessages(LoginName);
  15141. end;
  15142. end;
  15143. //------------------------------------------------------------------------------
  15144. procedure TMainForm.actSeeInformationExecute(Sender: TObject);
  15145. var
  15146. LoginName: string;
  15147. begin
  15148. LoginName := GetSelectedLoginName;
  15149. if LoginName <> '' then
  15150. begin
  15151. SeeUserInformation(LoginName);
  15152. end;
  15153. end;
  15154. //------------------------------------------------------------------------------
  15155. procedure TMainForm.actChangeRemarkExecute(Sender: TObject);
  15156. var
  15157. LoginName: string;
  15158. Remark: string;
  15159. RealICQUser: TRealICQUser;
  15160. begin
  15161. LoginName := GetSelectedLoginName;
  15162. if LoginName <> '' then
  15163. begin
  15164. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  15165. if RealICQUser = nil then
  15166. Exit;
  15167. if (RealICQUser.LoginName = RealICQClient.Me.LoginName) then
  15168. begin
  15169. ShowMessage('不允许修改自己的备注名称!');
  15170. Exit;
  15171. end;
  15172. Remark := RealICQUser.Remark;
  15173. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  15174. if not AnsiSameStr(Remark, RealICQUser.Remark) then
  15175. RealICQClient.ChangeRemark(LoginName, Remark);
  15176. end;
  15177. end;
  15178. //------------------------------------------------------------------------------
  15179. procedure TMainForm.actSendMessageExecute(Sender: TObject);
  15180. var
  15181. LoginName: string;
  15182. begin
  15183. LoginName := GetSelectedLoginName;
  15184. if LoginName <> '' then
  15185. begin
  15186. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  15187. begin
  15188. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  15189. Exit;
  15190. end;
  15191. //----------------------------------------
  15192. {if GetActiveTabSheetName=MoreUser then
  15193. begin
  15194. RealICQClient.GetUserInformation(LoginName,True);
  15195. end;}
  15196. OpenTalkingForm(LoginName);
  15197. end;
  15198. end;
  15199. //------------------------------------------------------------------------------
  15200. procedure TMainForm.actSendTeamMessageExecute(Sender: TObject);
  15201. var
  15202. iLoop: Integer;
  15203. ListItem: TRealICQContacterListItem;
  15204. RealICQTeam: TRealICQTeam;
  15205. begin
  15206. if FLVTeams.SelCount = 1 then
  15207. begin
  15208. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15209. begin
  15210. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15211. if ListItem.Selected then
  15212. begin
  15213. RealICQTeam := ListItem.Data;
  15214. OpenTeamTalkingForm(RealICQTeam.TeamID);
  15215. Break;
  15216. end;
  15217. end;
  15218. end;
  15219. end;
  15220. //------------------------------------------------------------------------------
  15221. procedure TMainForm.actSeeTeamInformationExecute(Sender: TObject);
  15222. var
  15223. iLoop: Integer;
  15224. ListItem: TRealICQContacterListItem;
  15225. RealICQTeam: TRealICQTeam;
  15226. begin
  15227. if FLVTeams.SelCount = 1 then
  15228. begin
  15229. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15230. begin
  15231. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15232. if ListItem.Selected then
  15233. begin
  15234. RealICQTeam := ListItem.Data;
  15235. OpenTeamOptionsForm(RealICQTeam);
  15236. Break;
  15237. end;
  15238. end;
  15239. end;
  15240. end;
  15241. //------------------------------------------------------------------------------
  15242. procedure TMainForm.actQuitTeamExecute(Sender: TObject);
  15243. var
  15244. iLoop: Integer;
  15245. ListItem: TRealICQContacterListItem;
  15246. RealICQTeam: TRealICQTeam;
  15247. begin
  15248. if FLVTeams.SelCount = 1 then
  15249. begin
  15250. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15251. begin
  15252. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15253. if ListItem.Selected then
  15254. begin
  15255. RealICQTeam := ListItem.Data;
  15256. if MessageBox(Handle, '真的要退出该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15257. Exit;
  15258. TTeamsAdapter.QuitTeam(RealICQTeam.TeamID);
  15259. Break;
  15260. end;
  15261. end;
  15262. end;
  15263. end;
  15264. //------------------------------------------------------------------------------
  15265. procedure TMainForm.actDisbandTeamExecute(Sender: TObject);
  15266. var
  15267. iLoop: Integer;
  15268. ListItem: TRealICQContacterListItem;
  15269. RealICQTeam: TRealICQTeam;
  15270. begin
  15271. {if FLVTeams.SelCount = 1 then
  15272. begin
  15273. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15274. begin
  15275. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15276. if ListItem.Selected then
  15277. begin
  15278. RealICQTeam := ListItem.Data;
  15279. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then Exit;
  15280. RealICQClient.DisbandTeam(RealICQTeam.TeamID);
  15281. Break;
  15282. end;
  15283. end;
  15284. end; }
  15285. if FLVTeams.SelCount = 1 then
  15286. begin
  15287. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15288. begin
  15289. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15290. if ListItem.Selected then
  15291. begin
  15292. RealICQTeam := ListItem.Data;
  15293. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15294. Exit;
  15295. TTeamsAdapter.DisbandTeam(RealICQTeam.TeamID);
  15296. Break;
  15297. end;
  15298. end;
  15299. end;
  15300. end;
  15301. //------------------------------------------------------------------------------
  15302. procedure TMainForm.actQuitOrDisbandTeamsExecute(Sender: TObject);
  15303. var
  15304. iLoop: Integer;
  15305. ListItem: TRealICQContacterListItem;
  15306. RealICQTeam: TRealICQTeam;
  15307. begin
  15308. if MessageBox(Handle, '真的要退出 / 解散选中的群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15309. Exit;
  15310. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15311. begin
  15312. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15313. if ListItem.Selected then
  15314. begin
  15315. RealICQTeam := ListItem.Data;
  15316. if AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName) then
  15317. RealICQClient.DisbandTeam(RealICQTeam.TeamID)
  15318. else
  15319. RealICQClient.QuitTeam(RealICQTeam.TeamID);
  15320. end;
  15321. end;
  15322. end;
  15323. //------------------------------------------------------------------------------
  15324. procedure TMainForm.actShowAllNameExecute(Sender: TObject);
  15325. var
  15326. iLoop: Integer;
  15327. RealICQContacterListView: TRealICQContacterListView;
  15328. RealICQContacterTreeView: TRealICQContacterTreeView;
  15329. begin
  15330. for iLoop := 0 to FContacterListViews.Count - 1 do
  15331. begin
  15332. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15333. RealICQContacterListView.CaptionStyle := csDisplayNameAndLoginName;
  15334. end;
  15335. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15336. begin
  15337. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15338. RealICQContacterTreeView.CaptionStyle := csDisplayNameAndLoginName;
  15339. RealICQContacterTreeView.ReDrawAll;
  15340. end;
  15341. FLVCaptionStyle := csDisplayNameAndLoginName;
  15342. SaveStyleConfigs;
  15343. end;
  15344. //------------------------------------------------------------------------------
  15345. procedure TMainForm.actShowBigHeadImageExecute(Sender: TObject);
  15346. var
  15347. iLoop: Integer;
  15348. RealICQContacterListView: TRealICQContacterListView;
  15349. RealICQContacterTreeView: TRealICQContacterTreeView;
  15350. begin
  15351. for iLoop := 0 to FContacterListViews.Count - 1 do
  15352. begin
  15353. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15354. RealICQContacterListView.Style := lsBigHeadImage;
  15355. end;
  15356. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15357. begin
  15358. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15359. RealICQContacterTreeView.Style := lsBigHeadImage;
  15360. RealICQContacterTreeView.ReDrawAll;
  15361. end;
  15362. FLVStyle := lsBigHeadImage;
  15363. SaveStyleConfigs;
  15364. end;
  15365. procedure TMainForm.actShowMiddleHeadImageExecute(Sender: TObject);
  15366. var
  15367. iLoop: Integer;
  15368. RealICQContacterListView: TRealICQContacterListView;
  15369. RealICQContacterTreeView: TRealICQContacterTreeView;
  15370. begin
  15371. for iLoop := 0 to FContacterListViews.Count - 1 do
  15372. begin
  15373. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15374. RealICQContacterListView.Style := lsMiddleHeadImage;
  15375. end;
  15376. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15377. begin
  15378. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15379. RealICQContacterTreeView.Style := lsMiddleHeadImage;
  15380. RealICQContacterTreeView.ReDrawAll;
  15381. end;
  15382. FLVStyle := lsMiddleHeadImage;
  15383. SaveStyleConfigs;
  15384. end;
  15385. //------------------------------------------------------------------------------
  15386. procedure TMainForm.actShowSmallHeadImageExecute(Sender: TObject);
  15387. var
  15388. iLoop: Integer;
  15389. RealICQContacterListView: TRealICQContacterListView;
  15390. RealICQContacterTreeView: TRealICQContacterTreeView;
  15391. begin
  15392. for iLoop := 0 to FContacterListViews.Count - 1 do
  15393. begin
  15394. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15395. RealICQContacterListView.Style := lsSmallHeadImage;
  15396. end;
  15397. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15398. begin
  15399. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15400. RealICQContacterTreeView.Style := lsSmallHeadImage;
  15401. RealICQContacterTreeView.ReDrawAll;
  15402. end;
  15403. FLVStyle := lsSmallHeadImage;
  15404. SaveStyleConfigs;
  15405. end;
  15406. //------------------------------------------------------------------------------
  15407. procedure TMainForm.actShowStrangersExecute(Sender: TObject);
  15408. begin
  15409. // SaveStyleConfigs;
  15410. end;
  15411. //------------------------------------------------------------------------------
  15412. procedure TMainForm.actShowBlacklistsExecute(Sender: TObject);
  15413. begin
  15414. // SaveStyleConfigs;
  15415. end;
  15416. //------------------------------------------------------------------------------
  15417. procedure TMainForm.actShowTeamHistoryExecute(Sender: TObject);
  15418. var
  15419. iLoop: Integer;
  15420. ListItem: TRealICQContacterListItem;
  15421. RealICQTeam: TRealICQTeam;
  15422. begin
  15423. if FLVTeams.SelCount = 1 then
  15424. begin
  15425. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15426. begin
  15427. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15428. if ListItem.Selected then
  15429. begin
  15430. RealICQTeam := ListItem.Data;
  15431. OpenMessagesManagerForm;
  15432. Application.ProcessMessages;
  15433. MessagesManagerForm.ShowTeamsMessages(RealICQTeam.TeamID);
  15434. Break;
  15435. end;
  15436. end;
  15437. end;
  15438. end;
  15439. //------------------------------------------------------------------------------
  15440. procedure TMainForm.actShowTeamsExecute(Sender: TObject);
  15441. begin
  15442. // SaveStyleConfigs;
  15443. end;
  15444. //------------------------------------------------------------------------------
  15445. procedure TMainForm.actShowTreeExecute(Sender: TObject);
  15446. begin
  15447. FShowTree := not FShowTree;
  15448. actShowTree.Checked := FShowTree;
  15449. actShowBigHeadImage.Visible := not actShowTree.Checked;
  15450. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  15451. if FShowTree then
  15452. begin
  15453. if FLVStyle <> lsNoHeadImage then
  15454. begin
  15455. FLVStyle := lsSmallHeadImage;
  15456. actShowSmallHeadImage.Execute;
  15457. end;
  15458. end;
  15459. SaveStyleConfigs;
  15460. ShowGroupInterface;
  15461. end;
  15462. //------------------------------------------------------------------------------
  15463. procedure TMainForm.actShowLatestsExecute(Sender: TObject);
  15464. begin
  15465. //
  15466. end;
  15467. //------------------------------------------------------------------------------
  15468. procedure TMainForm.actAboutExecute(Sender: TObject);
  15469. begin
  15470. AboutForm := TAboutForm.Create(Self);
  15471. try
  15472. AboutForm.ShowModal;
  15473. finally
  15474. FreeAndNil(AboutForm);
  15475. end;
  15476. end;
  15477. //------------------------------------------------------------------------------
  15478. procedure TMainForm.actAlwaysOnTopExecute(Sender: TObject);
  15479. begin
  15480. FAlwaysOnTop := not FAlwaysOnTop;
  15481. // if FAlwaysOnTop then
  15482. // FormStyle := fsStayOnTop
  15483. // else
  15484. FormStyle := fsNormal;
  15485. actAlwaysOnTop.Checked := FAlwaysOnTop;
  15486. SaveDefaultConfigs;
  15487. end;
  15488. //------------------------------------------------------------------------------
  15489. procedure TMainForm.actShowNormalHeadImageExecute(Sender: TObject);
  15490. var
  15491. iLoop: Integer;
  15492. RealICQContacterListView: TRealICQContacterListView;
  15493. RealICQContacterTreeView: TRealICQContacterTreeView;
  15494. begin
  15495. for iLoop := 0 to FContacterListViews.Count - 1 do
  15496. begin
  15497. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15498. RealICQContacterListView.Style := lsNoHeadImage;
  15499. end;
  15500. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15501. begin
  15502. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15503. RealICQContacterTreeView.Style := lsNoHeadImage;
  15504. RealICQContacterTreeView.ReDrawAll;
  15505. end;
  15506. FLVStyle := lsNoHeadImage;
  15507. SaveStyleConfigs;
  15508. end;
  15509. //------------------------------------------------------------------------------
  15510. procedure TMainForm.actShowRemarkExecute(Sender: TObject);
  15511. var
  15512. iLoop, jLoop: Integer;
  15513. RealICQContacterListView: TRealICQContacterListView;
  15514. RealICQContacterTreeView: TRealICQContacterTreeView;
  15515. RealICQContacterListItem: TRealICQContacterListItem;
  15516. RealICQUser: TRealICQUser;
  15517. Employee: TRealICQEmployee;
  15518. begin
  15519. actShowRemark.Checked := not actShowRemark.Checked;
  15520. RealICQClient.ShowRemark := actShowRemark.Checked;
  15521. for iLoop := 0 to FContacterListViews.Count - 1 do
  15522. begin
  15523. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15524. for jLoop := 0 to RealICQContacterListView.Items.Count - 1 do
  15525. begin
  15526. RealICQContacterListItem := RealICQContacterListView.Items.Objects[jLoop] as TRealICQContacterListItem;
  15527. RealICQUser := RealICQContacterListItem.Data;
  15528. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  15529. end;
  15530. end;
  15531. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15532. begin
  15533. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15534. for jLoop := 0 to RealICQContacterTreeView.Count - 1 do
  15535. begin
  15536. Employee := RealICQContacterTreeView.EmployeeItems.Objects[jLoop] as TRealICQEmployee;
  15537. RealICQUser := Employee.Data;
  15538. UpdateEmployeeNode(Employee, RealICQUser, False);
  15539. end;
  15540. RealICQContacterTreeView.ReDrawAll;
  15541. end;
  15542. end;
  15543. //------------------------------------------------------------------------------
  15544. procedure TMainForm.actFindUsersExecute(Sender: TObject);
  15545. begin
  15546. if SearchForm <> nil then
  15547. begin
  15548. SearchForm.BringToFront;
  15549. Exit;
  15550. end;
  15551. SearchForm := TSearchForm.Create(Application);
  15552. SearchForm.Show;
  15553. end;
  15554. procedure TMainForm.actGroupManagerExecute(Sender: TObject);
  15555. begin
  15556. if GroupManagerForm <> nil then
  15557. Exit;
  15558. GroupManagerForm := TGroupManagerForm.Create(Self);
  15559. try
  15560. GroupManagerForm.ShowModal;
  15561. finally
  15562. FreeAndNil(GroupManagerForm);
  15563. end;
  15564. end;
  15565. //------------------------------------------------------------------------------
  15566. procedure TMainForm.OpenMessagesManagerForm;
  15567. begin
  15568. actMsgManagerExecute(nil);
  15569. end;
  15570. //------------------------------------------------------------------------------
  15571. procedure TMainForm.pgcMainWorkAreaTabChanging(Sender: TObject; NewIndex: Integer; var AllowChanged: Boolean);
  15572. var
  15573. TabSheet: TTabSheet;
  15574. WebPanel: TWebPanel;
  15575. Point: TPoint;
  15576. begin
  15577. {if NewIndex = 1 then
  15578. begin
  15579. MainForm.RealICQClient.OnGettedAddrBookGroups:=GettedAddrBookGroups;
  15580. MainForm.RealICQClient.OnManageAddrBookResult:=GettedManageAddrBookResult;
  15581. RealICQClient.SendGetAddrBookGroup;
  15582. end;}
  15583. if NewIndex > 2 then
  15584. begin
  15585. AllowChanged := False;
  15586. //if not DisplayWebs then Exit;
  15587. TabSheet := pgcMainWorkArea.Pages[NewIndex];
  15588. WebPanel := FWebPanels.Objects[TabSheet.Tag] as TWebPanel;
  15589. //if WebPanel.FNavigateType = ntFill then AllowChanged := True;
  15590. if WebPanel.Acounts.Count > 1 then
  15591. begin
  15592. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  15593. begin
  15594. Point.X := Mouse.CursorPos.X;
  15595. Point.Y := Mouse.CursorPos.Y;
  15596. FreeAndNil(SelWebTabAcountsForm);
  15597. SelWebTabAcountsForm := TSelWebTabAcountsForm.Create(Self);
  15598. SelWebTabAcountsForm.WebPanel := WebPanel;
  15599. SelWebTabAcountsForm.TabSheet := TabSheet;
  15600. SelWebTabAcountsForm.Left := Point.X;
  15601. SelWebTabAcountsForm.Top := Point.Y - 20;
  15602. if Left <= SelWebTabAcountsForm.Width then
  15603. SelWebTabAcountsForm.Left := Left + Width
  15604. else
  15605. SelWebTabAcountsForm.Left := Left - SelWebTabAcountsForm.Width;
  15606. if WebPanel.Acounts.Count < 10 then
  15607. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := WebPanel.Acounts.Count * cntHeightOfBigHeadImage + 3
  15608. else
  15609. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := 10 * cntHeightOfBigHeadImage + 3;
  15610. SelWebTabAcountsForm.pnlClient.Constraints.MaxHeight := SelWebTabAcountsForm.pnlClient.Constraints.MinHeight;
  15611. SelWebTabAcountsForm.Show;
  15612. Exit;
  15613. end;
  15614. end;
  15615. WebTabShow(TabSheet);
  15616. end;
  15617. end;
  15618. procedure TMainForm.pgcMainWorkAreaWebPanelButtonClick(Sender: TObject);
  15619. begin
  15620. pgcMainWorkArea.OnWebPanelButtonClick := nil;
  15621. if OptionsForm = nil then
  15622. OptionsForm := TOptionsForm.Create(Self);
  15623. try
  15624. OptionsForm.PageIndex := 10;
  15625. OptionsForm.ShowModal;
  15626. finally
  15627. FreeAndNil(OptionsForm);
  15628. pgcMainWorkArea.OnWebPanelButtonClick := pgcMainWorkAreaWebPanelButtonClick;
  15629. end;
  15630. end;
  15631. procedure TMainForm.pnlToolBarResize(Sender: TObject);
  15632. var
  15633. AvgWidth: Integer;
  15634. iLeft: Integer;
  15635. begin
  15636. AvgWidth := (pnlToolBar.Width - 2) div 5;
  15637. iLeft := 1;
  15638. MyContacters.Left := iLeft;
  15639. MyContacters.Width := AvgWidth;
  15640. MyContactersIcon.Left := iLeft + (AvgWidth - MyContactersIcon.Width) div 2;
  15641. iLeft := iLeft + AvgWidth;
  15642. SysMsg.Left := iLeft;
  15643. SysMsg.Width := AvgWidth;
  15644. SysMsgIcon.Left := iLeft + (AvgWidth - SysMsgIcon.Width) div 2;
  15645. iLeft := iLeft + AvgWidth;
  15646. MyFriend.Left := iLeft;
  15647. MyFriend.Width := AvgWidth;
  15648. MyFriendIcon.Left := iLeft + (AvgWidth - MyFriendIcon.Width) div 2;
  15649. iLeft := iLeft + AvgWidth;
  15650. MyTeam.Left := iLeft;
  15651. MyTeam.Width := AvgWidth;
  15652. MyTeamIcon.Left := iLeft + (AvgWidth - MyTeamIcon.Width) div 2;
  15653. iLeft := iLeft + AvgWidth;
  15654. Latests.Left := iLeft;
  15655. Latests.Width := pnlToolBar.Width - (AvgWidth * 4);
  15656. LatestsIcon.Left := iLeft + (AvgWidth - LatestsIcon.Width) div 2;
  15657. iLeft := iLeft + AvgWidth;
  15658. end;
  15659. procedure TMainForm.pnlWorkAreaClick(Sender: TObject);
  15660. begin
  15661. end;
  15662. {设置WebBrowser的样式}
  15663. //------------------------------------------------------------------------------
  15664. procedure TMainForm.SetDOMStyle(Doc: IHTMLDocument2);
  15665. var
  15666. CurrentColor, CssColor: string;
  15667. begin
  15668. try
  15669. CurrentColor := IntToHex(ConvertColorToColor(FormColor, MainForm.UIMainColor), 6);
  15670. CssColor := '#' + Copy(CurrentColor, 5, 2) + Copy(CurrentColor, 3, 2) + Copy(CurrentColor, 1, 2);
  15671. Doc.body.style.cssText := 'word-break: break-all;';
  15672. Doc.body.style.border := '0px solid';
  15673. Doc.body.style.fontFamily := '宋体';
  15674. Doc.body.style.fontSize := '9pt';
  15675. Doc.body.style.margin := '0pt';
  15676. Doc.body.setAttribute('scroll', 'no', 0);
  15677. Doc.body.style.backgroundColor := CssColor;
  15678. except
  15679. end;
  15680. end;
  15681. //------------------------------------------------------------------------------
  15682. procedure TMainForm.WebBrowserRightStatusTextChange(ASender: TObject; const Text: WideString);
  15683. var
  15684. TabSheet: TTabSheet;
  15685. begin
  15686. try
  15687. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15688. if pgcMultiWeb.ActivePage = TabSheet then
  15689. lblIEStatus.Caption := Text
  15690. else
  15691. lblIEStatus.Caption := '';
  15692. except
  15693. lblIEStatus.Caption := Text
  15694. end;
  15695. end;
  15696. //------------------------------------------------------------------------------
  15697. procedure TMainForm.WebBrowserRightTitleChange(ASender: TObject; const Text: WideString);
  15698. var
  15699. IETitle: WideString;
  15700. TabSheet: TTabSheet;
  15701. begin
  15702. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15703. IETitle := Text;
  15704. //字符串长度过长时,截短字符串并在后面显示“...”
  15705. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) > 138 do
  15706. begin
  15707. if Length(IETitle) > 3 then
  15708. begin
  15709. if Copy(IETitle, Length(IETitle) - 2, Length(IETitle)) = '...' then
  15710. IETitle := Copy(IETitle, 1, Length(IETitle) - 3);
  15711. IETitle := Copy(IETitle, 1, Length(IETitle) - 1) + '...';
  15712. end
  15713. else
  15714. begin
  15715. IETitle := '...';
  15716. end;
  15717. end;
  15718. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) < 88 do
  15719. begin
  15720. IETitle := IETitle + ' ';
  15721. end;
  15722. TabSetMuiltWeb.Tabs.Strings[TabSheet.TabIndex] := IETitle + ' ';
  15723. end;
  15724. //------------------------------------------------------------------------------
  15725. procedure TMainForm.WebBrowserRightWindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
  15726. var
  15727. TabSheet: TTabSheet;
  15728. WebBrowser: TWebBrowser;
  15729. begin
  15730. CoInitialize(nil);
  15731. try
  15732. WebBrowser := ASender as TWebBrowser;
  15733. TabSheet := (WebBrowser.Owner as TPanel).Owner as TTabSheet;
  15734. if pgcMultiWeb.PageCount > 1 then
  15735. begin
  15736. try
  15737. if WebBrowser.Busy then
  15738. WebBrowser.Stop;
  15739. except
  15740. end;
  15741. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  15742. TabSheet.PageControl := nil;
  15743. FreeAndNil(TabSheet);
  15744. end
  15745. else
  15746. begin
  15747. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15748. WebBrowser.Navigate('about:blank');
  15749. end;
  15750. finally
  15751. CoUninitialize;
  15752. Cancel := True;
  15753. end;
  15754. end;
  15755. {procedure TMainForm.WebSocketBroadCastMesssage(var msg: TMessage);
  15756. var
  15757. pdata: PBroadCastMessage;
  15758. RealICQTeamMessage: TRealICQTeamMessage;
  15759. begin
  15760. showmessage(pdata.GroupID);
  15761. RealICQTeamMessage:= TRealICQTeamMessage.Create(pdata.GroupID,pdata.Sayer,{pdata.Style}//'"宋体",9,[],[clBlack]',pdata.Msg,False);
  15762. { RealICQTeamMessage.MessageID := gettickcount();
  15763. RealICQTeamMessage.SendDateTime := pdata.timestamp;
  15764. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15765. end; }
  15766. { TODO -olqq -c : WebSocket群通讯功能 2014/12/12 9:02:40 }
  15767. procedure TMainForm.WebSocketJionTeamRequest(TeamID, ALoginName, ATag: string);
  15768. var
  15769. ATeam: TRealICQTeam;
  15770. ATeamCaption: string;
  15771. begin
  15772. ATeam := TTeamsAdapter.GetTeam(TeamID);
  15773. if ATeam <> nil then
  15774. ATeamCaption := ATeam.TeamCaption;
  15775. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ATeamCaption, TeamID]), nil);
  15776. ShowJoinTeamRequestWindow(Self, TeamID, ATeamCaption, ALoginName, ATag);
  15777. end;
  15778. procedure TMainForm.WebSocketQuitTeam(aTeamID: string);
  15779. var
  15780. iIndex: Integer;
  15781. AlertMessage: string;
  15782. ARealICQTeam: TRealICQTeam;
  15783. AForm: TForm;
  15784. begin
  15785. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15786. if iIndex >= 0 then
  15787. begin
  15788. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15789. if ARealICQTeam = nil then
  15790. Exit;
  15791. FLVTeams.Items.Delete(iIndex);
  15792. if ARealICQTeam.IsTempTeam then
  15793. AlertMessage := '您 退出了 多人对话'
  15794. else
  15795. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  15796. ShowNotifyAlertForm(AlertMessage);
  15797. AddMessageHistory(smSimple, AlertMessage, nil);
  15798. ShowNavBarNumeric;
  15799. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  15800. AForm := GetTeamTalkingForm(aTeamID);
  15801. FreeAndNil(AForm);
  15802. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  15803. UpdateTeamTalkingForm(ARealICQTeam);
  15804. end;
  15805. end;
  15806. procedure TMainForm.WebSocketRecivedbroadcastmesssage(aID, aGroupID, aSayer, aStyle, aMsg: string; aTimesTamp: TDateTime);
  15807. var
  15808. RealICQTeamMessage: TRealICQTeamMessage;
  15809. aDateTime: TDateTime;
  15810. begin
  15811. RealICQTeamMessage := TRealICQTeamMessage.Create(aGroupID, aSayer, aStyle{'"宋体",9,[],[clBlack]'}, aMsg, False);
  15812. RealICQTeamMessage.MessageID := gettickcount();
  15813. RealICQTeamMessage.SendDateTime := aTimesTamp;
  15814. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15815. end;
  15816. procedure TMainForm.WebSocketRemoveTeamResponse(aTeamID: string);
  15817. var
  15818. iIndex: Integer;
  15819. AlertMessage: string;
  15820. RealICQUser: TRealICQUser;
  15821. ARealICQTeam: TRealICQTeam;
  15822. AForm: TForm;
  15823. begin
  15824. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15825. if iIndex >= 0 then
  15826. begin
  15827. FLVTeams.Items.Delete(iIndex);
  15828. FLVTeams.ReDrawAll;
  15829. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15830. if ARealICQTeam = nil then
  15831. Exit;
  15832. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  15833. if RealICQUser = RealICQClient.Me then
  15834. AlertMessage := '您'
  15835. else if RealICQUser.DisplayName = '' then
  15836. AlertMessage := RealICQUser.LoginName
  15837. else
  15838. AlertMessage := RealICQUser.DisplayName;
  15839. if ARealICQTeam.IsTempTeam then
  15840. AlertMessage := AlertMessage + ' 解散了 多人对话'
  15841. else
  15842. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  15843. ShowNotifyAlertForm(AlertMessage);
  15844. AddMessageHistory(smSimple, AlertMessage, nil);
  15845. ShowNavBarNumeric;
  15846. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  15847. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  15848. AForm := GetTeamTalkingForm(aTeamID);
  15849. FreeAndNil(AForm);
  15850. end;
  15851. end;
  15852. procedure TMainForm.WebSocketSendReadTeamInfo(aTeamID: string);
  15853. var
  15854. iLoop, iIndex: Integer;
  15855. ListItem: TRealICQContacterListItem;
  15856. MemberList: TStringList;
  15857. ARealICQTeam: TRealICQTeam;
  15858. begin
  15859. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15860. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  15861. if iIndex = -1 then
  15862. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  15863. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  15864. if ARealICQTeam.IsTempTeam then
  15865. ListItem.Watchword := ''
  15866. else
  15867. ListItem.Watchword := ARealICQTeam.TeamIntro;
  15868. ListItem.LoginState := stLeave;
  15869. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  15870. try
  15871. for iLoop := MemberList.Count - 1 downto 0 do
  15872. begin
  15873. if Length(Trim(MemberList[iLoop])) = 0 then
  15874. MemberList.Delete(iLoop);
  15875. end;
  15876. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  15877. finally
  15878. MemberList.Free;
  15879. end;
  15880. {try
  15881. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  15882. except
  15883. ListItem.HeadImagePicture.Graphic := nil;
  15884. end; }
  15885. if ARealICQTeam.IsTempTeam then
  15886. ListItem.DisplayName := '多人对话'
  15887. else
  15888. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  15889. ListItem.Data := ARealICQTeam;
  15890. ListItem.ReDrawItem;
  15891. ShowNavBarNumeric;
  15892. UpdateTeamOptionsForm(ARealICQTeam);
  15893. UpdateTeamTalkingForm(ARealICQTeam);
  15894. end;
  15895. { TODO -olqq -c : EndWebsocket 2014/12/12 9:05:23 }
  15896. //------------------------------------------------------------------------------
  15897. procedure TMainForm.WebBrowserRightNewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
  15898. var
  15899. WebBrowser1, WebBrowser: TWebBrowser;
  15900. begin
  15901. CoInitialize(nil);
  15902. try
  15903. try
  15904. WebBrowser1 := ASender as TWebBrowser;
  15905. if WebBrowser1.Busy then
  15906. begin
  15907. Cancel := True;
  15908. Exit;
  15909. end;
  15910. WebBrowser := AddWebBrowserToPageControl('about:blank', -3);
  15911. if WebBrowser = nil then
  15912. begin
  15913. Cancel := True;
  15914. Exit;
  15915. end;
  15916. try
  15917. if (WebBrowser.Busy) then
  15918. WebBrowser.Stop;
  15919. except
  15920. end;
  15921. ppDisp := WebBrowser.ControlInterface;
  15922. except
  15923. Cancel := True;
  15924. end;
  15925. finally
  15926. CoUninitialize;
  15927. end;
  15928. end;
  15929. //------------------------------------------------------------------------------
  15930. function TMainForm.AddWebBrowserToPageControl(AUrl: string; WebPanelTag: Integer = -1): TWebBrowser;
  15931. var
  15932. TabSheet: TTabSheet;
  15933. PanelForIE: TPanel;
  15934. WebBrowser: TWebBrowser;
  15935. begin
  15936. if (WebPanelTag = -1) or (WebPanelTag = -3) or (pgcMultiWeb.PageCount <= 0) then
  15937. begin
  15938. TabSheet := TTabSheet.Create(pgcMultiWeb);
  15939. try
  15940. TabSheet.Parent := pgcMultiWeb;
  15941. TabSheet.PageControl := pgcMultiWeb;
  15942. TabSheet.DoubleBuffered := True;
  15943. PanelForIE := TPanel.Create(TabSheet);
  15944. PanelForIE.Parent := TabSheet;
  15945. PanelForIE.DoubleBuffered := True;
  15946. PanelForIE.Color := clWhite;
  15947. PanelForIE.Align := alClient;
  15948. PanelForIE.BevelInner := bvNone;
  15949. PanelForIE.BevelOuter := bvNone;
  15950. PanelForIE.Visible := True;
  15951. PanelForIE.Padding.Left := 2;
  15952. PanelForIE.Padding.Top := 2;
  15953. PanelForIE.Padding.Right := 2;
  15954. PanelForIE.Padding.Bottom := 2;
  15955. WebBrowser := TWebBrowser.Create(PanelForIE);
  15956. WebBrowser.DoubleBuffered := True;
  15957. WebBrowser.ParentWindow := PanelForIE.Handle;
  15958. WebBrowser.Align := alClient;
  15959. WebBrowser.OnStatusTextChange := WebBrowserRightStatusTextChange;
  15960. WebBrowser.OnTitleChange := WebBrowserRightTitleChange;
  15961. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15962. WebBrowser.OnNewWindow2 := WebBrowserRightNewWindow2;
  15963. WebBrowser.OnWindowClosing := WebBrowserRightWindowClosing;
  15964. WebBrowser.Tag := WebPanelTag;
  15965. PanelForIE.InsertControl(WebBrowser);
  15966. except
  15967. TabSheet.PageControl := nil;
  15968. FreeAndNil(TabSheet);
  15969. Result := nil;
  15970. Exit;
  15971. end;
  15972. TabSetMuiltWeb.Tabs.Add(AUrl + ' ');
  15973. try
  15974. TabSetMuiltWeb.TabIndex := TabSetMuiltWeb.Tabs.Count - 1;
  15975. except
  15976. end;
  15977. pgcMultiWeb.ActivePageIndex := pgcMultiWeb.PageCount - 1;
  15978. end
  15979. else
  15980. begin
  15981. TabSheet := pgcMultiWeb.Pages[0];
  15982. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  15983. WebBrowser.Tag := WebPanelTag;
  15984. TabSetMuiltWeb.Tabs.Strings[0] := (AUrl + ' ');
  15985. TabSetMuiltWeb.TabIndex := 0;
  15986. pgcMultiWeb.ActivePageIndex := 0;
  15987. end;
  15988. {
  15989. if not pnlMiddleRight.Visible then
  15990. begin
  15991. if RealICQClient.Logined and RealICQClient.Connected then
  15992. begin
  15993. ShowOrHideMuiltiWeb;
  15994. end;
  15995. end;
  15996. try
  15997. if (WebBrowser.Busy) then WebBrowser.Stop;
  15998. except
  15999. end;
  16000. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16001. //if not ((WebPanelTag = -3) and AnsiSameText(AUrl, 'about:blank')) then
  16002. try
  16003. WebBrowser.Navigate(AUrl);
  16004. except
  16005. end;
  16006. Result := WebBrowser;
  16007. }
  16008. end;
  16009. //------------------------------------------------------------------------------
  16010. {
  16011. procedure TMainForm.WebTabShow(Sender: TObject);
  16012. var
  16013. iIndex: Integer;
  16014. TabSheet: TTabSheet;
  16015. WebPanel: TWebPanel;
  16016. WebURL: String;
  16017. begin
  16018. TabSheet := Sender as TTabSheet;
  16019. //TabSheet.OnShow := nil;
  16020. iIndex := FWebTabs.IndexOf(TabSheet);
  16021. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16022. while TabSheet.ControlCount > 0 do
  16023. begin
  16024. TabSheet.Controls[0].Free;
  16025. //TabSheet.RemoveControl(TabSheet.Controls[0]);
  16026. end;
  16027. if WebPanel.NavigateType = ntGET then
  16028. begin
  16029. WebURL := WebPanel.URL;
  16030. if WebPanel.UserIMLoginName then
  16031. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', RealICQClient.LoginName)
  16032. else
  16033. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebPanel.CustomLoginName);
  16034. if WebPanel.UserIMPassword then
  16035. WebURL := AnsiReplaceText(WebURL, '[%Password%]', RealICQClient.Password)
  16036. else
  16037. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebPanel.CustomPassword);
  16038. AddWebBrowserToPageControl(WebUrl, iIndex);
  16039. end
  16040. else
  16041. AddWebBrowserToPageControl('about:blank', iIndex);
  16042. end;
  16043. }
  16044. //------------------------------------------------------------------------------
  16045. //新Post方式
  16046. procedure TMainForm.WebBrowserRightDocumentCompleteForPost(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16047. var
  16048. WebBrowser: TWebBrowser;
  16049. WebPanel: TWebPanel;
  16050. WebTabAcount: TWebTabAcount;
  16051. FieldName, ALoginName, FieldValue: string;
  16052. PostFields, Field: TStringList;
  16053. iLoop, jLoop, kLoop: Integer;
  16054. WebItem: Olevariant;
  16055. WebItemChild: Olevariant;
  16056. WebItemForm: Olevariant;
  16057. AFindedForm: Boolean;
  16058. ASubmitID: string;
  16059. begin
  16060. WebBrowser := ASender as TWebBrowser;
  16061. WebBrowser.OnDocumentComplete := nil;
  16062. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16063. if WebPanel.Acounts.Count > 0 then
  16064. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16065. else
  16066. WebTabAcount := nil;
  16067. ASubmitID := '';
  16068. ;
  16069. AFindedForm := False;
  16070. PostFields := SplitString(WebPanel.PostFields, ',');
  16071. try
  16072. for kLoop := 0 to PostFields.Count - 1 do
  16073. begin
  16074. Field := SplitStringEx(PostFields.Strings[kLoop], '=');
  16075. try
  16076. try
  16077. FieldName := Field.Strings[0];
  16078. FieldValue := Field.Strings[1];
  16079. if FieldName = 'LXTALK_SUBMIT_BTN' then
  16080. ASubmitID := FieldValue;
  16081. if WebTabAcount <> nil then
  16082. begin
  16083. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16084. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16085. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16086. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16087. end;
  16088. WebBrowser.OleObject.Document.getElementByID(FieldName).value := FieldValue;
  16089. //找到Form
  16090. if not AFindedForm then
  16091. begin
  16092. WebItem := WebBrowser.Document;
  16093. for iLoop := 0 to WebItem.Forms.length - 1 do
  16094. begin
  16095. //ShowMessage(WebItem.Forms.Item(iLoop, 0).name);
  16096. WebItemChild := WebItem.Forms.Item(iLoop, 0);
  16097. for jLoop := 0 to WebItemChild.all.length - 1 do
  16098. begin
  16099. if AnsiSameText(WebItemChild.all.item(jLoop).tagName, 'INPUT') then
  16100. begin
  16101. if AnsiSameText(WebItemChild.all.item(jLoop).name, FieldName) then
  16102. begin
  16103. AFindedForm := True;
  16104. WebItemForm := WebItemChild;
  16105. Break;
  16106. end;
  16107. //ShowMessage(WebItemChild.all.item(jLoop).tagName);
  16108. //ShowMessage(WebItemChild.all.item(jLoop).type);
  16109. //ShowMessage(WebItemChild.all.item(jLoop).name);
  16110. end;
  16111. end; //for
  16112. end; //for
  16113. end; //if
  16114. except
  16115. end;
  16116. finally
  16117. Field.Free;
  16118. end;
  16119. end;
  16120. finally
  16121. PostFields.Free;
  16122. end;
  16123. //ShowMessage(WebItemForm.Action);
  16124. //Exit;
  16125. WebItemForm.target := '_blank';
  16126. //Exit;
  16127. if ASubmitID <> '' then
  16128. begin
  16129. for jLoop := 0 to WebItemForm.all.length - 1 do
  16130. begin
  16131. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16132. begin
  16133. if AnsiSameText(WebItemForm.all.item(jLoop).name, ASubmitID) then
  16134. begin
  16135. WebItemForm.all.item(jLoop).click;
  16136. end;
  16137. end;
  16138. end;
  16139. end
  16140. else
  16141. begin
  16142. for jLoop := 0 to WebItemForm.all.length - 1 do
  16143. begin
  16144. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16145. begin
  16146. if AnsiSameText(WebItemForm.all.item(jLoop).type, 'submit') then
  16147. begin
  16148. WebItemForm.all.item(jLoop).click;
  16149. end;
  16150. end;
  16151. end;
  16152. end;
  16153. Application.ProcessMessages;
  16154. Sleep(100);
  16155. Application.ProcessMessages;
  16156. //FreeAndNil(WebBrowser);
  16157. end;
  16158. //------------------------------------------------------------------------------
  16159. //Get方式加旧版本Post方式
  16160. procedure TMainForm.WebBrowserRightDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16161. var
  16162. PanelForIE: TPanel;
  16163. WebBrowser: TWebBrowser;
  16164. WebPanel: TWebPanel;
  16165. v: Variant;
  16166. parameters: string;
  16167. OldTag, iLoop: Integer;
  16168. PostFields, Field: TStringList;
  16169. WebURL, FieldName, ALoginName, FieldValue: string;
  16170. WebTabAcount: TWebTabAcount;
  16171. SetTagAsZero: Boolean;
  16172. begin
  16173. WebBrowser := ASender as TWebBrowser;
  16174. OldTag := WebBrowser.Tag;
  16175. SetTagAsZero := True;
  16176. PanelForIE := WebBrowser.Owner as TPanel;
  16177. try
  16178. if (not PanelForIE.Visible) and (not AnsiSameText(URL, 'about:blank')) then
  16179. begin
  16180. //PanelForIE.Visible := True;
  16181. WebBrowser.OnDocumentComplete := nil;
  16182. WebBrowser.Navigate('about:blank');
  16183. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar(String(URL)),'',SW_SHOWMAXIMIZED);
  16184. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(URL)), '', SW_SHOWMAXIMIZED);
  16185. Exit;
  16186. end;
  16187. {if not AnsiSameText(URL, 'about:blank') then
  16188. begin
  16189. WebBrowser.OnDocumentComplete := nil;
  16190. with cbxURLInputer.ItemsEx.Add do
  16191. begin
  16192. Caption := URL;
  16193. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  16194. ImageIndex := 2
  16195. else if Copy(Caption, 1, 4) = 'ftp:' then
  16196. ImageIndex := 1
  16197. else
  16198. ImageIndex := 0;
  16199. end;
  16200. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  16201. if WebBrowser.Document <> nil then
  16202. begin
  16203. (WebBrowser.Application as IOleobject).DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser, 0, Handle, GetClientRect);
  16204. end;
  16205. end;}
  16206. if AnsiSameText(URL, 'about:blank') and (WebBrowser.Tag >= 0) and (TabAcountIndex >= 0) then
  16207. begin
  16208. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16209. if WebPanel.Acounts.Count > 0 then
  16210. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16211. else
  16212. WebTabAcount := nil;
  16213. WebBrowser.Tag := -1;
  16214. WebURL := WebPanel.URL;
  16215. if WebPanel.FName = '网络存储' then
  16216. begin
  16217. OpenNewWorkDisk(WebPanel.FURL);
  16218. Exit;
  16219. end;
  16220. if WebPanel.FNavigateType = ntGET then
  16221. begin
  16222. if Length(Trim(WebPanel.PostFields)) > 0 then
  16223. begin
  16224. if Pos('?', WebPanel.URL) > 0 then
  16225. WebURL := WebPanel.URL + '&' + ReplaceStr(WebPanel.PostFields, ',', '&')
  16226. else
  16227. WebURL := WebPanel.URL + '?' + ReplaceStr(WebPanel.PostFields, ',', '&');
  16228. end;
  16229. if WebTabAcount <> nil then
  16230. begin
  16231. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebTabAcount.LoginName);
  16232. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebTabAcount.Password);
  16233. WebURL := AnsiReplaceText(WebURL, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16234. WebURL := AnsiReplaceText(WebURL, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16235. WebURL := AnsiReplaceText(WebURL, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16236. WebURL := AnsiReplaceText(WebURL, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16237. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16238. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16239. end;
  16240. parameters := ALoginName + ' ' + RealICQClient.Password;
  16241. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(Trim(WebURL))), PChar(parameters), SW_SHOWMAXIMIZED);
  16242. end
  16243. else
  16244. begin
  16245. v := VarArrayCreate([0, 0], varVariant);
  16246. v[0] := '<body>' + '<form method="post" action="' + WebURL + '" target="_blank">';
  16247. PostFields := SplitString(WebPanel.PostFields, ',');
  16248. for iLoop := 0 to PostFields.Count - 1 do
  16249. begin
  16250. Field := SplitStringEx(PostFields.Strings[iLoop], '=');
  16251. try
  16252. FieldName := Field.Strings[0];
  16253. FieldValue := Field.Strings[1];
  16254. if WebTabAcount <> nil then
  16255. begin
  16256. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16257. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16258. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16259. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16260. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16261. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16262. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16263. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16264. end;
  16265. v[0] := v[0] + '<input type="hidden" ' + 'name="' + FieldName + '" ' + 'value="' + FieldValue + '">';
  16266. except
  16267. end;
  16268. Field.Free;
  16269. end;
  16270. PostFields.Free;
  16271. v[0] := v[0] + '</form>' + '</body>';
  16272. (WebBrowser.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16273. WebBrowser.oleobject.document.Forms.Item(0, 0).Submit;
  16274. end;
  16275. end;
  16276. finally
  16277. ClearMemory;
  16278. if SetTagAsZero then
  16279. WebBrowser.Tag := -1;
  16280. //pgcMainWorkArea.ActivePageIndex := 0;
  16281. end;
  16282. end;
  16283. procedure TMainForm.WebBrowserForPostWorkOrderDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16284. begin
  16285. //
  16286. { if URL='about:blank' then
  16287. begin
  16288. v := VarArrayCreate([0, 0], varVariant);
  16289. v[0] := '<body>' +
  16290. '<form method="post" action="' + WebURL + '" target="_blank">';
  16291. v[0] := v[0] +
  16292. '<input type="hidden" ' +
  16293. 'name="' + FieldName +'" ' +
  16294. 'value="'+ FieldValue + '">';
  16295. v[0] := v[0] +
  16296. '</form>' +
  16297. '</body>';
  16298. (WebBrowserForPostWorkOrder.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16299. WebBrowserForPostWorkOrder.oleobject.document.Forms.Item(0, 0).Submit;
  16300. end; }
  16301. end;
  16302. procedure TMainForm.UploadWebTabAccounts;
  16303. var
  16304. iLoop, jLoop: Integer;
  16305. WebPanel: TWebPanel;
  16306. StrTemp: string;
  16307. WebTabAcount: TWebTabAcount;
  16308. begin
  16309. StrTemp := '';
  16310. for iLoop := 0 to WebPanels.Count - 1 do
  16311. begin
  16312. WebPanel := WebPanels.Objects[iLoop] as TWebPanel;
  16313. for jLoop := 0 to WebPanel.Acounts.Count - 1 do
  16314. begin
  16315. WebTabAcount := WebPanel.Acounts[jLoop];
  16316. 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);
  16317. end;
  16318. end;
  16319. MainForm.RealICQClient.CallServerDBProcedure('SetWebTabAcounts', StrTemp);
  16320. end;
  16321. //------------------------------------------------------------------------------
  16322. procedure TMainForm.WebTabShow(Sender: TObject);
  16323. var
  16324. iIndex: Integer;
  16325. TabSheet: TTabSheet;
  16326. WebPanel: TWebPanel;
  16327. WebTabAcount: TWebTabAcount;
  16328. iLoop: Integer;
  16329. begin
  16330. if not DisplayWebs then
  16331. Exit;
  16332. TabSheet := Sender as TTabSheet;
  16333. //TabSheet.OnShow := nil;
  16334. iIndex := FWebTabs.IndexOf(TabSheet);
  16335. iIndex := TabSheet.Tag;
  16336. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16337. TabAcountIndex := 0;
  16338. if WebPanel.Acounts.Count = 0 then
  16339. begin
  16340. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  16341. begin
  16342. AddWebTabForm := TAddWebTabForm.Create(Self);
  16343. try
  16344. AddWebTabForm.NewWebPanel := True;
  16345. AddWebTabForm.Left := Mouse.CursorPos.X;
  16346. AddWebTabForm.Top := Mouse.CursorPos.Y - 20;
  16347. if Left <= AddWebTabForm.Width then
  16348. AddWebTabForm.Left := Left + Width - 10
  16349. else
  16350. AddWebTabForm.Left := Left - AddWebTabForm.Width + 10;
  16351. if (AddWebTabForm.Top + AddWebTabForm.Height) > Screen.Height then
  16352. AddWebTabForm.Top := Screen.Height - AddWebTabForm.Height;
  16353. if AddWebTabForm.ShowModal = mrOK then
  16354. begin
  16355. WebTabAcount := TWebTabAcount.Create;
  16356. WebTabAcount.WebTabID := StrToInt(WebPanel.ID);
  16357. WebTabAcount.Title := Trim(AddWebTabForm.edTitle.Text);
  16358. WebTabAcount.LoginName := AddWebTabForm.ALoginName;
  16359. WebTabAcount.Password := AddWebTabForm.APassword;
  16360. WebTabAcount.Explain := Trim(AddWebTabForm.edExplain.Text);
  16361. WebPanel.Acounts.Add(WebTabAcount);
  16362. UploadWebTabAccounts;
  16363. end
  16364. else
  16365. begin
  16366. TabAcountIndex := -1;
  16367. end;
  16368. finally
  16369. FreeAndNil(AddWebTabForm);
  16370. end;
  16371. end;
  16372. end;
  16373. OpenWebTab(TabSheet, WebPanel, TabAcountIndex);
  16374. end;
  16375. //------------------------------------------------------------------------------
  16376. procedure TMainForm.ShowOrHideMuiltiWeb;
  16377. var
  16378. OldWidth: Integer;
  16379. begin
  16380. LockWindowUpdate(GetDesktopWindow);
  16381. OldWidth := pnlMiddleClient.Width;
  16382. try
  16383. //if not pnlMiddleRight.Visible then pnlMiddleRight.Width := 680;
  16384. pnlMiddleRight.Visible := not pnlMiddleRight.Visible;
  16385. Spl.Visible := pnlMiddleRight.Visible;
  16386. if not pnlMiddleRight.Visible then
  16387. begin
  16388. Width := Width - pnlMiddleRight.Width - Spl.Width;
  16389. Spl.Align := alRight;
  16390. pnlMiddleClient.Align := alClient;
  16391. pnlMiddleRight.Align := alRight;
  16392. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  16393. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  16394. end
  16395. else
  16396. begin
  16397. // Width := Width + pnlMiddleRight.Width + Spl.Width;
  16398. Top := Screen.Height div 2 - 290;
  16399. Left := Screen.Width div 2 - 440;
  16400. Width := 880;
  16401. Height := 580;
  16402. Spl.Align := alLeft;
  16403. pnlMiddleClient.Align := alLeft;
  16404. pnlMiddleRight.Align := alClient;
  16405. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth + pnlMiddleRight.Constraints.MinWidth + Spl.Width;
  16406. pnlAll.Constraints.MaxWidth := 0;
  16407. pnlMiddleClient.Left := 0;
  16408. spl.Left := pnlMiddleClient.Left + pnlMiddleClient.Width + 1;
  16409. end;
  16410. finally
  16411. pnlMiddleClient.Width := OldWidth;
  16412. LockWindowUpdate(0);
  16413. end;
  16414. end;
  16415. //------------------------------------------------------------------------------
  16416. procedure TMainForm.actMsgManagerExecute(Sender: TObject);
  16417. begin
  16418. if MessagesManagerForm <> nil then
  16419. begin
  16420. MessagesManagerForm.BringToFront;
  16421. Exit;
  16422. end;
  16423. MessagesManagerForm := TMessagesManagerForm.Create(Application);
  16424. MessagesManagerForm.Width := Round(Screen.WorkAreaWidth * 0.95);
  16425. MessagesManagerForm.Height := Round(Screen.WorkAreaHeight * 0.95);
  16426. MessagesManagerForm.Show;
  16427. end;
  16428. //------------------------------------------------------------------------------
  16429. procedure TMainForm.RealICQClientAddedBlacklists(Sender: TObject; ALoginName: string);
  16430. var
  16431. ItemIndex: Integer;
  16432. RealICQUser: TRealICQUser;
  16433. RealICQContacterListView: TRealICQContacterListView;
  16434. RealICQContacterListItem: TRealICQContacterListItem;
  16435. begin
  16436. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  16437. if RealICQContacterListView.Items.IndexOf(ALoginName) = -1 then
  16438. begin
  16439. ItemIndex := RealICQClient.Blacklists.IndexOf(ALoginName);
  16440. RealICQUser := RealICQClient.Blacklists.Objects[ItemIndex] as TRealICQUser;
  16441. RealICQContacterListView := GetListViewByLoginName(RealICQUser.LoginName);
  16442. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  16443. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  16444. BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  16445. end;
  16446. end;
  16447. procedure TMainForm.RealICQClientAddFriendRequest(Sender: TObject; ALoginName, ATag: string);
  16448. begin
  16449. AddMessageHistory(smSimple, ALoginName + ' 请求加您为好友', nil);
  16450. ShowAddFriendRequestWindow(Self, ALoginName, ATag);
  16451. end;
  16452. procedure TMainForm.RealICQClientAddFriendResponse(Sender: TObject; ALoginName, ATag: string; AAcceptted: Boolean);
  16453. var
  16454. RealICQUser: TRealICQUser;
  16455. itemIndex: Integer;
  16456. begin
  16457. if AAcceptted then
  16458. begin
  16459. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  16460. AddMessageHistory(smSimple, '您已将 ' + ALoginName + ' 添加至好友列表', nil);
  16461. FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  16462. //显示好友
  16463. // ShowGroupInterface;
  16464. ShowNotifyAlertForm('已将 ' + ALoginName + ' 添加至好友列表');
  16465. end
  16466. else
  16467. begin
  16468. if Length(ATag) = 0 then
  16469. ATag := '无';
  16470. AddMessageHistory(smSimple, ALoginName + ' 拒绝了您添加好友的请求', nil);
  16471. ShowNotifyAlertForm(ALoginName + ' 拒绝添加好友的请求' + #$D#$A + '附言:' + ATag);
  16472. end;
  16473. end;
  16474. //------------------------------------------------------------------------------
  16475. procedure TMainForm.actOpenMainFormExecute(Sender: TObject);
  16476. begin
  16477. //if FHidden then ZoomEffect(Self, zaMaximize);
  16478. Show;
  16479. ShowWindow(Handle, SW_SHOW);
  16480. ForceForeGroundWindow(Handle);
  16481. FHidden := False;
  16482. if FMainFormHidden then
  16483. begin
  16484. FDblClickedTrayIcon := True;
  16485. TimerForShowMainForm.Enabled := False;
  16486. //TimerForShowMainForm.Enabled := True;
  16487. SetForegroundWindow(TrueHiddenMainForm.Handle);
  16488. ShowMainForm;
  16489. end
  16490. else
  16491. HideMainForm;
  16492. end;
  16493. //------------------------------------------------------------------------------
  16494. procedure TMainForm.actOpenRecvFileDirExecute(Sender: TObject);
  16495. begin
  16496. ShellExecute(handle, 'open', PChar('"' + RecvFileDir + '"'), '', '', SW_SHOWNORMAL);
  16497. end;
  16498. //------------------------------------------------------------------------------
  16499. procedure TMainForm.actOptionsExecute(Sender: TObject);
  16500. begin
  16501. if OptionsForm <> nil then
  16502. Exit;
  16503. OptionsForm := TOptionsForm.Create(Self);
  16504. try
  16505. OptionsForm.ShowModal;
  16506. finally
  16507. FreeAndNil(OptionsForm);
  16508. end;
  16509. end;
  16510. //------------------------------------------------------------------------------
  16511. procedure TMainForm.actPersonalSetExecute(Sender: TObject);
  16512. var
  16513. AForm: IUIForm;
  16514. begin
  16515. {$IFDEF NXQST}
  16516. AForm := TViewManager.Current.GetView('TSettingViewForm');
  16517. AForm.SetFormInfo('{"center":true, "unsizeable":true}');
  16518. AForm.Show;
  16519. {$ELSE}
  16520. if OptionsForm <> nil then
  16521. Exit;
  16522. OptionsForm := TOptionsForm.Create(Self);
  16523. try
  16524. OptionsForm.PageIndex := 0;
  16525. OptionsForm.ShowModal;
  16526. finally
  16527. FreeAndNil(OptionsForm);
  16528. end;
  16529. {$ENDIF}
  16530. end;
  16531. procedure TMainForm.actQuitExecute(Sender: TObject);
  16532. var
  16533. iWaitTimes: Integer;
  16534. begin
  16535. if RealICQClient.Connected then
  16536. begin
  16537. if GetTalkingFormCount > 0 then
  16538. begin
  16539. if MessageBox(Handle, '确实要退出吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  16540. Exit;
  16541. if Showing then
  16542. Close;
  16543. CloseAllTalkingForm;
  16544. iWaitTimes := 0;
  16545. while GetTalkingFormCount > 0 do
  16546. begin
  16547. Sleep(100);
  16548. Inc(iWaitTimes);
  16549. if iWaitTimes > 100 then
  16550. Break;
  16551. Application.ProcessMessages;
  16552. end;
  16553. end;
  16554. RealICQClient.Logout;
  16555. TTeamsAdapter.Stop;
  16556. end;
  16557. if Showing then
  16558. Close;
  16559. MainForm.OnClose := nil;
  16560. MainForm.Close;
  16561. TrueHiddenMainForm.Close;
  16562. end;
  16563. //------------------------------------------------------------------------------
  16564. procedure TMainForm.actConnectSetExecute(Sender: TObject);
  16565. begin
  16566. if OptionsForm <> nil then
  16567. Exit;
  16568. OptionsForm := TOptionsForm.Create(Self);
  16569. try
  16570. OptionsForm.PageIndex := 6;
  16571. OptionsForm.ShowModal;
  16572. finally
  16573. FreeAndNil(OptionsForm);
  16574. end;
  16575. end;
  16576. //------------------------------------------------------------------------------
  16577. procedure TMainForm.actCreateTeamExecute(Sender: TObject);
  16578. //var
  16579. // iLoop: Integer;
  16580. // Team: TRealICQTeam;
  16581. begin
  16582. // for iLoop := 0 to RealICQClient.Teams.Count - 1 do
  16583. // begin
  16584. // Team := RealICQClient.Teams.Objects[iLoop] as TRealICQTeam;
  16585. // if (not Team.IsTempTeam) and AnsiSameText(Team.TeamCreater, RealICQClient.LoginName) then
  16586. // begin
  16587. // MessageBox(Handle, '抱歉,您已经创建了一个群组了!', '提示', MB_ICONINFORMATION);
  16588. // Exit;
  16589. // end;
  16590. // end;
  16591. //if CreateTeamForm = nil then CreateTeamForm := TCreateTeamForm.Create(Self);
  16592. //CreateTeamForm.Show;
  16593. try
  16594. CreateTeamForm := TCreateTeamForm.Create(Self);
  16595. try
  16596. CreateTeamForm.ShowModal;
  16597. finally
  16598. FreeAndNil(CreateTeamForm);
  16599. end;
  16600. except
  16601. end;
  16602. end;
  16603. //------------------------------------------------------------------------------
  16604. procedure TMainForm.actCustomFacesManagerExecute(Sender: TObject);
  16605. begin
  16606. if CustomFacesManagerForm = nil then
  16607. CustomFacesManagerForm := TCustomFacesManagerForm.Create(Application);
  16608. CustomFacesManagerForm.Show;
  16609. end;
  16610. //------------------------------------------------------------------------------
  16611. procedure TMainForm.actAVSetExecute(Sender: TObject);
  16612. begin
  16613. WinExec(PChar('"' + ExtractFilePath(Application.ExeName) + AVSetExeFile + '" "' + ExtractFilePath(Application.ExeName) + 'Languages\' + MainForm.Language + '.ini' + '"'), SW_SHOWNORMAL);
  16614. end;
  16615. //------------------------------------------------------------------------------
  16616. procedure TMainForm.actChangePassExecute(Sender: TObject);
  16617. begin
  16618. if ChangePassForm <> nil then
  16619. Exit;
  16620. ChangePassForm := TChangePassForm.Create(Self);
  16621. try
  16622. ChangePassForm.ShowModal;
  16623. finally
  16624. FreeAndNil(ChangePassForm);
  16625. end;
  16626. end;
  16627. //------------------------------------------------------------------------------
  16628. procedure TMainForm.actCloseExecute(Sender: TObject);
  16629. begin
  16630. Close;
  16631. end;
  16632. //--------------------------------------------------------------
  16633. procedure ClearFileMissions;
  16634. var
  16635. iLoop, jLoop: Integer;
  16636. UploadMission: TUploadMission;
  16637. DownloadMission: TDownloadMission;
  16638. Missions: TStringList;
  16639. begin
  16640. for iLoop := FUploadMissions.Count - 1 downto 0 do
  16641. begin
  16642. UploadMission := FUploadMissions.Objects[iLoop] as TUploadMission;
  16643. try
  16644. FreeAndNil(UploadMission);
  16645. except
  16646. end;
  16647. end;
  16648. FUploadMissions.Clear;
  16649. for iLoop := FSavedUploadMissions.Count - 1 downto 0 do
  16650. begin
  16651. Missions := TStringList(FSavedUploadMissions[iLoop]);
  16652. for jLoop := Missions.Count - 1 downto 0 do
  16653. begin
  16654. UploadMission := Missions.Objects[jLoop] as TUploadMission;
  16655. try
  16656. FreeAndNil(UploadMission);
  16657. except
  16658. end;
  16659. end;
  16660. Missions.Clear;
  16661. FreeAndNil(Missions);
  16662. end;
  16663. FSavedUploadMissions.Clear;
  16664. for iLoop := FSavedDownloadMissions.Count - 1 downto 0 do
  16665. begin
  16666. Missions := TStringList(FSavedDownloadMissions[iLoop]);
  16667. for jLoop := Missions.Count - 1 downto 0 do
  16668. begin
  16669. DownloadMission := Missions.Objects[jLoop] as TDownloadMission;
  16670. try
  16671. FreeAndNil(DownloadMission);
  16672. except
  16673. end;
  16674. end;
  16675. Missions.Clear;
  16676. FreeAndNil(Missions);
  16677. end;
  16678. FSavedDownloadMissions.Clear;
  16679. for iLoop := FDownloadMissions.Count - 1 downto 0 do
  16680. begin
  16681. DownloadMission := FDownloadMissions.Objects[iLoop] as TDownloadMission;
  16682. try
  16683. FreeAndNil(DownloadMission);
  16684. except
  16685. end;
  16686. end;
  16687. FDownloadMissions.Clear;
  16688. end;
  16689. //---退出主程序-----------------------------------------------------
  16690. procedure TMainForm.QuitWindows;
  16691. var
  16692. iWaitTimes: Integer;
  16693. begin
  16694. RealICQClient.OnLoginFailed := nil;
  16695. if RealICQClient.Connected then
  16696. begin
  16697. if GetTalkingFormCount > 0 then
  16698. begin
  16699. if Showing then
  16700. Close;
  16701. CloseAllTalkingForm;
  16702. iWaitTimes := 0;
  16703. while GetTalkingFormCount > 0 do
  16704. begin
  16705. Sleep(100);
  16706. Inc(iWaitTimes);
  16707. if iWaitTimes > 100 then
  16708. Break;
  16709. Application.ProcessMessages;
  16710. end;
  16711. end;
  16712. RealICQClient.Logout;
  16713. end;
  16714. if Showing then
  16715. Close;
  16716. MainForm.OnClose := nil;
  16717. MainForm.Close;
  16718. TrueHiddenMainForm.Close;
  16719. end;
  16720. //-----获的天气信息--------------------------------------------------------
  16721. procedure TMainForm.GetWeather(City, Weatheren, Weather: string);
  16722. var
  16723. Data: CopyDataStruct;
  16724. Args: PChar;
  16725. weatherImgPath: string;
  16726. WeatherList: TStringList;
  16727. WeatherPanelWidth: Integer;
  16728. begin
  16729. lblWeatherCity.Caption := City;
  16730. lblWeatheren.Caption := Weatheren;
  16731. lblWeather.Caption := Weather;
  16732. weatherImgPath := ExtractFilePath(paramstr(0)) + 'Images\Weather\' + GetWeatherImgName(lblWeather.Caption);
  16733. if fileexists(weatherImgPath) then
  16734. imgWeather.Picture.LoadFromFile(weatherImgPath);
  16735. WeatherPanelWidth := lblWeatherCity.Left + lblWeatherCity.Width + 5 + imgWeather.Width + 5 + lblWeather.Width + 5 + lblWeatheren.Width;
  16736. if pnlWebSearch.Width - spbAddFriend.Left >= WeatherPanelWidth then
  16737. lblWeatherCity.Left := spbAddFriend.Left
  16738. else
  16739. lblWeatherCity.Left := btMainMenu.Left + btMainMenu.Width + 5;
  16740. imgWeather.Left := lblWeatherCity.Left + lblWeatherCity.Width + 5;
  16741. lblWeather.Left := imgWeather.Left + imgWeather.Width + 5;
  16742. lblWeatheren.Left := lblWeather.Left + lblWeather.Width + 5;
  16743. end;
  16744. procedure TMainForm.SetGetMoreUserEvent;
  16745. begin
  16746. RealICQClient.OnGettedMoreBranchList := RealICQClientGettedMoreBranchList;
  16747. RealICQClient.OnGettedMoreUserList := RealICQClientGettedMoreUserList;
  16748. if (MessageBoxForm <> nil) then
  16749. begin
  16750. FreeAndNil(MessageBoxForm);
  16751. MessageBoxForm := nil;
  16752. end;
  16753. end;
  16754. //------------------------------------------------------------------------------
  16755. procedure TMainForm.OpenWebTab(TabSheet: TTabSheet; WebPanel: TWebPanel; AcountIndex: Integer);
  16756. var
  16757. Panel, PanelForIE: TPanel;
  16758. WebBrowser: TWebBrowser;
  16759. begin
  16760. TabAcountIndex := AcountIndex;
  16761. Panel := TPanel.Create(TabSheet);
  16762. Panel.Parent := TabSheet;
  16763. Panel.DoubleBuffered := True;
  16764. Panel.Font.Color := spbDisplayName.Font.Color;
  16765. Panel.Caption := '页面加载中...';
  16766. Panel.Color := clWhite;
  16767. Panel.Align := alClient;
  16768. Panel.BevelInner := bvNone;
  16769. Panel.BevelOuter := bvNone;
  16770. Panel.Visible := True;
  16771. Application.ProcessMessages;
  16772. PanelForIE := TPanel.Create(Panel);
  16773. PanelForIE.Parent := Panel;
  16774. PanelForIE.Tag := TabSheet.Tag;
  16775. PanelForIE.DoubleBuffered := True;
  16776. PanelForIE.Color := clWhite;
  16777. PanelForIE.Align := alClient;
  16778. PanelForIE.BevelInner := bvNone;
  16779. PanelForIE.BevelOuter := bvNone;
  16780. PanelForIE.Visible := True;
  16781. Application.ProcessMessages;
  16782. WebBrowser := TWebBrowser.Create(PanelForIE);
  16783. WebBrowser.DoubleBuffered := True;
  16784. WebBrowser.ParentWindow := PanelForIE.Handle;
  16785. WebBrowser.Align := alClient;
  16786. WebBrowser.Visible := True;
  16787. WebBrowser.Tag := TabSheet.Tag;
  16788. WebBrowser.RegisterAsBrowser := True;
  16789. WebBrowser.RegisterAsDropTarget := True;
  16790. //WebBrowser.OnBeforeNavigate2 := WebBrowserRightBeforeNavigate2;
  16791. if WebPanel.FNavigateType = ntFill then
  16792. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentCompleteForPost
  16793. else
  16794. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16795. PanelForIE.InsertControl(WebBrowser);
  16796. Application.ProcessMessages;
  16797. if DisplayWebs then
  16798. begin
  16799. if WebPanel.FNavigateType = ntFill then
  16800. WebBrowser.Navigate(WebPanel.FURL)
  16801. else
  16802. WebBrowser.Navigate('about:blank');
  16803. end;
  16804. end;
  16805. //-------------------------------------------------------
  16806. procedure TMainForm.LoadMainTabImage;
  16807. begin
  16808. MyContactersIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '1.bmp');
  16809. SysMsgIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '2.bmp');
  16810. MyFriendIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '3.bmp');
  16811. MyTeamIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '4.bmp');
  16812. LatestsIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '5.bmp');
  16813. end;
  16814. //------------------------------------------------------------------------------
  16815. //下载升级配置文件
  16816. //------------------------------------------------------------------------------
  16817. procedure TMainForm.DownLoadUpdateConfig;
  16818. var
  16819. TempDir: string;
  16820. begin
  16821. TempDir := GetMyDocument + '\Update';
  16822. if not DirectoryExists(TempDir) then
  16823. ForceDirectories(TempDir);
  16824. if FileExists(GetMyDocument + '\Update\Update.dat') then
  16825. begin
  16826. SetFileAttributes(pchar(GetMyDocument + '\Update\Update.dat'), file_attribute_normal);
  16827. DeleteFile(GetMyDocument + '\Update\Update.dat');
  16828. end;
  16829. FDownFile.ThreadDownFile('http://' + MainForm.RealICQClient.RemoteAddress + '/Update/Update.dat', TempDir + '\Update.dat');
  16830. end;
  16831. //------------------------------------------------------------------------------
  16832. //文件下载完成事件处理函数
  16833. //-----------------------------------------------------------------------------=
  16834. procedure TMainForm.DownFaceFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  16835. begin
  16836. ShowGettedFace(Dest_file);
  16837. end;
  16838. procedure TMainForm.DownFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  16839. var
  16840. OldVersion, Version: string;
  16841. F: Textfile;
  16842. City, Weatheren, Weather: string;
  16843. function GetVersionFromIniFile(FileName: string): string;
  16844. var
  16845. IniFile: TIniFile;
  16846. begin
  16847. IniFile := TIniFile.Create(ExtractFilePath(paramstr(0)) + 'Update.dat');
  16848. try
  16849. OldVersion := IniFile.ReadString('Version', 'Version', '1.0.0.0');
  16850. finally
  16851. IniFile.Free;
  16852. end;
  16853. end;
  16854. begin
  16855. if FileExists(Dest_file) then
  16856. begin
  16857. if UpperCase(ExtractFileExt(Dest_file)) = '.DAT' then
  16858. begin
  16859. OldVersion := '1.0.0.0';
  16860. if FileExists(ExtractFilePath(paramstr(0)) + 'Update.dat') then
  16861. OldVersion := GetVersionFromIniFile(ExtractFilePath(paramstr(0)) + 'Update.dat');
  16862. if FileExists(GetMyDocument + '\Update\Update.dat') then
  16863. Version := GetVersionFromIniFile(GetMyDocument + '\Update\Update.dat');
  16864. if trim(OldVersion) <> trim(Version) then
  16865. WinExec('Update.exe', SW_SHOW);
  16866. end
  16867. else
  16868. begin
  16869. AssignFile(F, Dest_file);
  16870. try
  16871. Reset(F);
  16872. Readln(F, City);
  16873. Readln(F, Weatheren);
  16874. Readln(F, Weather);
  16875. GetWeather(City, Weatheren, Weather);
  16876. finally
  16877. Closefile(F); {关闭文件 F}
  16878. end;
  16879. end;
  16880. end;
  16881. end;
  16882. //------------------------------------------------------------------------------
  16883. //
  16884. //------------------------------------------------------------------------------
  16885. procedure TMainForm.RealICQClientGettedSysMsgInterfaces(Sender: TObject);
  16886. begin
  16887. //
  16888. end;
  16889. //------------------------------------------------------------------------------
  16890. function TMainForm.GetBranchName(LoginName: string): string;
  16891. var
  16892. ItemIndex: Integer;
  16893. Branch: TRealICQBranch;
  16894. Employee: TRealICQEmployee;
  16895. Node: TTreeNode;
  16896. RealICQContacterTreeView: TRealICQContacterTreeView;
  16897. begin
  16898. Result := '';
  16899. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  16900. begin
  16901. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  16902. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  16903. end
  16904. else
  16905. begin
  16906. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMyContacters);
  16907. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  16908. end;
  16909. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  16910. if (Employee = nil) then
  16911. Exit;
  16912. Node := Employee.Node.Parent;
  16913. Result := Node.Text;
  16914. while Node.Parent <> nil do
  16915. begin
  16916. Node := Node.Parent;
  16917. if Node = nil then
  16918. Break;
  16919. if Node.Parent <> nil then
  16920. Result := Node.Text + '/' + Result;
  16921. end;
  16922. end;
  16923. //------------------------------------------------------------------------------
  16924. function TMainForm.GetCompany: string;
  16925. var
  16926. iIndex: Integer;
  16927. ServerInfo: TServerInfo;
  16928. begin
  16929. Result := '';
  16930. if (FServerInfoList.IndexOf(MainForm.CurrentServerID) < 0) or (FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID) < 0) then
  16931. Exit;
  16932. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  16933. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.CurrentServerID)] as (TServerInfo)
  16934. else
  16935. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID)] as (TServerInfo);
  16936. if Assigned(ServerInfo) then
  16937. Result := ServerInfo.ServerName;
  16938. end;
  16939. //------------------------------------------------------------------------------
  16940. //用post方式提交XML文件到服务器
  16941. //------------------------------------------------------------------------------
  16942. procedure TMainForm.PostUpdateLog;
  16943. function ReadUpdateLog: string;
  16944. var
  16945. XMLFile: string;
  16946. ConfigNode: IXMLNode;
  16947. XMLDocument: TXMLDocument;
  16948. begin
  16949. Result := '';
  16950. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  16951. XMLDocument := TXMLDocument.Create(Self);
  16952. try
  16953. try
  16954. if FileExists(XMLFile) then
  16955. begin
  16956. XMLDocument.Active := True;
  16957. XMLDocument.LoadFromFile(XMLFile);
  16958. ConfigNode := XMLDocument.DocumentElement;
  16959. if ConfigNode.ChildNodes.FindNode('product').Attributes['status'] then
  16960. begin
  16961. Result := XMLDocument.XML.Text;
  16962. end;
  16963. end;
  16964. except
  16965. on E: EXception do
  16966. end;
  16967. finally
  16968. XMLDocument.Free;
  16969. end;
  16970. end;
  16971. var
  16972. XMLStr, Url: string;
  16973. begin
  16974. Url := GetUpdateLogPostUrl(ExtractFilePath(paramstr(0)) + 'Online.ini');
  16975. if Url = '' then
  16976. Url := DefaultUpdateLogPostUrl;
  16977. Url := Url + '?LoginName=' + RealICQClient.LoginName + '&DisplayName=' + HttpEncode(AnsiToUtf8(RealICQClient.Me.DisplayName)) + '&ServerName=' + HttpEncode(AnsiToUtf8(edServerList.Text));
  16978. XMLStr := ReadUpdateLog;
  16979. if XMLStr <> '' then
  16980. begin
  16981. TThreadPost.Create(Url, XMLStr);
  16982. end;
  16983. end;
  16984. //------------------------------------------------------------------------------
  16985. procedure TMainForm.UpdatePostLogState(Status: Boolean);
  16986. var
  16987. XMLFile: string;
  16988. ConfigNode: IXMLNode;
  16989. XMLDocument: TXMLDocument;
  16990. begin
  16991. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  16992. XMLDocument := TXMLDocument.Create(Self);
  16993. try
  16994. try
  16995. if FileExists(XMLFile) then
  16996. begin
  16997. XMLDocument.Active := True;
  16998. XMLDocument.LoadFromFile(XMLFile);
  16999. ConfigNode := XMLDocument.DocumentElement;
  17000. ConfigNode.ChildNodes.FindNode('product').Attributes['status'] := Status;
  17001. XMLDocument.SaveToFile(XMLFile);
  17002. end;
  17003. except
  17004. end;
  17005. finally
  17006. XMLDocument.Free;
  17007. end;
  17008. end;
  17009. constructor TThreadPost.Create(URL, Content: string);
  17010. begin
  17011. inherited Create(True);
  17012. FURL := URL;
  17013. FContent := Content;
  17014. FreeOnTerminate := True;
  17015. Resume;
  17016. end;
  17017. procedure TThreadPost.Execute;
  17018. var
  17019. IdHttp: TIdHTTP;
  17020. Sends: TStrings;
  17021. begin
  17022. IdHttp := TIdHTTP.Create(nil);
  17023. Sends := TStringList.Create;
  17024. try
  17025. IdHttp.Request.ContentType := 'application/x-www-form-urlencoded';
  17026. Sends.Add('XmlStr=' + StrToBase64(FContent));
  17027. IdHttp.Post(FUrl, Sends);
  17028. MainForm.UpdatePostLogState(False);
  17029. finally
  17030. FreeAndNil(IdHttp);
  17031. Sends.Free;
  17032. end;
  17033. end;
  17034. //---------------检测指定的进程是否运行-----------------------------------------
  17035. constructor TCheckRunProcessThread.Create(AProgramName, AProcessPath: string);
  17036. begin
  17037. inherited Create(True);
  17038. ProgramName := AProgramName;
  17039. ProcessPath := AProcessPath;
  17040. FreeOnTerminate := True;
  17041. Resume;
  17042. end;
  17043. //------------得到进程的执行路径------------------------------------------------
  17044. function TCheckRunProcessThread.GetProcessPath(ProcessID: DWORD): string;
  17045. var
  17046. Hand: THandle;
  17047. ModName: array[0..Max_Path - 1] of Char;
  17048. hMod: HModule;
  17049. n: DWORD;
  17050. begin
  17051. Result := '';
  17052. Hand := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, ProcessID);
  17053. if Hand > 0 then
  17054. try
  17055. ENumProcessModules(Hand, @hMod, Sizeof(hMod), n);
  17056. if GetModuleFileNameEx(Hand, hMod, ModName, Sizeof(ModName)) > 0 then
  17057. Result := ModName; //得到路径和文见名
  17058. except
  17059. end;
  17060. end;
  17061. //根据可执行文件名称查找进程列表,以判断程序是否正在运行。
  17062. function TCheckRunProcessThread.FindProcess(AFileName: string): boolean;
  17063. var
  17064. hSnapshot: THandle; //用于获得进程列表
  17065. lppe: TProcessEntry32; //用于查找进程
  17066. Found: Boolean; //用于判断进程遍历是否完成
  17067. ProcessPath: string;
  17068. begin
  17069. Result := False;
  17070. hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); //获得系统进程列表
  17071. lppe.dwSize := SizeOf(TProcessEntry32); //在调用Process32First API之前,需要初始化lppe记录的大小
  17072. Found := Process32First(hSnapshot, lppe); //将进程列表的第一个进程信息读入ppe记录中
  17073. while Found do
  17074. begin
  17075. ProcessPath := GetProcessPath(lppe.th32ProcessID);
  17076. if UpperCase(ProcessPath) = UpperCase(AFileName) then
  17077. begin
  17078. Result := True;
  17079. end;
  17080. Found := Process32Next(hSnapshot, lppe); //将进程列表的下一个进程信息读入lppe记录中
  17081. end;
  17082. end;
  17083. //------------------------------------------------------------------------------
  17084. procedure TCheckRunProcessThread.Execute;
  17085. begin
  17086. while FindProcess(ProcessPath) do
  17087. begin
  17088. Sleep(1000);
  17089. end;
  17090. MainForm.PostUpdateLog;
  17091. end;
  17092. procedure TMainForm.btOAClick(Sender: TObject);
  17093. begin
  17094. MessageBox(Handle, '协同办公系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17095. end;
  17096. procedure TMainForm.btSwapClick(Sender: TObject);
  17097. begin
  17098. MessageBox(Handle, '公文交换系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17099. end;
  17100. initialization
  17101. HookID := 0;
  17102. FUploadMissions := TStringList.Create;
  17103. FSavedUploadMissions := TList.Create;
  17104. FDownloadMissions := TStringList.Create;
  17105. FSavedDownloadMissions := TList.Create;
  17106. CoInitialize(nil);
  17107. OleInitialize(nil);
  17108. finalization
  17109. try
  17110. ClearFileMissions;
  17111. FreeAndNil(FSavedDownloadMissions);
  17112. FreeAndNil(FSavedUploadMissions);
  17113. FreeAndNil(FUploadMissions);
  17114. FreeAndNil(FDownloadMissions);
  17115. OleUninitialize;
  17116. CoUninitialize;
  17117. except
  17118. end;
  17119. end.