MainFrm.pas 683 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112
  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. //http://10.41.220.59:8080/account/sso?LoginName=&Password=&URL=/Widgets/home/index
  26. //老的
  27. BaseURL = '/login.aspx?LoginName=%s&Password=%s&URL=%s';
  28. //新的
  29. NewBaseURL = '/account/sso?LoginName=%s&Password=%s&URL=%s';
  30. LoginURL = '';
  31. InBoxURL = ''; //'/widgets/home/index';
  32. ReadMessageURL = '/Messages/Default.aspx?url=';
  33. GetWeatherMessage = WM_APP + 157;
  34. //DefaultUpdateLogPostUrl = 'http://360.myreda.com/Insert.aspx';
  35. MainTabImageDir = 'Images\TabImage\';
  36. SMSURL = '/Messages/SMSManage.aspx';
  37. MiniPageURL = '/Messages/MiniPage.aspx?LoginName=%s';
  38. AddRemarkURL = '/Messages/Default.aspx?url=SMSManage.aspx?url=EditMemorandum.aspx?Contents=%s';
  39. SNSHomePage = '/SNS/Login.aspx?LoginName=%s&Password=%s&DestUser=%s';
  40. ShowSNS = False;
  41. TeamSharePic: string = 'Images\Share.png';
  42. LoginingGif: string = 'Images\Logining.gif';
  43. DefaultIcon: string = 'Images\Small\DefaultIcon.ico';
  44. TeamIcon: string = 'Images\Small\Team.ico';
  45. SystemMessageIcon: string = 'Images\Small\SystemMessage.ico';
  46. SMSMessageIcon: string = 'Images\Small\SMS.ico';
  47. SNSIcon: string = 'Images\Small\SNS.ico';
  48. CancelIcon: string = 'Images\Cancel.ico';
  49. UpBMP: string = 'Images\Upload.png';
  50. DownBMP: string = 'Images\Download.png';
  51. SimpleMessagePicture: string = 'Images\SysMsg\SimpleMessage.bmp';
  52. SystemMessagePicture: string = 'Images\SysMsg\SystemMessage.bmp';
  53. TeamPicture: string = 'Images\Small\Team.bmp';
  54. SearchPicture: string = 'Images\Search.bmp';
  55. Action_Paste_GIF: string = 'Images\action_paste.png';
  56. WorldCamPicture: string = 'Images\worldCam.jpg';
  57. //VideoBorderBig: String = 'Images\VideoBorderBig.bmp';
  58. //VideoBorderMiddle: String = 'Images\VideoBorderMiddle.bmp';
  59. //VideoBorderSmall: String = 'Images\VideoBorderSmall.bmp';
  60. DefaultTeamPicture: string = 'Images\Small\TeamHead.png';
  61. DefaultPictureSecurity: string = 'Images\Small\Security.bmp';
  62. DefaultPicture: string = 'Images\Small\DefaultHeadImage_96.png';
  63. DefaultPictureBig44: string = 'Images\Small\DefaultHeadImage_44.png';
  64. DefaultPictureBig: string = 'Images\Small\DefaultHeadImage_48.png';
  65. DefaultPictureMiddle: string = 'Images\Small\DefaultHeadImage_24.png';
  66. DefaultPictureSmall: string = 'Images\Small\DefaultHeadImage_16.png';
  67. DefaultPictureBigOffline: string = 'Images\Small\DefaultHeadImageOffline_48.png';
  68. DefaultPictureMiddleOffline: string = 'Images\Small\DefaultHeadImageOffline_24.png';
  69. DefaultPictureSmallOffline: string = 'Images\Small\DefaultHeadImageOffline_16.png';
  70. LeavePicture: string = 'Images\Small\Leave.bmp';
  71. CameraIcon: string = 'Images\Small\Camera.ico';
  72. CameraIconBitmap: string = 'Images\Small\Camera.bmp';
  73. SelectedItemBackgroud: string = 'Images\Small\ItemBack.bmp';
  74. AddFriendIcon: string = 'Images\Small\AddFriend.ico';
  75. TelephoneIcon: string = 'Images\Small\Telephone.ico';
  76. MobilePhoneIcon: string = 'Images\Small\MobilePhone.ico';
  77. EmailIcon: string = 'Images\Small\Email.ico';
  78. SMSIcon: string = 'Images\Small\SMS.ico';
  79. SMSBMP: string = 'Images\Small\SMS.bmp';
  80. SMSSendOK: string = 'Images\SMSSendOK.ico';
  81. SMSSending: string = 'Images\SMSSending.gif';
  82. SMSSendError: string = 'Images\SMSSendError.ico';
  83. BranchExpandedPicture: string = 'Images\OpenFolder.ico';
  84. BranchCollapsedPicture: string = 'Images\CloseFolder.ico';
  85. BranchCollapsedBMP: string = 'Images\CloseFolder.png';
  86. BranchClosedButtonPicture: string = 'Images\ClosedButton.bmp';
  87. BranchOpenedButtonPicture: string = 'Images\OpenedButton.bmp';
  88. GroupOpenedButtonPicture: string = 'Images\FriendOpenedButton.bmp';
  89. GroupClosedButtonPicture: string = 'Images\FriendClosedButton.bmp';
  90. ScrollBarBottomButtonPicture: string = 'Images\VScrollBar\ScrollBarBottomButton.bmp';
  91. ScrollBarBottomButtonDownPicture: string = 'Images\VScrollBar\ScrollBarBottomButtonDown.bmp';
  92. ScrollBarBottomButtonHoverPicture: string = 'Images\VScrollBar\ScrollBarBottomButtonHover.bmp';
  93. ScrollBarTopButtonPicture: string = 'Images\VScrollBar\ScrollBarTopButton.bmp';
  94. ScrollBarTopButtonDownPicture: string = 'Images\VScrollBar\ScrollBarTopButtonDown.bmp';
  95. ScrollBarTopButtonHoverPicture: string = 'Images\VScrollBar\ScrollBarTopButtonHover.bmp';
  96. ScrollBarTrackButtonBottomPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottom.bmp';
  97. ScrollBarTrackButtonBottomDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottomDown.bmp';
  98. ScrollBarTrackButtonBottomHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonBottomHover.bmp';
  99. ScrollBarTrackButtonMiddlePicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddle.bmp';
  100. ScrollBarTrackButtonMiddleDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddleDown.bmp';
  101. ScrollBarTrackButtonMiddleHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonMiddleHover.bmp';
  102. ScrollBarTrackButtonTopPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTop.bmp';
  103. ScrollBarTrackButtonTopDownPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTopDown.bmp';
  104. ScrollBarTrackButtonTopHoverPicture: string = 'Images\VScrollBar\ScrollBarTrackButtonTopHover.bmp';
  105. ScrollBackgroundPicture: string = 'Images\VScrollBar\ScrollBackground.bmp';
  106. ScrollBarButtonPicture: string = 'Images\VScrollBar\MiddleButton.bmp';
  107. ConfigXMLFilePath: string = 'XML\';
  108. UpdateLogXMLFile: string = 'Online.xml';
  109. GroupConfigXMLFile: string = 'GroupConfig.XML';
  110. StyleConfigXMLFile: string = 'StyleConfig.XML';
  111. DefaultConfigXMLFile: string = 'DefaultConfig.XML';
  112. InputConfigXMLFile: string = 'InputConfig.XML';
  113. HintAndSoundConfigXMLFile: string = 'HintAndSoundConfig.XML';
  114. ReceiveFileConfigXMLFile: string = 'ReceiveFileConfig.XML';
  115. SystemMessagesCounterXMLFile: string = 'SystemMessagesCounter.XML';
  116. SafeConfigXMLFile: string = 'SafeConfig.XML';
  117. AutoUpdateConfigXMLFile: string = 'AutoUpdateConfig.XML';
  118. WindowColorsXMLFile: string = 'WindowColors.XML';
  119. BackGroundImagesXMLFile: string = 'BackGroundImages.XML';
  120. HotKeyConfigXMLFile: string = 'HotKeyConfig.XML';
  121. WebPanelsXMLFile: string = 'WebPanels.XML';
  122. OfflineAutoResponseConfigXMLFile: string = 'OfflineAutoResponseConfig.XML';
  123. AddrBookConfig: string = 'AddrBookConfig.XML';
  124. SysMsgInterfaceConfig: string = 'SysMsgInterfaceConfig.XML';
  125. MessageHistoryDBFile: string = 'Users\History.dat';
  126. PersonalMessageHistoryDBFile: string = 'MessageHistory.DAT';
  127. FaceSmallBMP: string = '_SmallBMP';
  128. FacePreviewBMP: string = '_PreviewBMP';
  129. FaceSmallSize: Integer = 28;
  130. FacePreviewSize: Integer = 92;
  131. ShakeWindowSound: string = 'Sound\nudge.wav';
  132. //未读消息类型,未读消息集合(StringList)中的字符串值为以下常量的值时,表示为特殊的系统消息
  133. TeamMessageID: string = '_____________________________________TeamMessage_';
  134. SystemMessageID: string = '___________________________________SystemMessage_';
  135. SMSMessageID: string = '______________________________________SMSMessage_';
  136. AVSetExeFile: string = 'Plugin\AVSet.EXE';
  137. HelpCHMFile: string = 'HELP.CHM';
  138. SystemFaceGroup: string = '默认表情';
  139. NOFaceCategory: string = '未分组表情';
  140. type
  141. TInvokeDLLForm = function(App: TApplication; hWnd: THandle; pCall: Pointer; AReceiver: PChar; AColor: TColor): TForm; stdcall;
  142. TWebPanel = class;
  143. TSystemMessageType = (smSimple = 1, smSystemMessage = 2);
  144. TRecvFileSafeLevel = (fsHigh = 0, fsMiddle = 1, fsLow = 2);
  145. THidePosition = (hpNone = 0, hpLeft = 1, hpTop = 2, hpRight = 3);
  146. //定义保存通讯录组和用户的数据结构
  147. TManageGroupMessage = class
  148. private
  149. MessageId: string;
  150. FGroupID: string;
  151. FParentID: string;
  152. FGroupName: string;
  153. end;
  154. TManageGroupMemberMessage = class
  155. private
  156. MessageId: string;
  157. FId: string;
  158. FDisplayName: string;
  159. FNickName: string;
  160. FMobile: string;
  161. FTel: string;
  162. FEmail: string;
  163. FRemark: string;
  164. FGroupId: string;
  165. end;
  166. TServerInfo = class
  167. public
  168. ServerId, ServerName: string;
  169. end;
  170. //检测指定的进程是否运行
  171. TCheckRunProcessThread = class(TThread)
  172. private
  173. ProgramName: string;
  174. ProcessPath: string;
  175. protected
  176. function GetProcessPath(ProcessID: DWORD): string;
  177. function FindProcess(AFileName: string): boolean;
  178. procedure Execute; override;
  179. public
  180. constructor Create(AProgramName, AProcessPath: string);
  181. end;
  182. TThreadPost = class(TThread) //以Post方式提交数据到web页面线程类。
  183. private
  184. FUrl: string;
  185. FContent: string;
  186. protected
  187. procedure Execute; override;
  188. public
  189. constructor Create(URL, Content: string); overload;
  190. end;
  191. TUploadMission = class;
  192. TNDMissionType = (mtDir, mtFile);
  193. TMainForm = class(TRealICQSkinForm)
  194. actLoginAs: TAction;
  195. actLogout: TAction;
  196. actPersonalSet: TAction;
  197. actChangePass: TAction;
  198. actClose: TAction;
  199. actOnline: TAction;
  200. actHidden: TAction;
  201. actOffline: TAction;
  202. actBusy: TAction;
  203. actMute: TAction;
  204. actLeave: TAction;
  205. actOtherState: TAction;
  206. actFindUsers: TAction;
  207. actSaveList: TAction;
  208. actLoadList: TAction;
  209. actShowBigHeadImage: TAction;
  210. actShowSmallHeadImage: TAction;
  211. actShowNormalHeadImage: TAction;
  212. actShowLoginName: TAction;
  213. actShowDisplayName: TAction;
  214. actShowAllName: TAction;
  215. actAlwaysOnTop: TAction;
  216. actMsgManager: TAction;
  217. actAVSet: TAction;
  218. actOptions: TAction;
  219. actHelp: TAction;
  220. actAbout: TAction;
  221. ImgLstPageControl: TImageList;
  222. ActionManager: TActionManager;
  223. ColorDialog: TColorDialog;
  224. actQuit: TAction;
  225. RealICQClient: TRealICQClient;
  226. actReg: TAction;
  227. actConnectSet: TAction;
  228. ppUserItemRightMenu: TPopupActionBar;
  229. actSendMessage: TAction;
  230. actDelFriend: TAction;
  231. miSendMessage: TMenuItem;
  232. N1: TMenuItem;
  233. miDelFriend: TMenuItem;
  234. actShowGroup: TAction;
  235. actGroupManager: TAction;
  236. actShowMiddleHeadImage: TAction;
  237. actRemoveUser: TAction;
  238. actShowStrangers: TAction;
  239. actShowBlacklists: TAction;
  240. actShowTeams: TAction;
  241. actShowLatests: TAction;
  242. ppChangeStates: TPopupActionBar;
  243. O1: TMenuItem;
  244. H1: TMenuItem;
  245. N3: TMenuItem;
  246. N5: TMenuItem;
  247. N10: TMenuItem;
  248. ImgLstTrayIcon: TImageList;
  249. ppTrayIcon: TPopupActionBar;
  250. MenuItem12: TMenuItem;
  251. REALICQ1: TMenuItem;
  252. X1: TMenuItem;
  253. M1: TMenuItem;
  254. S1: TMenuItem;
  255. I1: TMenuItem;
  256. N19: TMenuItem;
  257. N20: TMenuItem;
  258. actOpenMainForm: TAction;
  259. TimerForCheckDblClick: TTimer;
  260. ppColors: TPopupActionBar;
  261. MenuItem18: TMenuItem;
  262. miMoreColors: TMenuItem;
  263. ImgLstColors: TImageList;
  264. pnlAll: TPanel;
  265. actSeeInformation: TAction;
  266. miSeeUserInformation: TMenuItem;
  267. N21: TMenuItem;
  268. miSkins: TMenuItem;
  269. pnlLogout: TPanel;
  270. pnlWorkArea: TPanel;
  271. pnlMiddle: TPanel;
  272. pnlClient: TPanel;
  273. TrayIcon: TTrayIcon;
  274. actShowGIFInMailForm: TAction;
  275. actShowGIFInTalkingForm: TAction;
  276. TimerForFlashTrayIcon: TTimer;
  277. ImgLstForFlashTrayIcon: TImageList;
  278. ApplicationEvents: TApplicationEvents;
  279. actCustomFacesManager: TAction;
  280. actOpenRecvFileDir: TAction;
  281. actCreateTeam: TAction;
  282. actSendTeamMessage: TAction;
  283. actSeeTeamInformation: TAction;
  284. actQuitTeam: TAction;
  285. actDisbandTeam: TAction;
  286. actQuitOrDisbandTeams: TAction;
  287. pnlAdvertisement: TPanel;
  288. pnlForWebBrowser: TPanel;
  289. WebBrowserForAdvertisement: TWebBrowser;
  290. pnlForHideWebBrowser: TPanel;
  291. TimerForShowSystemMessage: TTimer;
  292. actShowHistory: TAction;
  293. miShowHistory: TMenuItem;
  294. actShowTeamHistory: TAction;
  295. imgLogoutBK: TImage;
  296. imgLogoutBKTop: TImage;
  297. lblLoginNameTitle: TLabel;
  298. spLoginNameBorder: TShape;
  299. edLoginName: TEdit;
  300. lblLoginState: TLabel;
  301. lblPasswordTitle: TLabel;
  302. edPassword: TEdit;
  303. spPasswordBorder: TShape;
  304. lblLoginStateTitle: TLabel;
  305. spbLoginState: TRealICQSpeedButton;
  306. spbSavePassword: TRealICQSpeedButton;
  307. spbAutoLogin: TRealICQSpeedButton;
  308. lblRemoveMyLoginInfo: TLabel;
  309. lblNetworkConfig: TLabel;
  310. lblRegister: TLabel;
  311. ppLoginedUsers: TPopupActionBar;
  312. MenuItem4: TMenuItem;
  313. miClearLoginHistory: TMenuItem;
  314. ImgLstCheckStates: TImageList;
  315. ppLoginStates: TPopupActionBar;
  316. miOnline: TMenuItem;
  317. lblReConnect: TLabel;
  318. actChangeRemark: TAction;
  319. M2: TMenuItem;
  320. actShowRemark: TAction;
  321. TimerForCheckLogoutTimeout: TTimer;
  322. ImgLstForLogining: TImageList;
  323. TimerForLogining: TTimer;
  324. actShowTree: TAction;
  325. pnlWebSearch: TPanel;
  326. pnlWebSearchSplit: TPanel;
  327. ppContacterViewStyle: TPopupActionBar;
  328. Z1: TMenuItem;
  329. A1: TMenuItem;
  330. D1: TMenuItem;
  331. L1: TMenuItem;
  332. P1: TMenuItem;
  333. N22: TMenuItem;
  334. S2: TMenuItem;
  335. M3: TMenuItem;
  336. B1: TMenuItem;
  337. N23: TMenuItem;
  338. S3: TMenuItem;
  339. B2: TMenuItem;
  340. N24: TMenuItem;
  341. G1: TMenuItem;
  342. M4: TMenuItem;
  343. N25: TMenuItem;
  344. N26: TMenuItem;
  345. T1: TMenuItem;
  346. btLogin: TRealICQButton;
  347. ppLanguages: TPopupActionBar;
  348. imgLogo: TImage;
  349. TimerForHideMainForm: TTimer;
  350. //TimerForShowMainForm: TTimer;
  351. RealICQNetWorkDiskClient: TRealICQNetWorkDiskClient;
  352. ppNetWorkFile: TPopupActionBar;
  353. miNDNewDir: TMenuItem;
  354. miNDDelete: TMenuItem;
  355. N28: TMenuItem;
  356. miNDRename: TMenuItem;
  357. pnlMiddleClient: TPanel;
  358. pnlMiddleRight: TPanel;
  359. Spl: TSplitter;
  360. pnlMuiltiWeb: TPanel;
  361. pnlMuiltWebStatus: TPanel;
  362. lblIEStatus: TLabel;
  363. pnlMuiltiWebToolbar: TPanel;
  364. spbPrev: TRealICQSpeedButton;
  365. spbNext: TRealICQSpeedButton;
  366. spbStop: TRealICQSpeedButton;
  367. spbRefresh: TRealICQSpeedButton;
  368. spbAddToNA: TRealICQSpeedButton;
  369. Label2: TLabel;
  370. spbGo: TRealICQSingleImageButton;
  371. cbxURLInputer: TComboBoxEx;
  372. TabSetMuiltWeb: TTabSet;
  373. shpWebStatus: TShape;
  374. shpWebLeftBorder: TShape;
  375. UploadFileOpenDialog: TOpenDialog;
  376. ppNetWorkMisson: TPopupActionBar;
  377. miNDCancel: TMenuItem;
  378. DownloadFileSaveDialog: TSaveDialog;
  379. miNDDownload: TMenuItem;
  380. pgcMultiWeb: TRealICQNoBorderPageControl;
  381. ImgLstForShowHideRight: TImageList;
  382. ImgLstForIEAddress: TImageList;
  383. spbWebClose: TRealICQSpeedButton;
  384. imgWebToolBack: TImage;
  385. shpWebRightBorder: TShape;
  386. sbpNewWebTab: TRealICQSpeedButton;
  387. Bevel5: TBevel;
  388. actOfflieAutoResponse: TAction;
  389. L3: TMenuItem;
  390. imgBottomMenu: TImage;
  391. btMainMenu: TBitmapButton;
  392. spbAddFriend: TRealICQSpeedButton;
  393. pgcMainWorkArea: TTRealICQPageControl;
  394. tsContacters: TTabSheet;
  395. tsAddrBook: TTabSheet;
  396. tsNetWorkDisk: TTabSheet;
  397. pnlAddrBook: TPanel;
  398. pnlNDStateBar: TPanel;
  399. lblNDState: TLabel;
  400. lblNDSpaceSize: TLabel;
  401. pnlNDToolBar: TPanel;
  402. imgNDToolbarBack: TImage;
  403. spbNDNewDir: TRealICQSpeedButton;
  404. spbNDDelete: TRealICQSpeedButton;
  405. spbNDMoveUp: TRealICQSpeedButton;
  406. spbNDUpload: TRealICQSpeedButton;
  407. spbNDDownload: TRealICQSpeedButton;
  408. Bevel1: TBevel;
  409. Bevel2: TBevel;
  410. spbNDConnect: TRealICQSpeedButton;
  411. Bevel4: TBevel;
  412. Bevel3: TBevel;
  413. spbNDRefresh: TRealICQSpeedButton;
  414. spbNDCancelAll: TRealICQSpeedButton;
  415. spbNDDisconnect: TRealICQSpeedButton;
  416. pnlNetWorkFiles: TPanel;
  417. shpNDDirBorder: TShape;
  418. edNDDir: TEdit;
  419. pnlNDFiles: TPanel;
  420. SplitterNDMissions: TSplitter;
  421. pnlNDMissions: TPanel;
  422. PageControlNDMission: TRealICQNoBorderPageControl;
  423. tsUploadingFiles: TTabSheet;
  424. tsDownloadingFiles: TTabSheet;
  425. TabSetNDMissions: TTabSet;
  426. pnlTop: TPanel;
  427. imgTitleBackMiddle: TImage;
  428. shpHeadBack: TShape;
  429. imgHead: TImage;
  430. imgLeave: TImage;
  431. spbDisplayName: TRealICQSpeedButton;
  432. spbWatchword: TRealICQSpeedButton;
  433. shpWatchwordBorder: TShape;
  434. imgHeadImageBorder: TImage;
  435. spbSelUIColor: TRealICQSpeedButton;
  436. spbEmail: TRealICQSpeedButton;
  437. sbpSMS: TRealICQSpeedButton;
  438. edWatchword: TEdit;
  439. WebBrowserForEMail: TWebBrowser;
  440. spbHistroyMessage: TRealICQSpeedButton;
  441. imgLstContacterPageCtrl: TImageList;
  442. edFilterKeyword: TEdit;
  443. spbContacterViewStyle: TRealICQSpeedButton;
  444. spbCancelFilter: TRealICQSpeedButton;
  445. imgWeather: TImage;
  446. ppMainMenu: TPopupActionBar;
  447. miOpenRecvFileDir: TMenuItem;
  448. miCustomFacesManager: TMenuItem;
  449. miAVSet: TMenuItem;
  450. N31: 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. pnlGroups: TPanel;
  541. pnlMoreUser: TPanel;
  542. ImgLoadingMoreBranchs: TImage;
  543. pnlSelectServer: TPanel;
  544. shpSearchMoreUser: TShape;
  545. spServerListBorder: TShape;
  546. spbSelectServer: TRealICQSpeedButton;
  547. spbRefreshBranchUsers: TRealICQSpeedButton;
  548. edtSearchMoreUser: TEdit;
  549. edServerList: TEdit;
  550. pnlSearchMoreUser: TPanel;
  551. ShpSearchLeft: TShape;
  552. ShpSearchRight: TShape;
  553. ShpSearchBottom: TShape;
  554. LblSearchHint: TLabel;
  555. ImgLogining: TImage;
  556. ScrollBoxSearchMoreUser: TScrollBox;
  557. ScrollBoxMoreUser: TScrollBox;
  558. pnlTeams: TPanel;
  559. spbFindTeam: TRealICQSpeedButton;
  560. spbCreateTeam: TRealICQSpeedButton;
  561. pnlTemp: TPanel;
  562. ScrollBoxContacters: TScrollBox;
  563. ScrollBoxLatests: TScrollBox;
  564. ScrollBoxMyFriend: TScrollBox;
  565. ScrollBoxTeam: TScrollBox;
  566. spbNetworkBackup: TRealICQSpeedButton;
  567. TimerForHideUserCard: TTimer;
  568. TimerForShowUserCard: TTimer;
  569. RealICQHoverImage1: TRealICQHoverImage;
  570. ImageListForStatBig: TImageList;
  571. ImageListForStatSmall: TImageList;
  572. M5: TMenuItem;
  573. actPhone: TAction;
  574. actRepast: TAction;
  575. actMeeting: TAction;
  576. N6: TMenuItem;
  577. N7: TMenuItem;
  578. N8: TMenuItem;
  579. miLeave: TMenuItem;
  580. miBusy: TMenuItem;
  581. miMute: TMenuItem;
  582. miHidden: TMenuItem;
  583. N9: TMenuItem;
  584. N11: TMenuItem;
  585. N12: TMenuItem;
  586. N13: TMenuItem;
  587. N14: TMenuItem;
  588. N15: TMenuItem;
  589. N16: TMenuItem;
  590. N17: TMenuItem;
  591. N18: TMenuItem;
  592. //spb360Safe: TRealICQSpeedButton;
  593. spbChangeLoginName: TRealICQSpeedButton;
  594. spbWinMeet: TRealICQSpeedButton;
  595. ppTeamListView: TPopupActionBar;
  596. MenuItem1: TMenuItem;
  597. MenuItem2: TMenuItem;
  598. H3: TMenuItem;
  599. miSendTeamSMS: TMenuItem;
  600. MenuItem3: TMenuItem;
  601. X2: TMenuItem;
  602. R1: TMenuItem;
  603. Q1: TMenuItem;
  604. //spb360SD: TRealICQSpeedButton;
  605. WebBrowserForPostWorkOrder: TWebBrowser;
  606. pnlLocked: TPanel;
  607. shp_lock_client: TShape;
  608. img_lock_headimage_border: TImage;
  609. img_lock_HeadPrev: TImage;
  610. img_lockback_top: TImage;
  611. btn_unlock: TRealICQSpeedButton;
  612. btn_lock_DisplayName: TRealICQSpeedButton;
  613. btn_lock: TMenuItem;
  614. miExportGroupUser: TMenuItem;
  615. SD: TSaveDialog;
  616. TimerForreconnectgroup: TTimer;
  617. ImgApp: TImage;
  618. btnCALogin: TRealICQSpeedButton;
  619. chrmAppCentre: TChromium;
  620. spblock: TRealICQSpeedButton;
  621. procedure SysMsgIconClick(Sender: TObject);
  622. procedure TimerForreconnectgroupTimer(Sender: TObject);
  623. procedure spbExportGroupUserClick(Sender: TObject);
  624. procedure btn_unlockClick(Sender: TObject);
  625. procedure btn_lockClick(Sender: TObject);
  626. procedure WebBrowserForPostWorkOrderDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  627. //procedure spb360SDClick(Sender: TObject);
  628. procedure miSendTeamSMSClick(Sender: TObject);
  629. procedure spbWinMeetClick(Sender: TObject);
  630. procedure RealICQClientGettedSendOfflineFileRequest(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  631. //procedure spb360SafeClick(Sender: TObject);
  632. procedure RealICQClientGettedPermission(Sender: TObject);
  633. procedure miMuteClick(Sender: TObject);
  634. procedure miBusyClick(Sender: TObject);
  635. procedure miLeaveClick(Sender: TObject);
  636. procedure imgHeadImageBorderMouseLeave(Sender: TObject);
  637. procedure imgHeadImageBorderMouseEnter(Sender: TObject);
  638. procedure pnlToolBarResize(Sender: TObject);
  639. procedure TimerForShowUserCardTimer(Sender: TObject);
  640. procedure TimerForHideUserCardTimer(Sender: TObject);
  641. procedure spbNetworkBackupClick(Sender: TObject);
  642. procedure tsContactersResize(Sender: TObject);
  643. procedure tsContactersShow(Sender: TObject);
  644. procedure RealICQClientReceivedVideoImage(Sender: TObject; ALoginName: string; ABitmap: TBitmap);
  645. procedure spbRefreshBranchUsersClick(Sender: TObject);
  646. procedure RealICQClientChangePasswordResult(Sender: TObject; APassChanged: Boolean; ANewPassword: string);
  647. procedure RealICQClientGetDBProcedureResult(Sender: TObject; DBProcedureName, ArgIn, ArgOut: string);
  648. procedure miGoSpaceClick(Sender: TObject);
  649. procedure miSetRemarkClick(Sender: TObject);
  650. procedure btShowMiniPageClick(Sender: TObject);
  651. procedure RealICQClientGettedMiniPageSets(Sender: TObject);
  652. procedure spbShowNotReadMessageClick(Sender: TObject);
  653. procedure lblLogsClick(Sender: TObject);
  654. procedure TimerForShowSystemNoticesTimer(Sender: TObject);
  655. procedure lblLogsMouseLeave(Sender: TObject);
  656. procedure lblLogsMouseEnter(Sender: TObject);
  657. procedure btNextLogClick(Sender: TObject);
  658. procedure btPrevLogClick(Sender: TObject);
  659. procedure RealICQClientGetSystemNoticesCount(Sender: TObject; iCount: Integer; NoticesRecords: array of TSystemNotices);
  660. procedure RealICQClientGetNotReadMessageCount(Sender: TObject; iCount: Integer);
  661. procedure TimerForGetBranchUsersOnlineStatesTimer(Sender: TObject);
  662. procedure TimerForGetBranchOnlineStatesTimer(Sender: TObject);
  663. procedure TrayIconMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  664. procedure RealICQClientGettedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  665. procedure LblHintClick(Sender: TObject);
  666. procedure btCloseTopMessageClick(Sender: TObject);
  667. procedure spbImportGroupUserClick(Sender: TObject);
  668. procedure miPasteClick(Sender: TObject);
  669. procedure miCutClick(Sender: TObject);
  670. procedure miDelGroupUserClick(Sender: TObject);
  671. procedure miUpdateGroupUserClick(Sender: TObject);
  672. procedure miAddGroupUserClick(Sender: TObject);
  673. procedure miDelGroupClick(Sender: TObject);
  674. procedure miUpdateGroupClick(Sender: TObject);
  675. procedure miAddGroupClick(Sender: TObject);
  676. procedure ppAddrBookListPopup(Sender: TObject);
  677. procedure ppAddrBookListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  678. procedure RealICQClientGettedSendFolderRequest(Sender: TObject; AID, ACount: Cardinal; ALoginName: string; AFilesStream: TStream);
  679. procedure RealICQClientCanceledSendFolder(Sender: TObject; AID: Cardinal; ALoginName: string);
  680. procedure RealICQClientGettedBranchUser(Sender: TObject);
  681. procedure ppSelCallTelGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  682. procedure tsCustomerServiceContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
  683. procedure RealICQClientSearchUserResult(Sender: TObject);
  684. procedure edtSearchMoreUserChange(Sender: TObject);
  685. procedure edtSearchMoreUserExit(Sender: TObject);
  686. procedure edtSearchMoreUserClick(Sender: TObject);
  687. procedure RealICQClientGettedWebUrl(Sender: TObject);
  688. procedure RealICQClientReceivedServerList(Sender: TObject; AServerList: string);
  689. procedure spbSelectServerClick(Sender: TObject);
  690. procedure MeasureItem(Sender: TObject; ACanvas: TCanvas; var Width, Height: Integer);
  691. procedure ppServerListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  692. procedure RealICQClientGettedMoreUserList(Sender: TObject);
  693. procedure RealICQClientGettedMoreBranchList(Sender: TObject);
  694. procedure ppChangeCustomerStateGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  695. procedure btCustomerDisplayNameClick(Sender: TObject);
  696. procedure spbPersonManageClick(Sender: TObject);
  697. procedure edFilterKeywordClick(Sender: TObject);
  698. procedure ImageButtonEnter(Sender: TObject);
  699. procedure ImageButtonLeave(Sender: TObject);
  700. procedure ImageButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  701. procedure pgcMainWorkAreaWebPanelButtonClick(Sender: TObject);
  702. procedure ppMainMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  703. procedure btMainMenuClick(Sender: TObject);
  704. procedure tsAddrBookShow(Sender: TObject);
  705. procedure WebBrowserAddrBookDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  706. procedure WebBrowserAddrBookBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  707. procedure RealICQClientGettedCancelRemoteControlTransmite(Sender: TObject; ALoginName: string);
  708. procedure RealICQClientCancelControlRemoteControlTransmite(Sender: TObject; ALoginName: string);
  709. procedure RealICQClientSendedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  710. procedure RealICQClientSendedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  711. procedure RealICQClientGettedStopRemoteControlTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  712. procedure RealICQClientGettedRemoteControlTransmiteScreenSize(Sender: TObject; ALoginName: string; AWidth, AHeight: Integer);
  713. procedure RealICQClientGettedRemoteControlTransmiteScreenImage(Sender: TObject; ALoginName: string; ALeft, ATop, AWidth, AHeight: Integer; AP: TPoint; ABitmap: TBitmap);
  714. procedure RealICQClientGettedRemoteControlTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  715. procedure RealICQClientGettedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  716. procedure RealICQClientGettedRemoteControlTransmiteControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  717. procedure RealICQClientGettedRemoteControlTransmiteConnectted(Sender: TObject; ALoginName: string);
  718. procedure RealICQClientGettedRemoteControlTransmiteBeControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  719. procedure RealICQClientReceivedOfflineFile(Sender: TObject; ASender, AFileName: string; AFileSize: Int64; ASendDateTime: TDateTime);
  720. procedure TimerForLoginingTimer(Sender: TObject);
  721. procedure TimerForCheckLogoutTimeoutTimer(Sender: TObject);
  722. procedure actShowRemarkExecute(Sender: TObject);
  723. procedure actChangeRemarkExecute(Sender: TObject);
  724. procedure actHelpExecute(Sender: TObject);
  725. procedure actAboutExecute(Sender: TObject);
  726. procedure lblReConnectClick(Sender: TObject);
  727. procedure spbAutoLoginClick(Sender: TObject);
  728. procedure spbSavePasswordClick(Sender: TObject);
  729. procedure miOtherStateClick(Sender: TObject);
  730. procedure miMeetingClick(Sender: TObject);
  731. procedure miHiddenClick(Sender: TObject);
  732. procedure miOnlineClick(Sender: TObject);
  733. procedure ppLoginStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  734. procedure ppChangeStatesPopup(Sender: TObject);
  735. procedure spbLoginStateClick(Sender: TObject);
  736. procedure miClearLoginHistoryClick(Sender: TObject);
  737. procedure spbChangeLoginNameClick(Sender: TObject);
  738. procedure ppLoginedUsersPopup(Sender: TObject);
  739. procedure ppLoginedUsersGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  740. procedure edLoginNameChange(Sender: TObject);
  741. procedure lblRegisterMouseLeave(Sender: TObject);
  742. procedure lblRegisterMouseEnter(Sender: TObject);
  743. procedure actShowTeamHistoryExecute(Sender: TObject);
  744. procedure actShowHistoryExecute(Sender: TObject);
  745. procedure actAVSetExecute(Sender: TObject);
  746. procedure actMsgManagerExecute(Sender: TObject);
  747. procedure WebBrowserForAdvertisementBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  748. procedure RealICQClientReceivedSystemMessage(Sender: TObject; ASystemMessage: TRealICQSystemMessage);
  749. procedure TimerForShowSystemMessageTimer(Sender: TObject);
  750. procedure RealICQClientReceivedAdversement(Sender: TObject);
  751. procedure WebBrowserForAdvertisementDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  752. procedure RealICQClientDownloadTeamFace(Sender: TObject; AFileName: string);
  753. procedure RealICQClientPleaseUploadTeamFace(Sender: TObject; MD5String: string; var FileName: string);
  754. procedure RealICQClientReceivedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  755. procedure RealICQClientSendTeamMessageFailed(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  756. procedure RealICQClientSendedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  757. procedure RealICQClientJoinTeamResponse(Sender: TObject; ATeamID: string; ALoginName: string; ATag: string; AAcceptted: Boolean);
  758. procedure RealICQClientJoinTeamRequest(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName, ATag: string);
  759. procedure spbFindTeamClick(Sender: TObject);
  760. procedure RealICQClientTeamQuitted(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName: string);
  761. procedure RealICQClientTeamDisbanded(Sender: TObject; ARealICQTeam: TRealICQTeam);
  762. procedure actQuitOrDisbandTeamsExecute(Sender: TObject);
  763. procedure ppTeamListViewPopup(Sender: TObject);
  764. procedure ppTeamListViewGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  765. procedure actDisbandTeamExecute(Sender: TObject);
  766. procedure actQuitTeamExecute(Sender: TObject);
  767. procedure actSeeTeamInformationExecute(Sender: TObject);
  768. procedure actSendTeamMessageExecute(Sender: TObject);
  769. procedure RealICQClientJoinedTeam(Sender: TObject; ARealICQTeam: TRealICQTeam);
  770. procedure RealICQClientTeamInfoReady(Sender: TObject; ARealICQTeam: TRealICQTeam);
  771. procedure actCreateTeamExecute(Sender: TObject);
  772. procedure RealICQClientGettedCancelVideoTransmite(Sender: TObject; ALoginName: string);
  773. procedure RealICQClientGettedStopVideoTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  774. procedure RealICQClientSendedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  775. procedure RealICQClientGettedVideoTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  776. procedure RealICQClientGettedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  777. procedure RealICQClientGettedVideoTransmiteConnectted(Sender: TObject; ALoginName: string; ASendBigBmp, ARecvBigBmp: Boolean);
  778. procedure RealICQClientGettedAudioTransmiteConnectted(Sender: TObject; ALoginName: string);
  779. procedure RealICQClientGettedStopAudioTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  780. procedure RealICQClientGettedCancelAudioTransmite(Sender: TObject; ALoginName: string);
  781. procedure RealICQClientGettedAudioTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  782. procedure RealICQClientGettedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  783. procedure RealICQClientSendedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  784. procedure RealICQClientInputting(Sender: TObject; ALoginName: string; AInputting: Boolean);
  785. procedure actOpenRecvFileDirExecute(Sender: TObject);
  786. procedure actCustomFacesManagerExecute(Sender: TObject);
  787. procedure RealICQClientPleaseSendFaceToMe(Sender: TObject; ALoginName, AFaceMD5Code: string);
  788. procedure RealICQClientCancelSendFile(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  789. procedure RealICQClientSendedSendFileRequest(Sender, FileTransmitter: TObject);
  790. procedure RealICQClientGettedSendFileRequest(Sender: TObject; SendFileRequestInfo: TSendFileRequestInfo);
  791. procedure ApplicationEventsException(Sender: TObject; E: Exception);
  792. procedure RealICQClientDisconnected(Sender: TObject);
  793. procedure TimerForFlashTrayIconTimer(Sender: TObject);
  794. procedure RealICQClientReceivedMessage(Sender: TObject; RealICQMessage: TRealICQMessage);
  795. procedure RealICQClientSendMessageFailed(Sender: TObject; RealICQMessage: TRealICQMessage);
  796. procedure FormShow(Sender: TObject);
  797. procedure actShowGIFInTalkingFormExecute(Sender: TObject);
  798. procedure actShowGIFInMailFormExecute(Sender: TObject);
  799. procedure RealICQClientUserExInformationChanged(Sender: TObject; RealICQUser: TRealICQUser);
  800. procedure actSendMessageExecute(Sender: TObject);
  801. procedure RealICQClientDownloadFile(Sender: TObject; AFileName: string);
  802. procedure RealICQClientGetWebTabs(Sender: TObject; ATabCount: Integer; WebTabRecords: array of TWebTabRecord);
  803. procedure spbCancelFilterClick(Sender: TObject);
  804. procedure edFilterKeywordChange(Sender: TObject);
  805. procedure edFilterKeywordExit(Sender: TObject);
  806. procedure actSeeInformationExecute(Sender: TObject);
  807. procedure ppColorsPopup(Sender: TObject);
  808. procedure miMoreColorsClick(Sender: TObject);
  809. procedure ppColorsGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  810. procedure TrayIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  811. procedure actCloseExecute(Sender: TObject);
  812. procedure TrayIconClick(Sender: TObject);
  813. procedure TimerForCheckDblClickTimer(Sender: TObject);
  814. procedure ppTrayIconGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  815. procedure TrayIconDblClick(Sender: TObject);
  816. procedure actOpenMainFormExecute(Sender: TObject);
  817. procedure actQuitExecute(Sender: TObject);
  818. procedure FormResize(Sender: TObject);
  819. procedure ppChangeStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  820. procedure spbDisplayNameClick(Sender: TObject);
  821. procedure actAlwaysOnTopExecute(Sender: TObject);
  822. procedure actShowTeamsExecute(Sender: TObject);
  823. procedure actShowBlacklistsExecute(Sender: TObject);
  824. procedure actShowStrangersExecute(Sender: TObject);
  825. procedure actRemoveUserExecute(Sender: TObject);
  826. procedure RealICQClientAddedBlacklists(Sender: TObject; ALoginName: string);
  827. procedure RealICQClientGettedBlacklists(Sender: TObject);
  828. procedure actGroupManagerExecute(Sender: TObject);
  829. procedure actShowMiddleHeadImageExecute(Sender: TObject);
  830. procedure actShowGroupExecute(Sender: TObject);
  831. procedure RealICQClientRemovedUser(Sender: TObject; ALoginName: string);
  832. procedure ppUserItemRightMenuPopup(Sender: TObject);
  833. procedure ppUserItemRightMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  834. procedure actDelFriendExecute(Sender: TObject);
  835. procedure RealICQClientReConnectExecute(Sender: TObject; ASeconds: Integer);
  836. procedure btLoginClick(Sender: TObject);
  837. procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  838. procedure spbSelUIColorClick(Sender: TObject);
  839. procedure FormDestroy(Sender: TObject);
  840. procedure FormCreate(Sender: TObject);
  841. procedure RealICQClientLoginResult(Sender: TObject; LoginResultType: TRealICQLoginResultType; ResultMessage: string);
  842. procedure actLoginExecute(Sender: TObject);
  843. procedure actLogoutExecute(Sender: TObject);
  844. procedure actLoginAsExecute(Sender: TObject);
  845. procedure RealICQClientLoginStateChanged(Sender: TObject);
  846. procedure FormClose(Sender: TObject; var Action: TCloseAction);
  847. procedure RealICQClientGettedFriendList(Sender: TObject);
  848. procedure RealICQClientUserInformationReady(Sender: TObject; RealICQUser: TRealICQUser);
  849. procedure actOnlineExecute(Sender: TObject);
  850. procedure actHiddenExecute(Sender: TObject);
  851. procedure actLeaveExecute(Sender: TObject);
  852. procedure actOtherStateExecute(Sender: TObject);
  853. procedure RealICQClientBeDropped(Sender: TObject; Excuse: string);
  854. procedure RealICQClientLoginFailed(Sender: TObject; E: Exception);
  855. procedure actRegExecute(Sender: TObject);
  856. procedure actShowLoginNameExecute(Sender: TObject);
  857. procedure actShowDisplayNameExecute(Sender: TObject);
  858. procedure actShowAllNameExecute(Sender: TObject);
  859. procedure actShowBigHeadImageExecute(Sender: TObject);
  860. procedure actShowSmallHeadImageExecute(Sender: TObject);
  861. procedure actShowNormalHeadImageExecute(Sender: TObject);
  862. procedure actFindUsersExecute(Sender: TObject);
  863. procedure RealICQClientAddFriendRequest(Sender: TObject; ALoginName, ATag: string);
  864. procedure RealICQClientAddFriendResponse(Sender: TObject; ALoginName, ATag: string; AAcceptted: Boolean);
  865. procedure actOptionsExecute(Sender: TObject);
  866. procedure actPersonalSetExecute(Sender: TObject);
  867. procedure actConnectSetExecute(Sender: TObject);
  868. procedure actChangePassExecute(Sender: TObject);
  869. procedure actShowTreeExecute(Sender: TObject);
  870. procedure edWebSearchKeyWordEnter(Sender: TObject);
  871. procedure edWebSearchKeyWordExit(Sender: TObject);
  872. procedure spbWebSearchClick(Sender: TObject);
  873. procedure edWebSearchKeyWordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  874. procedure RealICQClientShakeWindow(Sender: TObject; ALoginName: string);
  875. procedure ppContacterViewStyleGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  876. procedure spbContacterViewStyleClick(Sender: TObject);
  877. procedure spbWatchwordClick(Sender: TObject);
  878. procedure edWatchwordExit(Sender: TObject);
  879. procedure edWatchwordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  880. procedure ApplicationEventsDeactivate(Sender: TObject);
  881. procedure ppLanguagesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  882. procedure ppLanguagesPopup(Sender: TObject);
  883. procedure spbSelLanguageClick(Sender: TObject);
  884. procedure edPasswordEnter(Sender: TObject);
  885. procedure TimerForHideMainFormTimer(Sender: TObject);
  886. //procedure TimerForShowMainFormTimer(Sender: TObject);
  887. procedure FormDeactivate(Sender: TObject);
  888. procedure sbpSMSClick(Sender: TObject);
  889. procedure RealICQClientSMSResult(Sender: TObject; AMessageID: Cardinal; AResult: Integer);
  890. procedure RealICQClientReceivedSMS(Sender: TObject; ASMSSender, ASMSContent: string; ASMSDateTime: TDateTime);
  891. procedure RealICQClientReceivedCustomMessage(Sender: TObject; AContent: string);
  892. procedure spbEmailClick(Sender: TObject);
  893. procedure tsNetWorkDiskShow(Sender: TObject);
  894. procedure RealICQNetWorkDiskClientConnectStateChanged(Sender: TObject);
  895. procedure RealICQNetWorkDiskClientLoginFailed(Sender: TObject; E: Exception);
  896. procedure RealICQNetWorkDiskClientLoginResult(Sender: TObject; LoginResultType: Byte);
  897. procedure spbNDConnectClick(Sender: TObject);
  898. procedure RealICQNetWorkDiskClientDirectoryListReady(Sender: TObject);
  899. procedure spbNDMoveUpClick(Sender: TObject);
  900. procedure spbNDNewDirClick(Sender: TObject);
  901. procedure RealICQNetWorkDiskClientNewDirResult(Sender: TObject; Directory: TRealICQNetWorkDiskDirectory);
  902. procedure ppNetWorkFileGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  903. procedure ppNetWorkFilePopup(Sender: TObject);
  904. procedure spbNDDeleteClick(Sender: TObject);
  905. procedure miNDRenameClick(Sender: TObject);
  906. procedure RealICQNetWorkDiskClientRenamedDir(Sender: TObject; ADirectory: TRealICQNetWorkDiskDirectory);
  907. procedure RealICQNetWorkDiskClientRenamedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile);
  908. procedure RealICQNetWorkDiskClientDeleteResult(Sender: TObject; AList: string);
  909. procedure spbNDRefreshClick(Sender: TObject);
  910. procedure spbNDUploadClick(Sender: TObject);
  911. procedure RealICQNetWorkDiskClientUploadedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile; AMissionID: string);
  912. procedure TabSetNDMissionsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
  913. procedure TabSetNDMissionsClick(Sender: TObject);
  914. procedure RealICQNetWorkDiskClientUploadFileAborted(Sender: TObject; AMissionID: string);
  915. procedure RealICQNetWorkDiskClientUploadingFile(Sender: TObject; ATransmitter: TResponsionStreamTransmitter; ATransmittedSize: Int64);
  916. procedure ppNetWorkMissonGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  917. procedure ppNetWorkMissonPopup(Sender: TObject);
  918. procedure miNDCancelClick(Sender: TObject);
  919. procedure RealICQNetWorkDiskClientGettedUsedSpaceSize(Sender: TObject);
  920. procedure spbNDCancelAllClick(Sender: TObject);
  921. procedure RealICQNetWorkDiskClientNoSpace(Sender: TObject);
  922. procedure spbNDDisconnectClick(Sender: TObject);
  923. procedure RealICQNetWorkDiskClientDownloadFileAborted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  924. procedure RealICQNetWorkDiskClientDownloadFileCompleted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  925. procedure spbNDDownloadClick(Sender: TObject);
  926. procedure RealICQNetWorkDiskClientDownloadFileTransmitting(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  927. procedure pgcMainWorkAreaTabChanging(Sender: TObject; NewIndex: Integer; var AllowChanged: Boolean);
  928. procedure TabSetMuiltWebClick(Sender: TObject);
  929. procedure spbShowHideRightClick(Sender: TObject);
  930. procedure cbxURLInputerDropDown(Sender: TObject);
  931. procedure spbGoClick(Sender: TObject);
  932. procedure cbxURLInputerKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  933. procedure cbxURLInputerSelect(Sender: TObject);
  934. procedure spbPrevClick(Sender: TObject);
  935. procedure spbStopClick(Sender: TObject);
  936. procedure spbNextClick(Sender: TObject);
  937. procedure spbRefreshClick(Sender: TObject);
  938. procedure spbAddToNAClick(Sender: TObject);
  939. procedure spbPrintPrevClick(Sender: TObject);
  940. procedure spbWebCloseClick(Sender: TObject);
  941. procedure sbpNewWebTabClick(Sender: TObject);
  942. procedure TabSetMuiltWebGetImageIndex(Sender: TObject; TabIndex: Integer; var ImageIndex: Integer);
  943. procedure ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean);
  944. procedure RealICQClientReceivedOfflineAutoResponseSet(Sender: TObject; AEnabled: Boolean; AText: string);
  945. procedure actOfflieAutoResponseExecute(Sender: TObject);
  946. procedure RealICQClientUsersBranchReady(Sender: TObject);
  947. procedure WebBrowserForContactersBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  948. procedure RealICQClientGettedSysMsgInterfaces(Sender: TObject);
  949. procedure RealICQClientGettedCanSendSMSCount(Sender: TObject);
  950. // procedure ImgQrCodeClick(Sender: TObject);
  951. procedure SysMsgClick(Sender: TObject);
  952. procedure btnCALoginClick(Sender: TObject);
  953. procedure btOAClick(Sender: TObject);
  954. procedure btSwapClick(Sender: TObject);
  955. //procedure TimerForShowHideMainFrmTimer(Sender: TObject);
  956. private
  957. FIsLogout: Boolean;
  958. FLastGetSystemNoticesTicket: Cardinal;
  959. FSystemNoticeIndex: Integer;
  960. FSystemNotices: TList;
  961. FNotAddedEmployeeList: TStringList;
  962. procedure ShowBranchAndUsers(ExpandSelfNode: Boolean = False);
  963. procedure ShowBranchAndFriends;
  964. procedure GetOtherBranchs;
  965. procedure GetBranchUser(Branch: TRealICQBranch);
  966. procedure ShowSystemNotices;
  967. procedure OpenNewWorkDisk(Path: string);
  968. private
  969. FFilter: Boolean;
  970. FKeyList: TStrings;
  971. FProductType: TRealICQProductType;
  972. FUserType: TRealICQUserType;
  973. FCurrentServerID: string;
  974. FTopSystemMessage: TRealICQSystemMessage;
  975. FServerInfoList: TStringList;
  976. FWebPanels: TStringList;
  977. FAutoHide: Boolean;
  978. FNewConsole: Boolean;
  979. FAutoShowRequestMessage: Boolean;
  980. FMovingMainForm: Boolean;
  981. FWindowMoveing: Boolean;
  982. //FDblClickedTrayIcon: Boolean;
  983. FMainFormHidden: Boolean;
  984. FHidePosition: THidePosition;
  985. FConfirmReplaceResult: Integer;
  986. FLastDownloadDirectory: string;
  987. FAddrBookURL: string;
  988. // FPCAMessage:TPCAMessage;
  989. // FGroupAddress: string;
  990. // FGroupPort: Integer;
  991. // FGroupImagePort: Integer;
  992. // FGroupShareAddress: string;
  993. // FGroupSharePort: Integer;
  994. //procedure PostUpdateLog;
  995. procedure GetWeather(City, Weatheren, Weather: string);
  996. procedure WMMoving(var Msg: TWMMoving); message WM_MOVING;
  997. procedure WMSizing(var Msg: TMessage); message WM_SIZING;
  998. procedure WMSize(var Msg: TMessage); message WM_SIZE;
  999. procedure WMMove(var Msg: TMessage); message WM_MOVE;
  1000. procedure WMNCMouseMove(var msg: TWMNCMousemove); message WM_NCMOUSEMOVE;
  1001. procedure WindowMove(blnShow: Boolean; iBase: Integer);
  1002. procedure AddUploadMission(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string; CheckMission: Boolean = True);
  1003. procedure CheckUploadMissions;
  1004. procedure GoNextLevelUploadMissions(UploadMission: TUploadMission);
  1005. procedure CheckNDControlState;
  1006. procedure AddDownloadMission(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = ''; CheckMission: Boolean = True);
  1007. procedure CheckDownloadMissions;
  1008. procedure ShowNetWorkDiskSpaceInfo;
  1009. procedure WebBrowserRightStatusTextChange(ASender: TObject; const Text: WideString);
  1010. procedure WebBrowserRightTitleChange(ASender: TObject; const Text: WideString);
  1011. procedure WebBrowserRightDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  1012. procedure WebBrowserRightDocumentCompleteForPost(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  1013. procedure WebBrowserRightNewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
  1014. procedure WebBrowserRightWindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
  1015. public
  1016. MessageBoxForm: TMessageBoxForm;
  1017. property WebPanels: TStringList read FWebPanels;
  1018. procedure LoadWebPanelsFromXML;
  1019. procedure SaveWebPanelsToXML;
  1020. procedure ShowWebTabs;
  1021. procedure HideMainForm;
  1022. procedure ShowMainForm;
  1023. function AddWebBrowserToPageControl(AUrl: string; WebPanelTag: Integer = -1): TWebBrowser;
  1024. procedure OpenNotReadMessage(iIndex: Integer);
  1025. procedure SaveBranchUserDataToXML(FileName: string);
  1026. procedure UpdatePostLogState(Status: Boolean);
  1027. procedure ShowOrHideMuiltiWeb;
  1028. private
  1029. //FDownFile: TDownFile;
  1030. {通讯录}
  1031. FCutNode: TTreeNode;
  1032. FManageGroupMsgList: TStringList;
  1033. FManageGroupMemberMsgList: TStringList;
  1034. {通讯录}
  1035. FGetUsersTask: TStringList;
  1036. FHintWindow: TSingleBorderHintWindow;
  1037. ActiveButtonTag: Integer;
  1038. FToolBarButtonList: TStringList;
  1039. FToolBarButtonIconList: TStringList;
  1040. FFriendInfo: TStringList; //存储从好友列表移动到黑名单的好友信息
  1041. FLoginAsSavePassword, FSavePassword, FAutoLogin: Boolean;
  1042. FLoginState: TRealICQLoginState;
  1043. FLeaveMessage: string;
  1044. FCanAlert, FHidden: Boolean;
  1045. FUIMainColor: TColor;
  1046. FShowGroup: Boolean;
  1047. FGroups: TStringList;
  1048. FLVSelectedItemBorderColor: TColor;
  1049. FLVSelectedItemBorderInnerColor: TColor;
  1050. FLVSelectedItemBackColor: TColor;
  1051. FLVHeadImageBorderColor: TColor;
  1052. FLVHeadImageBackColor: TColor;
  1053. FLVStyle: TRealICQContacterListItemStyle;
  1054. FLVCaptionStyle: TRealICQContacterListItemCaptionStyle;
  1055. FShowTree: Boolean; //是否以树型方式组织联系人列表
  1056. FShowStrangers: Boolean;
  1057. FShowBlacklists: Boolean;
  1058. FShowTeams: Boolean;
  1059. FShowLatests: Boolean;
  1060. FShowGIFInMailForm: Boolean;
  1061. FShowGIFInTalkingForm: Boolean;
  1062. FFlashTrayIconIndex: Integer;
  1063. FFlashTrayIconIndexAtLogining: Integer;
  1064. FAlwaysOnTop: Boolean;
  1065. FTalkingFormAlwaysOnTop: Boolean;
  1066. FCtrlEnterSendMessage: Boolean;
  1067. FCopyScreenHideTalkForm: Boolean;
  1068. FReadMessageHotKey: string; // Cardinal;
  1069. FCopyScreenHotKey: string; // Cardinal;
  1070. FMainFormLeft: Integer;
  1071. FMainFormTop: Integer;
  1072. FMainFormWidth: Integer;
  1073. FMainFormHeight: Integer;
  1074. FTalkingFormLeft: Integer;
  1075. FTalkingFormTop: Integer;
  1076. FTalkingFormWidth: Integer;
  1077. FTalkingFormHeight: Integer;
  1078. FTalkingRightWidth: Integer;
  1079. FSMSFormLeft, FSMSFormTop, FSMSFormWidth, FSMSFormHeight: Integer;
  1080. FConfirmSendOfflineFile: Boolean;
  1081. FShowMainFormOnStart: Boolean;
  1082. FCursorPosX: Integer;
  1083. FCursorPosY: Integer;
  1084. FLastDBlClickTicket: Cardinal;
  1085. FNeedShowUserCardLoginName: string;
  1086. FShowUserCardTargetTop: Integer;
  1087. FWebTabs: TList;
  1088. //未处理的系统消息集合
  1089. FSystemMessages: TList;
  1090. FLastSearchKeyWord: string;
  1091. // FLastActiveIndex: Integer;
  1092. FSearchListViewInVisible: Boolean;
  1093. FSearchListView: TRealICQContacterListView;
  1094. FSearchMoreUserListView: TRealICQContacterListView;
  1095. //显示系统消息的ListView
  1096. FLVSystemMessage: TRealICQContacterListView;
  1097. //显示群组列表的ListView
  1098. FLVTeams: TRealICQContacterListView;
  1099. //显示最近联系人列表的ListView
  1100. FLVNetWorkDisk: TRealICQContacterListView;
  1101. FLVNetWorkDiskUploadingFiles: TRealICQContacterListView;
  1102. FLVNetWorkDiskDownloadingFiles: TRealICQContacterListView;
  1103. //客服最近联系列表w
  1104. FTVCustomerLatests: TRealICQContacterTreeView;
  1105. FLVCustomers: TRealICQContacterListView;
  1106. FContacterListViews: TStringList;
  1107. FContacterTreeViews: TStringList;
  1108. FTrayIconRect: TRect;
  1109. FGettedTrayIconRect: Boolean;
  1110. FInputFont: TFont;
  1111. FSystemFaceCount: Integer;
  1112. FFaceList, FTempFaceList, FFaceCategory: TStringList;
  1113. FShowHintOnOnline: Boolean;
  1114. FShowHintOnOffline: Boolean;
  1115. FDontShowHintOnBusy: Boolean;
  1116. FPlaySoundOnOnline: Boolean;
  1117. FPlaySoundOnOffline: Boolean;
  1118. FPlaySoundOnGetMessage: Boolean;
  1119. FPlaySoundOnGetSystemMessage: Boolean;
  1120. FFlashCaptionOnOnline: Boolean;
  1121. FFlashImageOnGetMessage: Boolean;
  1122. FShowShakeWindow: Boolean;
  1123. FShowCustomMessage: Boolean;
  1124. FShowFileTransCompleted: Boolean;
  1125. FOnlineEventSound: string;
  1126. FOfflineEventSound: string;
  1127. FMessageEventSound: string;
  1128. FSystemMessageEventSound: string;
  1129. FRecvFileSafeLevel: TRecvFileSafeLevel;
  1130. FAllowURL: Boolean;
  1131. FAutoSaveMessage: Boolean;
  1132. FShowHistoryInNewWindow: Boolean;
  1133. FAutoUpdate: Boolean;
  1134. FRecvFileDir: string;
  1135. FUseCacheDir: Boolean;
  1136. FCacheDir: string;
  1137. FLimitCacheDirSize: Boolean;
  1138. FMaxCacheDirSize: Integer;
  1139. FAudoDeleteCacheFile: Boolean;
  1140. FAudoDeleteCacheFileDate: Integer;
  1141. FScanVirus: Boolean;
  1142. FScanVirusProgram: string;
  1143. FDontUseCacheFileOnBigFile: Boolean;
  1144. FDontUseCacheFileOnBigFileSize: Integer;
  1145. //读取/保存历史记录的对象
  1146. FDBHistory: TRealICQDBHistory;
  1147. FOfflineAutoResponseTexts: TStringList;
  1148. CLOSEWINDOWS: UINT; //接收别的进程发送的退出程序的消息
  1149. procedure DownFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  1150. procedure DownFaceFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  1151. procedure QuitWindows();
  1152. procedure ShowFriendLists;
  1153. procedure ShowBlacklists;
  1154. procedure CheckCacheDir;
  1155. procedure LoadOfflineAutoResponseSets;
  1156. //读取最近的联系人列表
  1157. procedure LoadLatests;
  1158. procedure AddMessageHistory(ASystemMessageType: TSystemMessageType; ASimpleMessage: string; ASystemMessage: TRealICQSystemMessage);
  1159. function GetSelectedLoginName: string;
  1160. procedure SetTalkingFormAlwaysOnTop(Value: Boolean);
  1161. procedure SetCtrlEnterSendMessage(Value: Boolean);
  1162. procedure SetCopyScreenHideTalkForm(Value: Boolean);
  1163. procedure SetSearchListViewVisible(AShow: Boolean);
  1164. procedure SetUIState;
  1165. procedure SetLoginControlsVisible(Value: Boolean);
  1166. procedure SetLoginStateControlState;
  1167. procedure LoadMainTabImage;
  1168. procedure LoadHintAndSoundConfigs;
  1169. procedure LoadReceiveFileConfigs;
  1170. procedure LoadSafeConfigs;
  1171. procedure LoadGroupConfigs;
  1172. procedure SaveIfShowGroupConfig;
  1173. procedure ShowGroupInterface;
  1174. procedure LoadStyleConfigs;
  1175. procedure SaveStyleConfigs;
  1176. procedure LoadHotKeyConfigs;
  1177. procedure SaveHotKeyConfigs;
  1178. procedure SetReadMessageHotKey(Value: string);
  1179. procedure SetCopyScreenHotKey(Value: string);
  1180. procedure LoadDefaultConfigs;
  1181. procedure LoadAutoUpdateConfigs;
  1182. procedure LoadInputConfigs;
  1183. procedure SaveInputFontConfig;
  1184. //procedure LoadGroupConfig;
  1185. function GetSystemMessageCounter(AMessageID: Integer): Integer;
  1186. procedure IncSystemMessageCounter(AMessageID: Integer);
  1187. procedure SetInputFont(Value: TFont);
  1188. procedure SetShowGroup(Value: Boolean);
  1189. function GetListViewByLoginName(ALoginName: string; AOnlyInGroups: Boolean = False): TRealICQContacterListView;
  1190. procedure SetFlashCaptionOnOnlineValue(Value: Boolean);
  1191. procedure SetLoginStateMenuChecked;
  1192. procedure SetStyleMenuChecked;
  1193. procedure miChangeLoginNameClick(Sender: TObject);
  1194. procedure miChangeServerClick(Sender: TObject);
  1195. procedure miMoveGroupClick(Sender: TObject);
  1196. procedure miMoveToBlacklistsClick(Sender: TObject);
  1197. procedure miMoveToStrangersClick(Sender: TObject);
  1198. procedure ItemShowHint(Sender: TObject; Item: TRealICQContacterListItem; var HintStr: string);
  1199. procedure NDItemDoubleClick(Item: TRealICQContacterListItem);
  1200. procedure NDSelectItemChanged(Item: TRealICQContacterListItem);
  1201. procedure NDMissionItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1202. procedure NDMissionDropFiles(Sender: TObject; var Message: TMessage);
  1203. procedure NDItemMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1204. procedure NodeBranchClick(Sender: TObject; Branch: TRealICQBranch);
  1205. procedure NodeOnline(Employee: TRealICQEmployee);
  1206. procedure NodeOffline(Employee: TRealICQEmployee);
  1207. procedure NodeDoubleClick(Employee: TRealICQEmployee);
  1208. procedure NodeIconButtonClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  1209. procedure NodeIconButtonDblClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  1210. procedure NodeOnMouseEnter(Employee: TRealICQEmployee);
  1211. procedure NodeOnMouseLeave(Employee: TRealICQEmployee);
  1212. {通讯录}
  1213. procedure NodeGroupClick(Sender: TObject; Group: TRealICQBranch);
  1214. procedure GetChildsGroupId(GroupId: string; var Groups: string);
  1215. procedure GettedAddrBookUsers(Sender: TObject);
  1216. procedure GettedAddrBookUsers1(Sender: TObject);
  1217. procedure GettedAddrBookGroups(Sender: TObject);
  1218. procedure LoadAddrBook(ExpandGroupId: string);
  1219. procedure GettedManageAddrBookResult(Sender: TObject; OperatModal: Integer; OperatCommand: Integer; RetValue, MessageId: Cardinal);
  1220. function GetGroupUsers(GroupId: string): Integer;
  1221. function GetAddrBookUserIndex(GroupId, LoginName: string): Integer;
  1222. function GetAddrBookUser(GroupId, LoginName: string): TRealICQUser;
  1223. {通讯录}
  1224. procedure miSkinClick(Sender: TObject);
  1225. procedure miColorClick(Sender: TObject);
  1226. procedure WebTabShow(Sender: TObject);
  1227. procedure miLanguageClick(Sender: TObject);
  1228. private
  1229. FCheckedUpdate: Boolean;
  1230. TabAcountIndex: Integer;
  1231. FNotReadMessages: TStringList; {未读消息}
  1232. HotKeyID_ReadMessage: Integer;
  1233. HotKeyID_CopyScreen: Integer;
  1234. procedure WMHotKeyHandle(var Msg: TWMHotKey); message WM_HotKey;
  1235. procedure ShowRealICQMessage(RealICQMessage: TRealICQMessage; ShowSendFailed: Boolean; ARealICQClient: TRealICQClient);
  1236. procedure ShowSystemMessage(ASystemMessage: TRealICQSystemMessage);
  1237. procedure SetShowMainFormOnStart(Value: Boolean);
  1238. procedure SaveWindowState;
  1239. function GetBitmapFromFileExt(AFileName: string): string;
  1240. protected
  1241. procedure ChangeLanguage(ALanguageIniFile: string); override;
  1242. procedure Post(stURL, stPostData: string; var wbWebBrowser: TWebBrowser);
  1243. procedure WMQueryEndSession(var message: TWMQUERYENDSESSION); message WM_QUERYENDSESSION;
  1244. procedure WMPowerBroadcast(var message: TMessage); message WM_POWERBROADCAST;
  1245. procedure CMWininichange(var Message: TWMWinIniChange); message CM_WININICHANGE;
  1246. procedure WndProc(var Message: TMessage); override;
  1247. procedure CreateParams(var Params: TCreateParams); override;
  1248. public
  1249. FLVLatests: TRealICQContacterListView;
  1250. constructor Create(AOwner: TComponent); override;
  1251. procedure ChangeUIColor(AColor: TColor); override;
  1252. procedure ChangePPMenuColorMap(PopupMenuEx: TCustomActionPopupMenuEx);
  1253. procedure NodeOnHeadImageMouseEnter(Employee: TRealICQEmployee);
  1254. procedure NodeOnHeadImageMouseLeave(Employee: TRealICQEmployee);
  1255. procedure ShowMeInformation;
  1256. procedure ShowUserCardForm(ALoginName: string; ATargetTop: Integer);
  1257. procedure HideUserCardForm;
  1258. procedure UpdateAddrBookInfo(RealICQUser: TRealICQUser);
  1259. //function GetDefaultBrowser: string; //获取默认浏览器
  1260. procedure ShowRealICQTeamMessage(RealICQTeamMessage: TRealICQTeamMessage; ShowSendFailed: Boolean);
  1261. procedure WebSocketRemoveTeamResponse(aTeamID: string);
  1262. procedure WebSocketQuitTeam(aTeamID: string);
  1263. procedure WebSocketSendReadTeamInfo(aTeamID: string);
  1264. procedure WebSocketRecivedbroadcastmesssage(aID, aGroupID, aSayer, aStyle, aMsg: string; aTimesTamp: TDateTime);
  1265. procedure WebSocketJionTeamRequest(TeamID, ALoginName, ATag: string);
  1266. procedure DownLoadUpdateConfig;
  1267. procedure OpenWebTab(TabSheet: TTabSheet; WebPanel: TWebPanel; AcountIndex: Integer);
  1268. procedure UploadWebTabAccounts;
  1269. procedure GetBranchEmpOnlineAndSum(Branchs: TStringList; BranchInfo: TRealICQBranchInfo; var OnlineEmployee, EmployeeCount: Integer);
  1270. function GetBranchName(LoginName: string): string;
  1271. function GetCompany: string;
  1272. procedure StopHeadImageFlash(AID: string);
  1273. {通讯录}
  1274. function GetGroupUserCount: Integer;
  1275. procedure SaveContacter(Name, Mobile, Tel, Email, Remark, BranchId: string);
  1276. procedure GetParentGroupNameList(BranchInfo: TRealICQBranchInfo; var Groups: string);
  1277. procedure CreateManageGroupMessage(GroupId, GroupName, ParentId, MessageId: string);
  1278. procedure CreateManageGroupMemberMessage(ID, DisplayName, NickName, Mobile, Tel, Email, Remark, GroupId, MessageId: string);
  1279. {通讯录}
  1280. procedure ItemOnline(Item: TRealICQContacterListItem);
  1281. procedure ItemOffline(Item: TRealICQContacterListItem);
  1282. procedure ItemDoubleClick(Item: TRealICQContacterListItem);
  1283. procedure ItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1284. procedure ItemIconButtonDblClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  1285. procedure ItemOnMouseEnter(Item: TRealICQContacterListItem);
  1286. procedure ItemOnMouseLeave(Item: TRealICQContacterListItem);
  1287. procedure ItemOnHeadImageEnter(Item: TRealICQContacterListItem);
  1288. procedure ItemOnHeadImageLeave(Item: TRealICQContacterListItem);
  1289. procedure SetToolBarState(Sender: TObject);
  1290. function GetActiveTabSheetName: string;
  1291. function AddFriendTreeView(AOwner: TWinControl; GroupName: string): Integer;
  1292. function AddContacterListView(AOwner: TWinControl; GroupName: string): Integer;
  1293. function AddContacterTreeView(AOwner: TWinControl; GroupName: string): Integer;
  1294. procedure UpdateContacterListView(RealICQContacterListView: TRealICQContacterListView);
  1295. procedure CheckWindowPositon;
  1296. //procedure BindUserDataToItem(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; ANeedFlash: Boolean = True);
  1297. //procedure BindUserDataToItemForGroup(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AGroupAlias: string; ANeedFlash: Boolean = True);
  1298. //procedure UpdateEmployeeNode(Employee: TRealICQEmployee; RealICQUser: TRealICQUser; ANeedFlash: Boolean);
  1299. //procedure UpdateFriendNode(Friend: TRealICQEmployee; RealICQUser: TRealICQUser; ANeedFlash: Boolean);
  1300. procedure StopFlash(ALoginName: string);
  1301. procedure StopFlashTeam(ATeamID: string);
  1302. procedure SetGetMoreUserEvent;
  1303. procedure SaveDefaultConfigs;
  1304. // procedure LoadSysMsgInterfaceConfig;
  1305. // procedure SaveSysMsgInterfaceConfig;
  1306. property ProductType: TRealICQProductType read FProductType write FProductType;
  1307. property UserType: TRealICQUserType read FUserType write FUserType;
  1308. property Filter: Boolean read FFilter write FFilter;
  1309. property KeyList: TStrings read FKeyList write FKeyList;
  1310. procedure SaveGroupConfigs;
  1311. procedure SaveHintAndSoundConfigs;
  1312. procedure SaveCustomFaceConfig;
  1313. procedure SaveReceiveFileConfigs;
  1314. procedure SaveSafeConfigs;
  1315. procedure SaveAutoUpdateConfigs;
  1316. procedure SaveOfflineAutoResponseSets;
  1317. procedure SetDOMStyle(Doc: IHTMLDocument2);
  1318. procedure OpenMessagesManagerForm;
  1319. property ServerInfoList: TStringList read FServerInfoList write FServerInfoList;
  1320. property ContacterListViews: TStringList read FContacterListViews;
  1321. property ContacterTreeViews: TStringList read FContacterTreeViews;
  1322. property ListViewLatests: TRealICQContacterListView read FLVLatests;
  1323. property CurrentServerID: string read FCurrentServerID;
  1324. property UIMainColor: TColor read FUIMainColor;
  1325. property CanAlert: Boolean read FCanAlert;
  1326. property OfflineAutoResponseTexts: TStringList read FOfflineAutoResponseTexts write FOfflineAutoResponseTexts;
  1327. property ShowGroup: Boolean read FShowGroup write SetShowGroup;
  1328. property Groups: TStringList read FGroups write FGroups;
  1329. property TalkingFormAlwaysOnTop: Boolean read FTalkingFormAlwaysOnTop write SetTalkingFormAlwaysOnTop;
  1330. property CtrlEnterSendMessage: Boolean read FCtrlEnterSendMessage write SetCtrlEnterSendMessage;
  1331. property CopyScreenHideTalkForm: Boolean read FCopyScreenHideTalkForm write SetCopyScreenHideTalkForm;
  1332. property InputFont: TFont read FInputFont write SetInputFont;
  1333. property FaceList: TStringList read FFaceList;
  1334. property TempFaceList: TStringList read FTempFaceList;
  1335. property FaceCategory: TStringList read FFaceCategory;
  1336. property SystemFaceCount: Integer read FSystemFaceCount;
  1337. property ShowGIFInMailForm: Boolean read FShowGIFInMailForm;
  1338. property ShowGIFInTalkingForm: Boolean read FShowGIFInTalkingForm;
  1339. property NotReadMessages: TStringList read FNotReadMessages;
  1340. property TalkingFormLeft: Integer read FTalkingFormLeft write FTalkingFormLeft;
  1341. property TalkingFormTop: Integer read FTalkingFormTop write FTalkingFormTop;
  1342. property TalkingFormWidth: Integer read FTalkingFormWidth write FTalkingFormWidth;
  1343. property TalkingFormHeight: Integer read FTalkingFormHeight write FTalkingFormHeight;
  1344. property TalkingRightWidth: Integer read FTalkingRightWidth write FTalkingRightWidth;
  1345. property SMSFormLeft: Integer read FSMSFormLeft write FSMSFormLeft;
  1346. property SMSFormTop: Integer read FSMSFormTop write FSMSFormTop;
  1347. property SMSFormWidth: Integer read FSMSFormWidth write FSMSFormWidth;
  1348. property SMSFormHeight: Integer read FSMSFormHeight write FSMSFormHeight;
  1349. property ShowMainFormOnStart: Boolean read FShowMainFormOnStart write SetShowMainFormOnStart;
  1350. property ConfirmSendOfflineFile: Boolean read FConfirmSendOfflineFile write FConfirmSendOfflineFile;
  1351. property AlwaysOnTop: Boolean read FAlwaysOnTop write FAlwaysOnTop;
  1352. property AutoHide: Boolean read FAutoHide write FAutoHide;
  1353. property AutoShowRequestMessage: Boolean read FAutoShowRequestMessage write FAutoShowRequestMessage;
  1354. property ShowHintOnOnline: Boolean read FShowHintOnOnline write FShowHintOnOnline;
  1355. property ShowHintOnOffline: Boolean read FShowHintOnOffline write FShowHintOnOffline;
  1356. property DontShowHintOnBusy: Boolean read FDontShowHintOnBusy write FDontShowHintOnBusy;
  1357. property PlaySoundOnOnline: Boolean read FPlaySoundOnOnline write FPlaySoundOnOnline;
  1358. property PlaySoundOnOffline: Boolean read FPlaySoundOnOffline write FPlaySoundOnOffline;
  1359. property PlaySoundOnGetMessage: Boolean read FPlaySoundOnGetMessage write FPlaySoundOnGetMessage;
  1360. property PlaySoundOnGetSystemMessage: Boolean read FPlaySoundOnGetSystemMessage write FPlaySoundOnGetSystemMessage;
  1361. property FlashCaptionOnOnline: Boolean read FFlashCaptionOnOnline write FFlashCaptionOnOnline;
  1362. property FlashImageOnGetMessage: Boolean read FFlashImageOnGetMessage write FFlashImageOnGetMessage;
  1363. property ShowShakeWindow: Boolean read FShowShakeWindow write FShowShakeWindow;
  1364. property ShowCustomMessage: Boolean read FShowCustomMessage write FShowCustomMessage;
  1365. property ShowFileTransCompleted: Boolean read FShowFileTransCompleted write FShowFileTransCompleted;
  1366. property OnlineEventSound: string read FOnlineEventSound write FOnlineEventSound;
  1367. property OfflineEventSound: string read FOfflineEventSound write FOfflineEventSound;
  1368. property MessageEventSound: string read FMessageEventSound write FMessageEventSound;
  1369. property SystemMessageEventSound: string read FSystemMessageEventSound write FSystemMessageEventSound;
  1370. property RecvFileDir: string read FRecvFileDir write FRecvFileDir;
  1371. property UseCacheDir: Boolean read FUseCacheDir write FUseCacheDir;
  1372. property CacheDir: string read FCacheDir write FCacheDir;
  1373. property LimitCacheDirSize: Boolean read FLimitCacheDirSize write FLimitCacheDirSize;
  1374. property MaxCacheDirSize: Integer read FMaxCacheDirSize write FMaxCacheDirSize;
  1375. property AudoDeleteCacheFile: Boolean read FAudoDeleteCacheFile write FAudoDeleteCacheFile;
  1376. property AudoDeleteCacheFileDate: Integer read FAudoDeleteCacheFileDate write FAudoDeleteCacheFileDate;
  1377. property ScanVirus: Boolean read FScanVirus write FScanVirus;
  1378. property ScanVirusProgram: string read FScanVirusProgram write FScanVirusProgram;
  1379. property DontUseCacheFileOnBigFile: Boolean read FDontUseCacheFileOnBigFile write FDontUseCacheFileOnBigFile;
  1380. property DontUseCacheFileOnBigFileSize: Integer read FDontUseCacheFileOnBigFileSize write FDontUseCacheFileOnBigFileSize;
  1381. property RecvFileSafeLevel: TRecvFileSafeLevel read FRecvFileSafeLevel write FRecvFileSafeLevel;
  1382. property AllowURL: Boolean read FAllowURL write FAllowURL;
  1383. property AutoSaveMessage: Boolean read FAutoSaveMessage write FAutoSaveMessage;
  1384. property ShowHistoryInNewWindow: Boolean read FShowHistoryInNewWindow write FShowHistoryInNewWindow;
  1385. property ReadMessageHotKey: string read FReadMessageHotKey write SetReadMessageHotKey;
  1386. property CopyScreenHotKey: string read FCopyScreenHotKey write SetCopyScreenHotKey;
  1387. property AutoUpdate: Boolean read FAutoUpdate write FAutoUpdate;
  1388. property AddrBookURL: string read FAddrBookURL write FAddrBookURL;
  1389. property DBHistory: TRealICQDBHistory read FDBHistory;
  1390. // property GroupAddress: string read FGroupAddress write FGroupAddress;
  1391. // property GroupPort: Integer read FGroupPort write FGroupPort;
  1392. // property GroupImagePort: Integer read FGroupImagePort write FGroupImagePort;
  1393. // property GroupShareAddress: string read FGroupShareAddress write FGroupShareAddress;
  1394. // property GroupSharePort: Integer read FGroupSharePort write FGroupSharePort;
  1395. end;
  1396. TUploadMission = class
  1397. private
  1398. FID: string;
  1399. FUploadMissionType: TNDMissionType;
  1400. FDirectoryID: Integer;
  1401. FName: string;
  1402. public
  1403. constructor Create(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string);
  1404. destructor Destroy; override;
  1405. property ID: string read FID;
  1406. property UploadMissionType: TNDMissionType read FUploadMissionType;
  1407. property DirectoryID: Integer read FDirectoryID;
  1408. property Name: string read FName;
  1409. end;
  1410. TDownloadMission = class
  1411. FID: string;
  1412. FDownloadMissionType: TNDMissionType;
  1413. FFileID: Integer;
  1414. FFileName: string;
  1415. FDirectoryName: string;
  1416. public
  1417. constructor Create(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = '');
  1418. destructor Destroy; override;
  1419. property ID: string read FID;
  1420. property DownloadMissionType: TNDMissionType read FDownloadMissionType;
  1421. property FileID: Integer read FFileID;
  1422. property FileName: string read FFileName;
  1423. property DirectoryName: string read FDirectoryName;
  1424. end;
  1425. TNavigateType = (ntGET, ntPOST, ntFill);
  1426. //WEB标签面版数据
  1427. TWebPanel = class
  1428. private
  1429. FMustShow: Boolean;
  1430. FShow: Boolean;
  1431. FID, FName, FURL, FImage: string;
  1432. FNavigateType: TNavigateType;
  1433. FPostFields: string;
  1434. FUserIMLoginName: Boolean;
  1435. FUserIMPassword: Boolean;
  1436. FCustomLoginName, FCustomPassword: string;
  1437. FContent: string;
  1438. FAcounts: TList;
  1439. public
  1440. constructor Create();
  1441. destructor Destroy; override;
  1442. property MustShow: Boolean read FMustShow write FMustShow;
  1443. property Show: Boolean read FShow write FShow;
  1444. property ID: string read FID write FID;
  1445. property Name: string read FName write FName;
  1446. property URL: string read FURL write FURL;
  1447. property Image: string read FImage write FImage;
  1448. property NavigateType: TNavigateType read FNavigateType write FNavigateType;
  1449. property PostFields: string read FPostFields write FPostFields;
  1450. property UserIMLoginName: Boolean read FUserIMLoginName write FUserIMLoginName;
  1451. property UserIMPassword: Boolean read FUserIMPassword write FUserIMPassword;
  1452. property CustomLoginName: string read FCustomLoginName write FCustomLoginName;
  1453. property CustomPassword: string read FCustomPassword write FCustomPassword;
  1454. property Content: string read FContent write FContent;
  1455. property Acounts: TList read FAcounts write FAcounts;
  1456. end;
  1457. //未读消息(文字消息)
  1458. TNotReadMessage = class
  1459. private
  1460. FRealICQMessage: TRealICQMessage;
  1461. FShowSendFailed: Boolean;
  1462. FRealICQClient: TRealICQClient;
  1463. public
  1464. destructor Destroy; override;
  1465. property RealICQMessage: TRealICQMessage read FRealICQMessage write FRealICQMessage;
  1466. property ShowSendFailed: Boolean read FShowSendFailed;
  1467. end;
  1468. //未读消息(文字消息)
  1469. TNotReadTeamMessage = class
  1470. private
  1471. FRealICQTeamMessage: TRealICQTeamMessage;
  1472. FShowSendFailed: Boolean;
  1473. public
  1474. destructor Destroy; override;
  1475. property RealICQTeamMessage: TRealICQTeamMessage read FRealICQTeamMessage write FRealICQTeamMessage;
  1476. property ShowSendFailed: Boolean read FShowSendFailed;
  1477. end;
  1478. //未读消息(手机短消息)
  1479. TNotReadSMSMessage = class
  1480. private
  1481. FSMSSender, FSMSContent: string;
  1482. FSMSDateTime: TDateTime;
  1483. public
  1484. property SMSSender: string read FSMSSender;
  1485. property SMSContent: string read FSMSContent;
  1486. property SMSDateTime: TDateTime read FSMSDateTime;
  1487. end;
  1488. TWebTabAcount = class
  1489. private
  1490. FWebTabID: Integer;
  1491. FTitle: string;
  1492. FLoginName: string;
  1493. FPassword: string;
  1494. FExplain: string;
  1495. public
  1496. published
  1497. property WebTabID: Integer read FWebTabID write FWebTabID;
  1498. property Title: string read FTitle write FTitle;
  1499. property LoginName: string read FLoginName write FLoginName;
  1500. property Password: string read FPassword write FPassword;
  1501. property Explain: string read FExplain write FExplain;
  1502. end;
  1503. //添加表示用户状态的图标至指定的 ImageList 中
  1504. procedure AddUserStatePictureToImageList(ImageList: TImageList);
  1505. procedure ClearFileMissions;
  1506. var
  1507. MainForm: TMainForm;
  1508. DisplayWebs: Boolean;
  1509. LVSystemMessage, LVMyContacters, LVFriends, LVStrangers, LVBlacklists, LVLatests, LVTeams, LVMoreUsers, LVAddrbook, LVSearch: string;
  1510. CsvLines, CommaStr: TStringList;
  1511. implementation
  1512. uses
  1513. RegFrm, SearchFrm, VCardFrm, AddFriendRequestFrm, AddFriendFrm, OptionsFrm,
  1514. ChangePassFrm, GroupManagerFrm, OnlineOfflineAlertFrm, SeeInformationFrm{UserCardDetailView},
  1515. TalkingFrm, TrueHiddenMainFrm, SelFaceFrm, CustomFacesManagerFrm, AddFaceFrm,
  1516. CreateTeamFrm, PtoPFileTransmitter, FileTransmitterObjective, NotifyAlertFrm,
  1517. TeamOptionsFrm, SearchTeamFrm, SystemMessageFrm, MessagesManagerFrm,
  1518. UserCardFrm, VideoFrm, ShareUtils, CopyScreenFrm, SMSFrm,
  1519. ConfirmReplaceNDFileFrm, RemoteControlFrm, ReceiveFolderRequestFrm,
  1520. NotReadMessageBoxFrm, AddWebTabFrm, SelWebTabAcountsFrm,
  1521. LoggerImport, TeamsAdapter, MainFormContrller, Authority, FileTransmitAdapter,
  1522. DataProviderImport, BranchService, UsersService, FriendsService,
  1523. WorkmatesService, MessagesHander, CAImport, InterfaceCA, PerlRegEx,
  1524. GroupConfig, ConditionConfig, LimitCondition,
  1525. AboutFrm, TextMessageService, ViewManager, InterfaceUI, GuideView,
  1526. RealICQUtility;
  1527. var
  1528. HookID: THandle;
  1529. FUploadMissions, FDownloadMissions: TStringList;
  1530. FSavedUploadMissions, FSavedDownloadMissions: TList;
  1531. //------------------------------------------------------------------------------
  1532. procedure AddUserStatePictureToImageList(ImageList: TImageList);
  1533. var
  1534. Bitmap: TBitmap;
  1535. //BitmapLeave: TBitmap;
  1536. //png: TPNGObject;
  1537. //Icon: TIcon;
  1538. begin
  1539. Bitmap := TBitmap.Create;
  1540. //Icon := TIcon.Create;
  1541. //BitmapLeave := TBitmap.Create;
  1542. //png := TPNGObject.Create;
  1543. try
  1544. // try
  1545. // Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1546. // except
  1547. // end;
  1548. // ImageList.Add(Bitmap, nil);
  1549. // Grayscale(Bitmap);
  1550. // ImageList.Insert(0, Bitmap, nil);
  1551. // try
  1552. // Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1553. // BitmapLeave.LoadFromFile(LeavePicture);
  1554. // Bitmap.Canvas.Draw(0, 8, BitmapLeave);
  1555. // except
  1556. // end;
  1557. // ImageList.Add(Bitmap, nil);
  1558. //-----------------------------------------------
  1559. //png.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  1560. //Image1.Picture.Bitmap.Assign(png);
  1561. // try
  1562. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1563. // except
  1564. // end;
  1565. // ImageList.AddIcon(Icon);
  1566. // try
  1567. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1568. // except
  1569. // end;
  1570. // ImageList.AddIcon(Icon);
  1571. // try
  1572. // Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  1573. // except
  1574. // end;
  1575. // ImageList.AddIcon(Icon);
  1576. try
  1577. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImageOffline_16.bmp');
  1578. except
  1579. end;
  1580. ImageList.Add(Bitmap, nil);
  1581. try
  1582. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImage_16.bmp');
  1583. except
  1584. end;
  1585. ImageList.Add(Bitmap, nil);
  1586. try
  1587. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Small\DefaultHeadImage_leave_16.bmp');
  1588. except
  1589. end;
  1590. ImageList.Add(Bitmap, nil);
  1591. try
  1592. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\OpenFolder.bmp');
  1593. except
  1594. end;
  1595. ImageList.Add(Bitmap, nil);
  1596. try
  1597. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CloseFolder.bmp');
  1598. except
  1599. end;
  1600. ImageList.Add(Bitmap, nil);
  1601. try
  1602. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  1603. except
  1604. end;
  1605. ImageList.Add(Bitmap, nil);
  1606. try
  1607. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  1608. except
  1609. end;
  1610. ImageList.Add(Bitmap, nil);
  1611. try
  1612. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SearchPicture);
  1613. except
  1614. end;
  1615. ImageList.Add(Bitmap, nil);
  1616. try
  1617. Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSBMP);
  1618. except
  1619. end;
  1620. ImageList.Add(Bitmap, nil);
  1621. finally
  1622. //BitmapLeave.Free;
  1623. Bitmap.Free;
  1624. //Icon.Free;
  1625. //png.Free;
  1626. end;
  1627. end;
  1628. //------------------------------------------------------------------------------
  1629. function MouseProc(nCode: Integer; wParam, lParam: Longint): Longint; stdcall;
  1630. var
  1631. szClassName: array[0..255] of Char;
  1632. const
  1633. ie_name = 'Internet Explorer_Server';
  1634. begin
  1635. case nCode < 0 of
  1636. True:
  1637. Result := CallNextHookEx(HookID, nCode, wParam, lParam) else
  1638. case wParam of
  1639. WM_RBUTTONDOWN, WM_RBUTTONUP:
  1640. begin
  1641. GetClassName(PMOUSEHOOKSTRUCT(lParam)^.HWND, szClassName, SizeOf(szClassName));
  1642. 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
  1643. begin
  1644. Result := HC_SKIP {屏蔽WebBrowser上的右键}
  1645. end
  1646. else
  1647. begin
  1648. Result := CallNextHookEx(HookID, nCode, wParam, lParam);
  1649. end;
  1650. end
  1651. else
  1652. Result := CallNextHookEx(HookID, nCode, wParam, lParam);
  1653. end;
  1654. end;
  1655. end;
  1656. {$R *.dfm}
  1657. {TWebPanel}
  1658. constructor TWebPanel.Create();
  1659. begin
  1660. FAcounts := TList.Create;
  1661. end;
  1662. destructor TWebPanel.Destroy;
  1663. var
  1664. WebTabAcount: TWebTabAcount;
  1665. begin
  1666. try
  1667. while FAcounts.Count > 0 do
  1668. begin
  1669. WebTabAcount := FAcounts[0];
  1670. FAcounts.Delete(0);
  1671. try
  1672. FreeAndNil(WebTabAcount);
  1673. except
  1674. end;
  1675. end;
  1676. try
  1677. FreeAndNil(FAcounts);
  1678. except
  1679. end;
  1680. finally
  1681. inherited Destroy;
  1682. end;
  1683. end;
  1684. {TDownloadMission}
  1685. //------------------------------------------------------------------------------
  1686. constructor TDownloadMission.Create(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = '');
  1687. begin
  1688. FDownloadMissionType := ADownloadMissionType;
  1689. FDirectoryName := ADirectoryName;
  1690. FFileID := AFileID;
  1691. FFileName := AFileName;
  1692. FID := IntToStr(GetTickCount);
  1693. while FDownloadMissions.IndexOf(FID) >= 0 do
  1694. begin
  1695. FID := IntToStr(GetTickCount);
  1696. Sleep(10);
  1697. Application.ProcessMessages;
  1698. end;
  1699. FDownloadMissions.AddObject(FID, Self);
  1700. end;
  1701. //------------------------------------------------------------------------------
  1702. destructor TDownloadMission.Destroy;
  1703. begin
  1704. try
  1705. try
  1706. FDownloadMissions.Delete(FDownloadMissions.IndexOf(FID));
  1707. except
  1708. end;
  1709. finally
  1710. inherited Destroy;
  1711. end;
  1712. end;
  1713. {TUploadMission}
  1714. //------------------------------------------------------------------------------
  1715. constructor TUploadMission.Create(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string);
  1716. begin
  1717. FUploadMissionType := AUploadMissionType;
  1718. FDirectoryID := ADirectoryID;
  1719. FName := AName;
  1720. FID := IntToStr(Integer(FUploadMissionType)) + IntToStr(FDirectoryID) + FName;
  1721. end;
  1722. //------------------------------------------------------------------------------
  1723. destructor TUploadMission.Destroy;
  1724. begin
  1725. try
  1726. try
  1727. FUploadMissions.Delete(FUploadMissions.IndexOf(FID));
  1728. except
  1729. end;
  1730. finally
  1731. inherited Destroy;
  1732. end;
  1733. end;
  1734. {TNotReadMessage}
  1735. //------------------------------------------------------------------------------
  1736. destructor TNotReadMessage.Destroy;
  1737. begin
  1738. try
  1739. FreeAndNil(FRealICQMessage);
  1740. finally
  1741. inherited Destroy;
  1742. end;
  1743. end;
  1744. {TNotReadTeamMessage}
  1745. //------------------------------------------------------------------------------
  1746. destructor TNotReadTeamMessage.Destroy;
  1747. begin
  1748. try
  1749. FreeAndNil(FRealICQTeamMessage);
  1750. finally
  1751. inherited Destroy;
  1752. end;
  1753. end;
  1754. {TMainForm}
  1755. function TMainForm.GetBitmapFromFileExt(AFileName: string): string;
  1756. var
  1757. FileExt, IconTempFileName, FFileExtImage: string;
  1758. TempFile: array[0..MAX_PATH] of char;
  1759. SHFI: TSHFileInfo;
  1760. Bitmap: TBitmap;
  1761. begin
  1762. try
  1763. FileExt := ExtractFileExt(AFileName);
  1764. FFileExtImage := TRealICQClient.GetFileExtImagesDir + Copy(FileExt, 2, Length(FileExt) - 1) + '.BMP';
  1765. if not FileExists(FFileExtImage) then
  1766. begin
  1767. GetTempPath(MAX_PATH, TempFile);
  1768. GetTempFileName(TempFile, PChar(FileExt), GetTickCount, TempFile);
  1769. IconTempFileName := ReplaceStr(TempFile, ExtractFileExt(TempFile), FileExt);
  1770. TFileStream.Create(IconTempFileName, fmCreate).Free;
  1771. SHGetFileInfo(PChar(IconTempFileName), 0, SHFI, SizeOf(SHFI), SHGFI_ICON or SHGFI_SMALLICON);
  1772. DeleteFile(PChar(IconTempFileName));
  1773. Bitmap := TBitmap.Create;
  1774. try
  1775. Bitmap.Width := 16;
  1776. Bitmap.Height := 16;
  1777. DrawIconEx(Bitmap.Canvas.Handle, 0, 0, SHFI.hIcon, 16, 16, 0, 0, DI_NORMAL);
  1778. Bitmap.SaveToFile(FFileExtImage);
  1779. finally
  1780. FreeAndNil(Bitmap);
  1781. end;
  1782. end;
  1783. Result := FFileExtImage;
  1784. except
  1785. end;
  1786. end;
  1787. //------------------------------------------------------------------------------
  1788. procedure TMainForm.SetShowMainFormOnStart(Value: Boolean);
  1789. begin
  1790. if FShowMainFormOnStart = Value then
  1791. Exit;
  1792. FShowMainFormOnStart := Value;
  1793. SaveDefaultConfigs;
  1794. end;
  1795. //------------------------------------------------------------------------------
  1796. procedure TMainForm.SetTalkingFormAlwaysOnTop(Value: Boolean);
  1797. begin
  1798. if FTalkingFormAlwaysOnTop = Value then
  1799. Exit;
  1800. FTalkingFormAlwaysOnTop := Value;
  1801. SaveStyleConfigs;
  1802. end;
  1803. //------------------------------------------------------------------------------
  1804. procedure TMainForm.SetCtrlEnterSendMessage(Value: Boolean);
  1805. begin
  1806. if FCtrlEnterSendMessage = Value then
  1807. Exit;
  1808. FCtrlEnterSendMessage := Value;
  1809. SaveStyleConfigs;
  1810. end;
  1811. procedure TMainForm.SetCopyScreenHideTalkForm(Value: Boolean);
  1812. begin
  1813. if FCopyScreenHideTalkForm = Value then
  1814. Exit;
  1815. FCopyScreenHideTalkForm := Value;
  1816. SaveStyleConfigs;
  1817. end;
  1818. procedure TMainForm.SetShowGroup(Value: Boolean);
  1819. begin
  1820. FShowGroup := Value;
  1821. ShowGroupInterface;
  1822. end;
  1823. procedure TMainForm.SaveIfShowGroupConfig;
  1824. var
  1825. XMLFile: string;
  1826. XMLDocument: TXMLDocument;
  1827. GroupConfigNode: IXMLNode;
  1828. begin
  1829. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  1830. XMLDocument := TXMLDocument.Create(Self);
  1831. try
  1832. XMLDocument.Active := True;
  1833. if not FileExists(XMLFile) then
  1834. begin
  1835. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  1836. XMLDocument.Active := True;
  1837. end;
  1838. XMLDocument.LoadFromFile(XMLFile);
  1839. GroupConfigNode := XMLDocument.DocumentElement;
  1840. GroupConfigNode.ChildNodes.FindNode('ShowGroup').Attributes['Value'] := FShowGroup;
  1841. XMLDocument.SaveToFile();
  1842. finally
  1843. XMLDocument.Free;
  1844. end;
  1845. end;
  1846. //------------------------------------------------------------------------------
  1847. procedure TMainForm.SaveGroupConfigs;
  1848. var
  1849. XMLFile: string;
  1850. XMLDocument: TXMLDocument;
  1851. GroupConfigNode, GroupListNode, GroupNode: IXMLNode;
  1852. GroupMembers: TStringList;
  1853. iLoop, jLoop: Integer;
  1854. begin
  1855. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  1856. XMLDocument := TXMLDocument.Create(Self);
  1857. try
  1858. XMLDocument.Active := True;
  1859. if not FileExists(XMLFile) then
  1860. begin
  1861. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  1862. XMLDocument.Active := True;
  1863. end;
  1864. XMLDocument.LoadFromFile(XMLFile);
  1865. GroupConfigNode := XMLDocument.DocumentElement;
  1866. GroupListNode := GroupConfigNode.ChildNodes.FindNode('Groups');
  1867. for iLoop := 0 to GroupListNode.ChildNodes.Count - 1 do
  1868. begin
  1869. GroupNode := GroupListNode.ChildNodes[iLoop];
  1870. GroupNode.ChildNodes.Clear;
  1871. end;
  1872. GroupListNode.ChildNodes.Clear;
  1873. for iLoop := 0 to FGroups.Count - 1 do
  1874. begin
  1875. GroupNode := GroupListNode.AddChild('Group');
  1876. GroupNode.Attributes['Name'] := FGroups[iLoop];
  1877. GroupNode.Attributes['Position'] := iLoop;
  1878. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  1879. for jLoop := 0 to GroupMembers.Count - 1 do
  1880. begin
  1881. if (not TFriendsService.GetService.IsFriend(GroupMembers[jLoop])) and (not TWorkmatesService.GetService.IsWorkmate(GroupMembers[jLoop])) then
  1882. continue;
  1883. if (AnsiSameText(RealICQClient.LoginName, GroupMembers[jLoop]) and (RealICQClient.WorkingMode = wmPublic)) then
  1884. continue;
  1885. GroupNode.AddChild('GroupMember').Text := GroupMembers[jLoop];
  1886. end;
  1887. end;
  1888. XMLDocument.SaveToFile();
  1889. finally
  1890. XMLDocument.Free;
  1891. end;
  1892. end;
  1893. //------------------------------------------------------------------------------
  1894. procedure TMainForm.SetInputFont(Value: TFont);
  1895. begin
  1896. FInputFont.Assign(Value);
  1897. SaveInputFontConfig;
  1898. end;
  1899. //------------------------------------------------------------------------------
  1900. function TMainForm.GetSystemMessageCounter(AMessageID: Integer): Integer;
  1901. var
  1902. XMLFile: string;
  1903. XMLDocument: TXMLDocument;
  1904. CountersNode, CounterNode: IXMLNode;
  1905. iLoop: Integer;
  1906. CountersDate: TDateTime;
  1907. begin
  1908. Result := 0;
  1909. XMLFile := TRealICQClient.GetUserDir + SystemMessagesCounterXMLFile;
  1910. XMLDocument := TXMLDocument.Create(Self);
  1911. try
  1912. try
  1913. XMLDocument.Active := True;
  1914. if not FileExists(XMLFile) then
  1915. begin
  1916. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SystemMessagesCounterXMLFile), PChar(XMLFile), False);
  1917. XMLDocument.Active := True;
  1918. end;
  1919. XMLDocument.LoadFromFile(XMLFile);
  1920. CountersNode := XMLDocument.DocumentElement;
  1921. try
  1922. CountersDate := StrToDate(CountersNode.Attributes['Date']);
  1923. except
  1924. CountersDate := StrToDate(AnsiReplaceStr(CountersNode.Attributes['Date'], '-', '/'));
  1925. end;
  1926. if CompareDate(CountersDate, Now) <> 0 then
  1927. begin
  1928. CountersNode.Attributes['Date'] := DateToStr(Now);
  1929. CountersNode.ChildNodes.Clear;
  1930. XMLDocument.SaveToFile();
  1931. Exit;
  1932. end;
  1933. for iLoop := 0 to CountersNode.ChildNodes.Count - 1 do
  1934. begin
  1935. CounterNode := CountersNode.ChildNodes[iLoop];
  1936. if StrToInt(CounterNode.Attributes['ID']) = AMessageID then
  1937. begin
  1938. Result := StrToInt(CounterNode.Attributes['Counter']);
  1939. Exit;
  1940. end;
  1941. end;
  1942. finally
  1943. XMLDocument.Free;
  1944. end;
  1945. except
  1946. try
  1947. DeleteFile(XMLFile);
  1948. except
  1949. end;
  1950. Result := 0;
  1951. end;
  1952. end;
  1953. //------------------------------------------------------------------------------
  1954. //procedure TMainForm.ImgQrCodeClick(Sender: TObject);
  1955. //begin
  1956. // QRCodeForm := TQRCodeForm.Create(Self);
  1957. // try
  1958. // QRCodeForm.ShowModal;
  1959. // finally
  1960. // FreeAndNil(QRCodeForm);
  1961. // end;
  1962. //end;
  1963. procedure TMainForm.IncSystemMessageCounter(AMessageID: Integer);
  1964. var
  1965. XMLFile: string;
  1966. XMLDocument: TXMLDocument;
  1967. CountersNode, CounterNode: IXMLNode;
  1968. iLoop: Integer;
  1969. Finded: Boolean;
  1970. CountersDate: TDateTime;
  1971. begin
  1972. XMLFile := TRealICQClient.GetUserDir + SystemMessagesCounterXMLFile;
  1973. XMLDocument := TXMLDocument.Create(Self);
  1974. try
  1975. XMLDocument.Active := True;
  1976. if not FileExists(XMLFile) then
  1977. begin
  1978. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SystemMessagesCounterXMLFile), PChar(XMLFile), False);
  1979. XMLDocument.Active := True;
  1980. end;
  1981. XMLDocument.LoadFromFile(XMLFile);
  1982. CountersNode := XMLDocument.DocumentElement;
  1983. try
  1984. CountersDate := StrToDate(CountersNode.Attributes['Date']);
  1985. except
  1986. CountersDate := StrToDate(AnsiReplaceStr(CountersNode.Attributes['Date'], '-', '/'));
  1987. end;
  1988. if CompareDate(CountersDate, Now) <> 0 then
  1989. begin
  1990. CountersNode.Attributes['Date'] := DateToStr(Now);
  1991. CountersNode.ChildNodes.Clear;
  1992. end;
  1993. Finded := False;
  1994. for iLoop := 0 to CountersNode.ChildNodes.Count - 1 do
  1995. begin
  1996. CounterNode := CountersNode.ChildNodes[iLoop];
  1997. if StrToInt(CounterNode.Attributes['ID']) = AMessageID then
  1998. begin
  1999. CounterNode.Attributes['Counter'] := IntToStr(StrToInt(CounterNode.Attributes['Counter']) + 1);
  2000. Finded := True;
  2001. Break;
  2002. end;
  2003. end;
  2004. if not Finded then
  2005. begin
  2006. CounterNode := CountersNode.AddChild('SystemMessage');
  2007. CounterNode.Attributes['ID'] := IntToStr(AMessageID);
  2008. CounterNode.Attributes['Counter'] := '1';
  2009. end;
  2010. XMLDocument.SaveToFile();
  2011. finally
  2012. XMLDocument.Free;
  2013. end;
  2014. end;
  2015. //------------------------------------------------------------------------------
  2016. procedure TMainForm.SaveCustomFaceConfig;
  2017. var
  2018. XMLFile, FaceCategorys: string;
  2019. XMLDocument: TXMLDocument;
  2020. InputConfigNode, FacesNode, FaceNode: IXMLNode;
  2021. iLoop, jLoop: Integer;
  2022. Face: TFace;
  2023. begin
  2024. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2025. XMLDocument := TXMLDocument.Create(Self);
  2026. try
  2027. XMLDocument.Active := True;
  2028. if not FileExists(XMLFile) then
  2029. begin
  2030. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2031. XMLDocument.Active := True;
  2032. //删除系统表情
  2033. XMLDocument.LoadFromFile(XMLFile);
  2034. InputConfigNode := XMLDocument.DocumentElement;
  2035. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2036. FacesNode.ChildNodes.Clear;
  2037. XMLDocument.SaveToFile();
  2038. XMLDocument.Active := False;
  2039. end;
  2040. XMLDocument.Active := True;
  2041. XMLDocument.LoadFromFile(XMLFile);
  2042. InputConfigNode := XMLDocument.DocumentElement;
  2043. if InputConfigNode.ChildNodes.FindNode('FaceCategory') = nil then
  2044. begin
  2045. InputConfigNode.AddChild('FaceCategory').Text := '';
  2046. XMLDocument.SaveToFile();
  2047. end;
  2048. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2049. FacesNode.ChildNodes.Clear;
  2050. FaceCategorys := '';
  2051. for iLoop := 0 to FFaceCategory.Count - 1 do
  2052. begin
  2053. for jLoop := FSystemFaceCount to FaceList.Count - 1 do
  2054. begin
  2055. Face := FaceList.Objects[jLoop] as TFace;
  2056. if AnsiSameText(Face.Category, FFaceCategory[iLoop]) then
  2057. begin
  2058. FaceNode := FacesNode.AddChild('Face');
  2059. FaceNode.Text := ExtractFileName(Face.FileName);
  2060. FaceNode.Attributes['ShortCut'] := Face.ShortCut;
  2061. FaceNode.Attributes['Name'] := Face.Name;
  2062. FaceNode.Attributes['MD5Code'] := Face.MD5Code;
  2063. FaceNode.Attributes['Category'] := Face.Category;
  2064. end;
  2065. end;
  2066. if iLoop < FFaceCategory.Count - 1 then
  2067. FaceCategorys := FaceCategorys + FFaceCategory[iLoop] + ','
  2068. else
  2069. FaceCategorys := FaceCategorys + FFaceCategory[iLoop];
  2070. end;
  2071. InputConfigNode.ChildNodes.FindNode('FaceCategory').Text := FaceCategorys;
  2072. if SelFaceForm <> nil then
  2073. SelFaceForm.ReDrawFaces;
  2074. XMLDocument.SaveToFile();
  2075. finally
  2076. XMLDocument.Free;
  2077. end;
  2078. end;
  2079. //------------------------------------------------------------------------------
  2080. procedure TMainForm.SaveInputFontConfig;
  2081. var
  2082. XMLFile: string;
  2083. XMLDocument: TXMLDocument;
  2084. InputConfigNode, FacesNode: IXMLNode;
  2085. begin
  2086. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2087. XMLDocument := TXMLDocument.Create(Self);
  2088. try
  2089. XMLDocument.Active := True;
  2090. if not FileExists(XMLFile) then
  2091. begin
  2092. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2093. XMLDocument.Active := True;
  2094. //删除系统表情
  2095. XMLDocument.LoadFromFile(XMLFile);
  2096. InputConfigNode := XMLDocument.DocumentElement;
  2097. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2098. FacesNode.ChildNodes.Clear;
  2099. XMLDocument.SaveToFile();
  2100. XMLDocument.Active := False;
  2101. end;
  2102. XMLDocument.Active := True;
  2103. XMLDocument.LoadFromFile(XMLFile);
  2104. InputConfigNode := XMLDocument.DocumentElement;
  2105. try
  2106. InputConfigNode.ChildNodes.FindNode('Font').Text := FontToString(FInputFont);
  2107. except
  2108. InputConfigNode.ChildNodes.FindNode('Font').Text := FontToString(Font);
  2109. end;
  2110. XMLDocument.SaveToFile();
  2111. finally
  2112. XMLDocument.Free;
  2113. end;
  2114. end;
  2115. //------------------------------------------------------------------------------
  2116. procedure TMainForm.LoadInputConfigs;
  2117. var
  2118. XMLFile: string;
  2119. XMLDocument: TXMLDocument;
  2120. InputConfigNode, FacesNode, FaceNode: IXMLNode;
  2121. Face: TFace;
  2122. iLoop: Integer;
  2123. Category: string;
  2124. begin
  2125. FInputFont.Assign(Font);
  2126. {$region '删除前一个用户的表情'}
  2127. TRealICQUtility.ClearStringList(FFaceList);
  2128. TRealICQUtility.ClearStringList(FTempFaceList);
  2129. FFaceCategory.Clear;
  2130. FSystemFaceCount := 0;
  2131. {$endregion}
  2132. {$region '读取系统表情'}
  2133. FFaceCategory.Add(SystemFaceGroup);
  2134. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile;
  2135. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2136. XMLDocument := TXMLDocument.Create(Self);
  2137. try
  2138. XMLDocument.Active := True;
  2139. XMLDocument.LoadFromFile(XMLFile);
  2140. InputConfigNode := XMLDocument.DocumentElement;
  2141. try
  2142. StringToFont(InputConfigNode.ChildNodes.FindNode('Font').Text, FInputFont);
  2143. except
  2144. FInputFont.Assign(Font);
  2145. end;
  2146. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2147. for iLoop := 0 to FacesNode.ChildNodes.Count - 1 do
  2148. begin
  2149. FaceNode := FacesNode.ChildNodes[iLoop];
  2150. Face := TFace.Create(ExtractFilePath(paramstr(0)) + FaceNode.Text, FaceNode.Attributes['ShortCut'], FaceNode.Attributes['Name'], '', SystemFaceGroup);
  2151. FFaceList.AddObject(Face.ShortCut, Face);
  2152. Inc(FSystemFaceCount);
  2153. end;
  2154. finally
  2155. XMLDocument.Free;
  2156. end;
  2157. {$endregion}
  2158. {$region '读取自定义表情'}
  2159. XMLFile := TRealICQClient.GetUserDir + InputConfigXMLFile;
  2160. XMLDocument := TXMLDocument.Create(Self);
  2161. try
  2162. XMLDocument.Active := True;
  2163. if not FileExists(XMLFile) then
  2164. begin
  2165. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + InputConfigXMLFile), PChar(XMLFile), False);
  2166. XMLDocument.Active := True;
  2167. //删除系统表情
  2168. XMLDocument.LoadFromFile(XMLFile);
  2169. InputConfigNode := XMLDocument.DocumentElement;
  2170. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2171. FacesNode.ChildNodes.Clear;
  2172. XMLDocument.SaveToFile();
  2173. XMLDocument.Active := False;
  2174. end;
  2175. XMLDocument.Active := True;
  2176. XMLDocument.LoadFromFile(XMLFile);
  2177. InputConfigNode := XMLDocument.DocumentElement;
  2178. try
  2179. StringToFont(InputConfigNode.ChildNodes.FindNode('Font').Text, FInputFont);
  2180. except
  2181. FInputFont.Assign(Font);
  2182. end;
  2183. if InputConfigNode.ChildNodes.FindNode('FaceCategory') = nil then
  2184. begin
  2185. InputConfigNode.AddChild('FaceCategory').Text := '';
  2186. XMLDocument.SaveToFile();
  2187. end;
  2188. FreeAndNil(FFaceCategory);
  2189. FFaceCategory := SplitString(InputConfigNode.ChildNodes.FindNode('FaceCategory').Text, ',');
  2190. if FFaceCategory.IndexOf('') >= 0 then
  2191. FFaceCategory.Delete(FFaceCategory.IndexOf(''));
  2192. FacesNode := InputConfigNode.ChildNodes.FindNode('Faces');
  2193. for iLoop := 0 to FacesNode.ChildNodes.Count - 1 do
  2194. begin
  2195. FaceNode := FacesNode.ChildNodes[iLoop];
  2196. try
  2197. Category := FaceNode.Attributes['Category'];
  2198. except
  2199. Category := NOFaceCategory;
  2200. end;
  2201. if FFaceCategory.IndexOf(Category) = -1 then
  2202. begin
  2203. if AnsiSameText(Category, NOFaceCategory) then
  2204. FFaceCategory.Insert(0, Category)
  2205. else
  2206. FFaceCategory.Add(Category);
  2207. end;
  2208. Face := TFace.Create(TRealICQClient.GetCustomFaceDir + FaceNode.Text, FaceNode.Attributes['ShortCut'], FaceNode.Attributes['Name'], FaceNode.Attributes['MD5Code'], Category);
  2209. FFaceList.AddObject(Face.MD5Code, Face);
  2210. end;
  2211. finally
  2212. XMLDocument.Free;
  2213. end;
  2214. {$endregion}
  2215. end;
  2216. //------------------------------------------------------------------------------
  2217. procedure TMainForm.LoadSafeConfigs;
  2218. var
  2219. XMLFile: string;
  2220. XMLDocument: TXMLDocument;
  2221. SafeConfigNode: IXMLNode;
  2222. begin
  2223. XMLFile := TRealICQClient.GetUserDir + SafeConfigXMLFile;
  2224. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2225. XMLDocument := TXMLDocument.Create(Self);
  2226. try
  2227. XMLDocument.Active := True;
  2228. if not FileExists(XMLFile) then
  2229. begin
  2230. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SafeConfigXMLFile), PChar(XMLFile), False);
  2231. XMLDocument.Active := True;
  2232. end;
  2233. XMLDocument.LoadFromFile(XMLFile);
  2234. SafeConfigNode := XMLDocument.DocumentElement;
  2235. FRecvFileSafeLevel := TRecvFileSafeLevel(Integer(SafeConfigNode.ChildNodes.FindNode('RecvFileSafeLevel').Attributes['Value']));
  2236. FAllowURL := SafeConfigNode.ChildNodes.FindNode('AllowURL').Attributes['Value'];
  2237. FShowHistoryInNewWindow := SafeConfigNode.ChildNodes.FindNode('ShowHistoryInNewWindow').Attributes['Value'];
  2238. FAutoSaveMessage := SafeConfigNode.ChildNodes.FindNode('AutoSaveMessage').Attributes['Value'];
  2239. finally
  2240. XMLDocument.Free;
  2241. end;
  2242. end;
  2243. //------------------------------------------------------------------------------
  2244. procedure TMainForm.SaveSafeConfigs;
  2245. var
  2246. XMLFile: string;
  2247. XMLDocument: TXMLDocument;
  2248. SafeConfigNode: IXMLNode;
  2249. begin
  2250. XMLFile := TRealICQClient.GetUserDir + SafeConfigXMLFile;
  2251. XMLDocument := TXMLDocument.Create(Self);
  2252. try
  2253. XMLDocument.Active := True;
  2254. if not FileExists(XMLFile) then
  2255. begin
  2256. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + SafeConfigXMLFile), PChar(XMLFile), False);
  2257. XMLDocument.Active := True;
  2258. end;
  2259. XMLDocument.LoadFromFile(XMLFile);
  2260. SafeConfigNode := XMLDocument.DocumentElement;
  2261. SafeConfigNode.ChildNodes.FindNode('RecvFileSafeLevel').Attributes['Value'] := Integer(FRecvFileSafeLevel);
  2262. SafeConfigNode.ChildNodes.FindNode('AllowURL').Attributes['Value'] := FAllowURL;
  2263. SafeConfigNode.ChildNodes.FindNode('ShowHistoryInNewWindow').Attributes['Value'] := FShowHistoryInNewWindow;
  2264. SafeConfigNode.ChildNodes.FindNode('AutoSaveMessage').Attributes['Value'] := FAutoSaveMessage;
  2265. XMLDocument.SaveToFile();
  2266. finally
  2267. XMLDocument.Free;
  2268. end;
  2269. end;
  2270. //------------------------------------------------------------------------------
  2271. procedure TMainForm.LoadWebPanelsFromXML;
  2272. var
  2273. ADesKey: string;
  2274. iLoop: Integer;
  2275. XMLFile: string;
  2276. XMLDocument: TXMLDocument;
  2277. WebPanelsNode, WebPanelNode: IXMLNode;
  2278. WebPanel: TWebPanel;
  2279. begin
  2280. XMLFile := TRealICQClient.GetUserDir + WebPanelsXMLFile;
  2281. XMLDocument := TXMLDocument.Create(Self);
  2282. try
  2283. try
  2284. XMLDocument.Active := True;
  2285. if not FileExists(XMLFile) then
  2286. begin
  2287. XMLDocument.XML.Text := '<?xml version="1.0"?>' + '<WebPanels>' + '</WebPanels>';
  2288. XMLDocument.Active := True;
  2289. XMLDocument.SaveToFile(XMLFile);
  2290. end
  2291. else
  2292. begin
  2293. XMLDocument.LoadFromFile(XMLFile);
  2294. end;
  2295. WebPanelsNode := XMLDocument.DocumentElement;
  2296. while FWebPanels.Count > 0 do
  2297. begin
  2298. FWebPanels.Objects[0].Free;
  2299. FWebPanels.Delete(0);
  2300. end;
  2301. FWebPanels.Clear;
  2302. ADesKey := MD5En(RealICQClient.LoginName);
  2303. for iLoop := WebPanelsNode.ChildNodes.Count - 1 downto 0 do
  2304. begin
  2305. WebPanelNode := WebPanelsNode.ChildNodes[iLoop];
  2306. WebPanel := TWebPanel.Create;
  2307. try
  2308. WebPanel.FMustShow := WebPanelNode.Attributes['MustShow'];
  2309. except
  2310. WebPanel.FMustShow := False;
  2311. end;
  2312. try
  2313. WebPanel.FShow := WebPanelNode.Attributes['Show'];
  2314. except
  2315. WebPanel.FShow := False;
  2316. end;
  2317. try
  2318. WebPanel.FID := WebPanelNode.Attributes['ID'];
  2319. except
  2320. WebPanel.FID := '';
  2321. end;
  2322. WebPanel.FName := DESryStrHex(WebPanelNode.Attributes['Name'], ADesKey);
  2323. WebPanel.FURL := DESryStrHex(WebPanelNode.Attributes['URL'], ADesKey);
  2324. WebPanel.FImage := DESryStrHex(WebPanelNode.Attributes['Image'], ADesKey);
  2325. WebPanel.FNavigateType := WebPanelNode.Attributes['NavigateType'];
  2326. WebPanel.FPostFields := DESryStrHex(WebPanelNode.Attributes['PostFields'], ADesKey);
  2327. WebPanel.FUserIMLoginName := WebPanelNode.Attributes['UserIMLoginName'];
  2328. WebPanel.FUserIMPassword := WebPanelNode.Attributes['UserIMPassword'];
  2329. WebPanel.FCustomLoginName := DESryStrHex(WebPanelNode.Attributes['CustomLoginName'], ADesKey);
  2330. WebPanel.FCustomPassword := DESryStrHex(WebPanelNode.Attributes['CustomPassword'], ADesKey);
  2331. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  2332. end;
  2333. except
  2334. end;
  2335. finally
  2336. XMLDocument.Free;
  2337. end;
  2338. end;
  2339. //------------------------------------------------------------------------------
  2340. procedure TMainForm.SaveWebPanelsToXML;
  2341. var
  2342. ADesKey: string;
  2343. iLoop: Integer;
  2344. XMLFile: string;
  2345. XMLDocument: TXMLDocument;
  2346. WebPanelsNode, WebPanelNode: IXMLNode;
  2347. WebPanel: TWebPanel;
  2348. begin
  2349. XMLFile := TRealICQClient.GetUserDir + WebPanelsXMLFile;
  2350. XMLDocument := TXMLDocument.Create(Self);
  2351. try
  2352. try
  2353. XMLDocument.Active := True;
  2354. if not FileExists(XMLFile) then
  2355. begin
  2356. XMLDocument.XML.Text := '<?xml version="1.0"?>' + '<WebPanels>' + '</WebPanels>';
  2357. XMLDocument.Active := True;
  2358. end
  2359. else
  2360. begin
  2361. XMLDocument.LoadFromFile(XMLFile);
  2362. end;
  2363. WebPanelsNode := XMLDocument.DocumentElement;
  2364. ADesKey := MD5En(RealICQClient.LoginName);
  2365. WebPanelsNode.ChildNodes.Clear;
  2366. for iLoop := 0 to FWebPanels.Count - 1 do
  2367. begin
  2368. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  2369. WebPanelNode := WebPanelsNode.AddChild('WebPanel');
  2370. WebPanelNode.Attributes['MustShow'] := WebPanel.FMustShow;
  2371. WebPanelNode.Attributes['Show'] := WebPanel.FShow;
  2372. WebPanelNode.Attributes['ID'] := WebPanel.FID;
  2373. WebPanelNode.Attributes['Name'] := EncryStrHex(WebPanel.FName, ADesKey);
  2374. WebPanelNode.Attributes['URL'] := EncryStrHex(WebPanel.FURL, ADesKey);
  2375. WebPanelNode.Attributes['Image'] := EncryStrHex(WebPanel.FImage, ADesKey);
  2376. WebPanelNode.Attributes['NavigateType'] := WebPanel.FNavigateType;
  2377. WebPanelNode.Attributes['PostFields'] := EncryStrHex(WebPanel.FPostFields, ADesKey);
  2378. WebPanelNode.Attributes['UserIMLoginName'] := WebPanel.FUserIMLoginName;
  2379. WebPanelNode.Attributes['UserIMPassword'] := WebPanel.FUserIMPassword;
  2380. WebPanelNode.Attributes['CustomLoginName'] := EncryStrHex(WebPanel.FCustomLoginName, ADesKey);
  2381. WebPanelNode.Attributes['CustomPassword'] := EncryStrHex(WebPanel.FCustomPassword, ADesKey);
  2382. end;
  2383. XMLDocument.SaveToFile(XMLFile);
  2384. except
  2385. end;
  2386. finally
  2387. XMLDocument.Free;
  2388. end;
  2389. end;
  2390. {
  2391. //----------------------------------------------------------
  2392. procedure TMainForm.LoadSysMsgInterfaceConfig;
  2393. var
  2394. XMLFile: String;
  2395. XMLDocument: TXMLDocument;
  2396. ConfigNodes,ConfigNode: IXMLNode;
  2397. iLoop:Integer;
  2398. SysMsgInterface:TSysMsgInterface;
  2399. MsgIID:String;
  2400. begin
  2401. XMLFile := TRealICQClient.GetUserDir+SysMsgInterfaceConfig;
  2402. XMLDocument := TXMLDocument.Create(Self);
  2403. try
  2404. try
  2405. XMLDocument.Active := True;
  2406. if not FileExists(XMLFile) then
  2407. begin
  2408. XMLDocument.XML.Text := '<?xml version="1.0"?>' +
  2409. '<SysMsgInterfaces>' +
  2410. '</SysMsgInterfaces>';
  2411. XMLDocument.Active := True;
  2412. XMLDocument.SaveToFile(XMLFile);
  2413. end
  2414. else
  2415. begin
  2416. XMLDocument.LoadFromFile(XMLFile);
  2417. end;
  2418. ConfigNodes := XMLDocument.DocumentElement;
  2419. for iLoop := 0 to ConfigNodes.ChildNodes.Count - 1 do
  2420. begin
  2421. ConfigNode:=ConfigNodes.ChildNodes[iLoop];
  2422. MsgIID:=ConfigNode.Attributes['MsgIID'];
  2423. if MainForm.RealICQClient.SysMsgInterfaces.IndexOf(MsgIID)>=0 then
  2424. begin
  2425. SysMsgInterface:=MainForm.RealICQClient.SysMsgInterfaces.Objects[MainForm.RealICQClient.SysMsgInterfaces.IndexOf(MsgIID)] as TSysMsgInterface;
  2426. SysMsgInterface.ShowMsg:=ConfigNode.Attributes['ShowMsg'];
  2427. end;
  2428. end;
  2429. except
  2430. //
  2431. end;
  2432. finally
  2433. XMLDocument.Free;
  2434. end;
  2435. end; }
  2436. {
  2437. //-----------------------------------------------------------
  2438. procedure TMainForm.SaveSysMsgInterfaceConfig;
  2439. var
  2440. XMLFile: String;
  2441. XMLDocument: TXMLDocument;
  2442. ConfigNodes,ConfigNode: IXMLNode;
  2443. iLoop:Integer;
  2444. SysMsgInterface:TSysMsgInterface;
  2445. begin
  2446. XMLFile := TRealICQClient.GetUserDir+SysMsgInterfaceConfig;
  2447. XMLDocument := TXMLDocument.Create(Self);
  2448. try
  2449. try
  2450. XMLDocument.Active := True;
  2451. if not FileExists(XMLFile) then
  2452. begin
  2453. XMLDocument.XML.Text := '<?xml version="1.0"?>' +
  2454. '<SysMsgInterfaces>' +
  2455. '</SysMsgInterfaces>';
  2456. XMLDocument.Active := True;
  2457. end
  2458. else
  2459. begin
  2460. XMLDocument.LoadFromFile(XMLFile);
  2461. end;
  2462. ConfigNodes := XMLDocument.DocumentElement;
  2463. ConfigNodes.ChildNodes.Clear;
  2464. for iLoop := 0 to MainForm.RealICQClient.SysMsgInterfaces.Count - 1 do
  2465. begin
  2466. SysMsgInterface:=MainForm.RealICQClient.SysMsgInterfaces.Objects[iLoop] as TSysMsgInterface;
  2467. ConfigNode:=ConfigNodes.AddChild('SysMsgInterface');
  2468. ConfigNode.Attributes['MsgIID']:=SysMsgInterface.MsgIID;
  2469. ConfigNode.Attributes['ShowMsg']:=SysMsgInterface.ShowMsg;
  2470. end;
  2471. XMLDocument.SaveToFile(XMLFile);
  2472. except
  2473. end;
  2474. finally
  2475. XMLDocument.Free;
  2476. end;
  2477. end; }
  2478. //------------------------------------------------------------------------------
  2479. procedure TMainForm.LoadReceiveFileConfigs;
  2480. var
  2481. XMLFile: string;
  2482. XMLDocument: TXMLDocument;
  2483. ReceiveFileConfigNode: IXMLNode;
  2484. begin
  2485. XMLFile := TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile;
  2486. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2487. XMLDocument := TXMLDocument.Create(Self);
  2488. try
  2489. XMLDocument.Active := True;
  2490. if not FileExists(XMLFile) then
  2491. begin
  2492. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + ReceiveFileConfigXMLFile), PChar(XMLFile), False);
  2493. XMLDocument.Active := True;
  2494. end;
  2495. XMLDocument.LoadFromFile(XMLFile);
  2496. ReceiveFileConfigNode := XMLDocument.DocumentElement;
  2497. FRecvFileDir := ReceiveFileConfigNode.ChildNodes.FindNode('RecvFileDir').Attributes['Value'];
  2498. FUseCacheDir := ReceiveFileConfigNode.ChildNodes.FindNode('UseCacheDir').Attributes['Value'];
  2499. FCacheDir := ReceiveFileConfigNode.ChildNodes.FindNode('CacheDir').Attributes['Value'];
  2500. FLimitCacheDirSize := ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['Value'];
  2501. FMaxCacheDirSize := ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['MaxSize'];
  2502. FAudoDeleteCacheFile := ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Value'];
  2503. FAudoDeleteCacheFileDate := ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Date'];
  2504. FScanVirus := ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Value'];
  2505. FScanVirusProgram := ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Program'];
  2506. FDontUseCacheFileOnBigFile := ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Value'];
  2507. FDontUseCacheFileOnBigFileSize := ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Size'];
  2508. if not DirectoryExists(FRecvFileDir) then
  2509. begin
  2510. FRecvFileDir := RealICQClient.GetUserDir + '我接收到的文件\';
  2511. if not DirectoryExists(FRecvFileDir) then
  2512. CreateDir(FRecvFileDir);
  2513. end;
  2514. if (not DirectoryExists(FCacheDir)) and FUseCacheDir then
  2515. begin
  2516. FCacheDir := RealICQClient.GetUserDir + 'CacheFiles\';
  2517. if not DirectoryExists(FCacheDir) then
  2518. CreateDir(FCacheDir);
  2519. end;
  2520. finally
  2521. XMLDocument.Free;
  2522. end;
  2523. end;
  2524. //------------------------------------------------------------------------------
  2525. procedure TMainForm.SaveReceiveFileConfigs;
  2526. var
  2527. XMLFile: string;
  2528. XMLDocument: TXMLDocument;
  2529. ReceiveFileConfigNode: IXMLNode;
  2530. begin
  2531. XMLFile := TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile;
  2532. XMLDocument := TXMLDocument.Create(Self);
  2533. try
  2534. XMLDocument.Active := True;
  2535. if not FileExists(XMLFile) then
  2536. begin
  2537. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + ReceiveFileConfigXMLFile), PChar(XMLFile), False);
  2538. XMLDocument.Active := True;
  2539. end;
  2540. XMLDocument.LoadFromFile(XMLFile);
  2541. ReceiveFileConfigNode := XMLDocument.DocumentElement;
  2542. ReceiveFileConfigNode.ChildNodes.FindNode('RecvFileDir').Attributes['Value'] := FRecvFileDir;
  2543. ReceiveFileConfigNode.ChildNodes.FindNode('UseCacheDir').Attributes['Value'] := FUseCacheDir;
  2544. ReceiveFileConfigNode.ChildNodes.FindNode('CacheDir').Attributes['Value'] := FCacheDir;
  2545. ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['Value'] := FLimitCacheDirSize;
  2546. ReceiveFileConfigNode.ChildNodes.FindNode('LimitCacheDirSize').Attributes['MaxSize'] := FMaxCacheDirSize;
  2547. ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Value'] := FAudoDeleteCacheFile;
  2548. ReceiveFileConfigNode.ChildNodes.FindNode('AudoDeleteCacheFile').Attributes['Date'] := FAudoDeleteCacheFileDate;
  2549. ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Value'] := FScanVirus;
  2550. ReceiveFileConfigNode.ChildNodes.FindNode('ScanVirus').Attributes['Program'] := FScanVirusProgram;
  2551. ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Value'] := FDontUseCacheFileOnBigFile;
  2552. ReceiveFileConfigNode.ChildNodes.FindNode('DontUseCacheFileOnBigFile').Attributes['Size'] := FDontUseCacheFileOnBigFileSize;
  2553. XMLDocument.SaveToFile();
  2554. finally
  2555. XMLDocument.Free;
  2556. end;
  2557. end;
  2558. //------------------------------------------------------------------------------
  2559. procedure TMainForm.LoadOfflineAutoResponseSets;
  2560. var
  2561. XMLFile: string;
  2562. XMLDocument: TXMLDocument;
  2563. OfflineAutoResponseConfigNode, TextNode: IXMLNode;
  2564. iLoop: Integer;
  2565. begin
  2566. XMLFile := TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile;
  2567. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2568. XMLDocument := TXMLDocument.Create(Self);
  2569. try
  2570. XMLDocument.Active := True;
  2571. if not FileExists(XMLFile) then
  2572. begin
  2573. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + OfflineAutoResponseConfigXMLFile), PChar(XMLFile), False);
  2574. XMLDocument.Active := True;
  2575. end;
  2576. XMLDocument.LoadFromFile(XMLFile);
  2577. OfflineAutoResponseConfigNode := XMLDocument.DocumentElement;
  2578. FOfflineAutoResponseTexts.Clear;
  2579. for iLoop := 0 to OfflineAutoResponseConfigNode.ChildNodes.Count - 1 do
  2580. begin
  2581. TextNode := OfflineAutoResponseConfigNode.ChildNodes[iLoop];
  2582. FOfflineAutoResponseTexts.Add(TextNode.Text);
  2583. end;
  2584. finally
  2585. XMLDocument.Free;
  2586. end;
  2587. end;
  2588. //------------------------------------------------------------------------------
  2589. procedure TMainForm.SaveOfflineAutoResponseSets;
  2590. var
  2591. XMLFile: string;
  2592. XMLDocument: TXMLDocument;
  2593. OfflineAutoResponseConfigNode: IXMLNode;
  2594. iLoop: Integer;
  2595. begin
  2596. XMLFile := TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile;
  2597. XMLDocument := TXMLDocument.Create(Self);
  2598. try
  2599. XMLDocument.Active := True;
  2600. if not FileExists(XMLFile) then
  2601. begin
  2602. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + OfflineAutoResponseConfigXMLFile), PChar(XMLFile), False);
  2603. XMLDocument.Active := True;
  2604. end;
  2605. XMLDocument.LoadFromFile(XMLFile);
  2606. OfflineAutoResponseConfigNode := XMLDocument.DocumentElement;
  2607. OfflineAutoResponseConfigNode.ChildNodes.Clear;
  2608. for iLoop := 0 to FOfflineAutoResponseTexts.Count - 1 do
  2609. begin
  2610. OfflineAutoResponseConfigNode.AddChild('Text').Text := FOfflineAutoResponseTexts.Strings[iLoop];
  2611. end;
  2612. finally
  2613. XMLDocument.SaveToFile();
  2614. XMLDocument.Free;
  2615. end;
  2616. end;
  2617. //------------------------------------------------------------------------------
  2618. procedure TMainForm.LoadHintAndSoundConfigs;
  2619. var
  2620. XMLFile: string;
  2621. XMLDocument: TXMLDocument;
  2622. HintAndSoundConfigNode: IXMLNode;
  2623. begin
  2624. XMLFile := TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile;
  2625. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2626. XMLDocument := TXMLDocument.Create(Self);
  2627. try
  2628. XMLDocument.Active := True;
  2629. if not FileExists(XMLFile) then
  2630. begin
  2631. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HintAndSoundConfigXMLFile), PChar(XMLFile), False);
  2632. XMLDocument.Active := True;
  2633. end;
  2634. XMLDocument.LoadFromFile(XMLFile);
  2635. HintAndSoundConfigNode := XMLDocument.DocumentElement;
  2636. FFlashCaptionOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('FlashCaptionOnOnline').Attributes['Value'];
  2637. FFlashCaptionOnOnline := False;
  2638. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  2639. FShowHintOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOnline').Attributes['Value'];
  2640. FShowHintOnOffline := HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOffline').Attributes['Value'];
  2641. FDontShowHintOnBusy := HintAndSoundConfigNode.ChildNodes.FindNode('DontShowHintOnBusy').Attributes['Value'];
  2642. FPlaySoundOnOnline := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['Value'];
  2643. FPlaySoundOnOffline := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['Value'];
  2644. FPlaySoundOnGetMessage := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['Value'];
  2645. FPlaySoundOnGetSystemMessage := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['Value'];
  2646. FFlashImageOnGetMessage := HintAndSoundConfigNode.ChildNodes.FindNode('FlashImageOnGetMessage').Attributes['Value'];
  2647. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow')) then
  2648. begin
  2649. HintAndSoundConfigNode.AddChild('ShowShakeWindow').Attributes['Value'] := True;
  2650. XMLDocument.SaveToFile();
  2651. end;
  2652. FShowShakeWindow := HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow').Attributes['Value'];
  2653. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage')) then
  2654. begin
  2655. HintAndSoundConfigNode.AddChild('ShowCustomMessage').Attributes['Value'] := True;
  2656. XMLDocument.SaveToFile();
  2657. end;
  2658. FShowCustomMessage := HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage').Attributes['Value'];
  2659. if not Assigned(HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted')) then
  2660. begin
  2661. HintAndSoundConfigNode.AddChild('ShowFileTransCompleted').Attributes['Value'] := True;
  2662. XMLDocument.SaveToFile();
  2663. end;
  2664. FShowFileTransCompleted := HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted').Attributes['Value'];
  2665. FOnlineEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['File'];
  2666. FOfflineEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['File'];
  2667. FMessageEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['File'];
  2668. FSystemMessageEventSound := HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['File'];
  2669. if AnsiSameText(Copy(FOnlineEventSound, 1, 5), 'Sound') then
  2670. FOnlineEventSound := ExtractFilePath(paramstr(0)) + FOnlineEventSound;
  2671. if AnsiSameText(Copy(FOfflineEventSound, 1, 5), 'Sound') then
  2672. FOfflineEventSound := ExtractFilePath(paramstr(0)) + FOfflineEventSound;
  2673. if AnsiSameText(Copy(FMessageEventSound, 1, 5), 'Sound') then
  2674. FMessageEventSound := ExtractFilePath(paramstr(0)) + FMessageEventSound;
  2675. if AnsiSameText(Copy(FSystemMessageEventSound, 1, 5), 'Sound') then
  2676. FSystemMessageEventSound := ExtractFilePath(paramstr(0)) + FSystemMessageEventSound;
  2677. finally
  2678. XMLDocument.Free;
  2679. end;
  2680. end;
  2681. //------------------------------------------------------------------------------
  2682. procedure TMainForm.SaveHintAndSoundConfigs;
  2683. var
  2684. XMLFile: string;
  2685. XMLDocument: TXMLDocument;
  2686. HintAndSoundConfigNode: IXMLNode;
  2687. begin
  2688. XMLFile := TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile;
  2689. XMLDocument := TXMLDocument.Create(Self);
  2690. try
  2691. XMLDocument.Active := True;
  2692. if not FileExists(XMLFile) then
  2693. begin
  2694. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HintAndSoundConfigXMLFile), PChar(XMLFile), False);
  2695. XMLDocument.Active := True;
  2696. end;
  2697. XMLDocument.LoadFromFile(XMLFile);
  2698. HintAndSoundConfigNode := XMLDocument.DocumentElement;
  2699. HintAndSoundConfigNode.ChildNodes.FindNode('FlashCaptionOnOnline').Attributes['Value'] := FFlashCaptionOnOnline;
  2700. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  2701. HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOnline').Attributes['Value'] := FShowHintOnOnline;
  2702. HintAndSoundConfigNode.ChildNodes.FindNode('ShowHintOnOffline').Attributes['Value'] := FShowHintOnOffline;
  2703. HintAndSoundConfigNode.ChildNodes.FindNode('DontShowHintOnBusy').Attributes['Value'] := FDontShowHintOnBusy;
  2704. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['Value'] := FPlaySoundOnOnline;
  2705. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['Value'] := FPlaySoundOnOffline;
  2706. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['Value'] := FPlaySoundOnGetMessage;
  2707. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['Value'] := FPlaySoundOnGetSystemMessage;
  2708. HintAndSoundConfigNode.ChildNodes.FindNode('FlashImageOnGetMessage').Attributes['Value'] := FFlashImageOnGetMessage;
  2709. HintAndSoundConfigNode.ChildNodes.FindNode('ShowShakeWindow').Attributes['Value'] := FShowShakeWindow;
  2710. HintAndSoundConfigNode.ChildNodes.FindNode('ShowCustomMessage').Attributes['Value'] := FShowCustomMessage;
  2711. HintAndSoundConfigNode.ChildNodes.FindNode('ShowFileTransCompleted').Attributes['Value'] := FShowFileTransCompleted;
  2712. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOnline').Attributes['File'] := FOnlineEventSound;
  2713. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnOffline').Attributes['File'] := FOfflineEventSound;
  2714. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetMessage').Attributes['File'] := FMessageEventSound;
  2715. HintAndSoundConfigNode.ChildNodes.FindNode('PlaySoundOnGetSystemMessage').Attributes['File'] := FSystemMessageEventSound;
  2716. XMLDocument.SaveToFile();
  2717. finally
  2718. XMLDocument.Free;
  2719. end;
  2720. end;
  2721. //------------------------------------------------------------------------------
  2722. procedure TMainForm.LoadHotKeyConfigs;
  2723. var
  2724. XMLFile: string;
  2725. XMLDocument: TXMLDocument;
  2726. HotKeyConfigNode: IXMLNode;
  2727. begin
  2728. XMLFile := TRealICQClient.GetUserDir + HotKeyConfigXMLFile;
  2729. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2730. XMLDocument := TXMLDocument.Create(Self);
  2731. try
  2732. XMLDocument.Active := True;
  2733. if not FileExists(XMLFile) then
  2734. begin
  2735. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HotKeyConfigXMLFile), PChar(XMLFile), False);
  2736. XMLDocument.Active := True;
  2737. end;
  2738. XMLDocument.LoadFromFile(XMLFile);
  2739. HotKeyConfigNode := XMLDocument.DocumentElement;
  2740. ReadMessageHotKey := HotKeyConfigNode.ChildNodes.FindNode('ReadMessage').Attributes['Key'];
  2741. CopyScreenHotKey := HotKeyConfigNode.ChildNodes.FindNode('CopyScreen').Attributes['Key'];
  2742. finally
  2743. XMLDocument.Free;
  2744. end;
  2745. end;
  2746. //------------------------------------------------------------------------------
  2747. procedure TMainForm.SaveHotKeyConfigs;
  2748. var
  2749. XMLFile: string;
  2750. XMLDocument: TXMLDocument;
  2751. HotKeyConfigNode: IXMLNode;
  2752. begin
  2753. XMLFile := TRealICQClient.GetUserDir + HotKeyConfigXMLFile;
  2754. XMLDocument := TXMLDocument.Create(Self);
  2755. try
  2756. XMLDocument.Active := True;
  2757. if not FileExists(XMLFile) then
  2758. begin
  2759. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + HotKeyConfigXMLFile), PChar(XMLFile), False);
  2760. XMLDocument.Active := True;
  2761. end;
  2762. XMLDocument.LoadFromFile(XMLFile);
  2763. HotKeyConfigNode := XMLDocument.DocumentElement;
  2764. HotKeyConfigNode.ChildNodes.FindNode('ReadMessage').Attributes['Key'] := FReadMessageHotKey;
  2765. HotKeyConfigNode.ChildNodes.FindNode('CopyScreen').Attributes['Key'] := FCopyScreenHotKey;
  2766. XMLDocument.SaveToFile();
  2767. finally
  2768. XMLDocument.Free;
  2769. end;
  2770. end;
  2771. procedure TMainForm.SetCopyScreenHotKey(Value: string);
  2772. var
  2773. HotKeyStr: string;
  2774. HotKey, ModKey: Cardinal;
  2775. begin
  2776. if FCopyScreenHotKey = Value then
  2777. Exit;
  2778. FCopyScreenHotKey := Value;
  2779. if AnsiPos('+', FCopyScreenHotKey) <= 0 then
  2780. FCopyScreenHotKey := 'CTRL+ALT+S';
  2781. HotKeyStr := CutOffString(trim(FCopyScreenHotKey), '+');
  2782. if AnsiPos('+', HotKeyStr) > 0 then
  2783. HotKeyStr := CutOffString(HotKeyStr, '+');
  2784. HotKey := Ord(PChar(UpperCase(HotKeyStr))[0]);
  2785. if HotKeyID_CopyScreen <> 0 then
  2786. begin
  2787. UnregisterHotKey(Handle, HotKeyID_CopyScreen);
  2788. DeleteAtom(HotKeyID_CopyScreen);
  2789. end;
  2790. if (FindAtom('FCopyScreenHotKey') = 0) and (HotKey > 0) then
  2791. begin
  2792. HotKeyID_CopyScreen := GlobalAddAtom(pchar('FCopyScreenHotKey')) - $C000;
  2793. ModKey := GetModKey(FCopyScreenHotKey);
  2794. if (not RegisterHotkey(Handle, HotKeyID_CopyScreen, ModKey, HotKey)) then
  2795. begin
  2796. FCanAlert := True;
  2797. ShowNotifyAlertForm('热键 ' + FCopyScreenHotKey + ' 冲突!');
  2798. FCanAlert := False;
  2799. end;
  2800. //MessageBox(Handle, PChar('热键 '+ FCopyScreenHotKey + ' 已被其它程序注册,请选择其它热键!'), '提示', MB_ICONERROR);
  2801. end;
  2802. SaveHotKeyConfigs;
  2803. end;
  2804. //------------------------------------------------------------------------------
  2805. procedure TMainForm.SetReadMessageHotKey(Value: string);
  2806. var
  2807. HotKeyStr: string;
  2808. HotKey, ModKey: Cardinal;
  2809. begin
  2810. if FReadMessageHotKey = Value then
  2811. Exit;
  2812. FReadMessageHotKey := Value;
  2813. if AnsiPos('+', FReadMessageHotKey) <= 0 then
  2814. FReadMessageHotKey := 'CTRL+ALT+X';
  2815. HotKeyStr := CutOffString(trim(FReadMessageHotKey), '+');
  2816. if AnsiPos('+', HotKeyStr) > 0 then
  2817. HotKeyStr := CutOffString(HotKeyStr, '+');
  2818. HotKey := Ord(PChar(UpperCase(HotKeyStr))[0]);
  2819. if HotKeyID_ReadMessage <> 0 then
  2820. begin
  2821. UnregisterHotKey(Handle, HotKeyID_ReadMessage);
  2822. DeleteAtom(HotKeyID_ReadMessage);
  2823. end;
  2824. if (FindAtom('FReadMessageHotKey') = 0) and (HotKey > 0) then
  2825. begin
  2826. HotKeyID_ReadMessage := GlobalAddAtom(pchar('FReadMessageHotKey')) - $C000;
  2827. ModKey := GetModKey(FReadMessageHotKey);
  2828. if (not RegisterHotkey(Handle, HotKeyID_ReadMessage, ModKey, HotKey)) then
  2829. begin
  2830. FCanAlert := True;
  2831. ShowNotifyAlertForm('热键 ' + FReadMessageHotKey + ' 冲突!');
  2832. FCanAlert := False;
  2833. end;
  2834. //MessageBox(Handle, PChar('热键 ' + FReadMessageHotKey + ' 已被其它程序注册,请选择其它热键!'), '提示', MB_ICONERROR);
  2835. end;
  2836. SaveHotKeyConfigs;
  2837. end;
  2838. //------------------------------------------------------------------------------
  2839. procedure TMainForm.LoadStyleConfigs;
  2840. var
  2841. XMLFile: string;
  2842. XMLDocument: TXMLDocument;
  2843. StyleConfigNode: IXMLNode;
  2844. iLoop: Integer;
  2845. RealICQContacterListView: TRealICQContacterListView;
  2846. RealICQContacterTreeView: TRealICQContacterTreeView;
  2847. AUIMainColor: TColor;
  2848. ALVStyle: TRealICQContacterListItemStyle;
  2849. ALVCaptionStyle: TRealICQContacterListItemCaptionStyle;
  2850. AShowTree: Boolean;
  2851. ASkinName, OldSkinName: string;
  2852. begin
  2853. XMLFile := TRealICQClient.GetUserDir + StyleConfigXMLFile;
  2854. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  2855. XMLDocument := TXMLDocument.Create(Self);
  2856. try
  2857. XMLDocument.Active := True;
  2858. if not FileExists(XMLFile) then
  2859. begin
  2860. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + StyleConfigXMLFile), PChar(XMLFile), False);
  2861. XMLDocument.Active := True;
  2862. end;
  2863. XMLDocument.LoadFromFile(XMLFile);
  2864. StyleConfigNode := XMLDocument.DocumentElement;
  2865. OldSkinName := SkinName;
  2866. try
  2867. ASkinName := StyleConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'];
  2868. if ASkinName <> SkinName then
  2869. begin
  2870. SkinName := ASkinName;
  2871. SaveDefaultConfigs;
  2872. ChangeUIColor(UIMainColor);
  2873. end;
  2874. except
  2875. SkinName := OldSkinName;
  2876. end;
  2877. AUIMainColor := StyleConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'];
  2878. ChangeUIColor(FUIMainColor);
  2879. FUIMainColor := AUIMainColor;
  2880. SaveDefaultConfigs;
  2881. if not Assigned(StyleConfigNode.ChildNodes.FindNode('ShowTree')) then
  2882. begin
  2883. StyleConfigNode.AddChild('ShowTree').Attributes['Value'] := True;
  2884. XMLDocument.SaveToFile();
  2885. end;
  2886. AShowTree := StyleConfigNode.ChildNodes.FindNode('ShowTree').Attributes['Value'];
  2887. FShowTree := AShowTree;
  2888. actShowTree.Checked := FShowTree;
  2889. ALVStyle := StyleConfigNode.ChildNodes.FindNode('LVStyle').Attributes['Value'];
  2890. if (RealICQClient.WorkingMode = wmCorporation) or FShowTree then
  2891. begin
  2892. if ALVStyle <> lsNoHeadImage then
  2893. ALVStyle := lsSmallHeadImage;
  2894. end;
  2895. if ALVStyle <> FLVStyle then
  2896. begin
  2897. FLVStyle := ALVStyle;
  2898. for iLoop := 0 to FContacterListViews.Count - 1 do
  2899. begin
  2900. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  2901. RealICQContacterListView.Style := FLVStyle;
  2902. end;
  2903. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  2904. begin
  2905. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  2906. RealICQContacterTreeView.Style := FLVStyle;
  2907. end;
  2908. end;
  2909. ALVCaptionStyle := StyleConfigNode.ChildNodes.FindNode('LVCaptionStyle').Attributes['Value'];
  2910. if ALVCaptionStyle <> FLVCaptionStyle then
  2911. begin
  2912. FLVCaptionStyle := ALVCaptionStyle;
  2913. for iLoop := 0 to FContacterListViews.Count - 1 do
  2914. begin
  2915. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  2916. RealICQContacterListView.CaptionStyle := FLVCaptionStyle;
  2917. end;
  2918. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  2919. begin
  2920. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  2921. RealICQContacterTreeView.CaptionStyle := FLVCaptionStyle;
  2922. end;
  2923. end;
  2924. FShowGIFInMailForm := StyleConfigNode.ChildNodes.FindNode('ShowGIFInMailForm').Attributes['Value'];
  2925. actShowGIFInMailForm.Checked := FShowGIFInMailForm;
  2926. FShowGIFInTalkingForm := StyleConfigNode.ChildNodes.FindNode('ShowGIFInTalkingForm').Attributes['Value'];
  2927. actShowGIFInTalkingForm.Checked := FShowGIFInTalkingForm;
  2928. FShowStrangers := not StyleConfigNode.ChildNodes.FindNode('ShowStrangers').Attributes['Value'];
  2929. if (RealICQClient.WorkingMode = wmCorporation) then
  2930. FShowStrangers := True;
  2931. actShowStrangers.Enabled := True;
  2932. actShowStrangers.Execute;
  2933. FShowBlacklists := not StyleConfigNode.ChildNodes.FindNode('ShowBlacklists').Attributes['Value'];
  2934. if (RealICQClient.WorkingMode = wmCorporation) then
  2935. FShowBlacklists := True;
  2936. actShowBlacklists.Enabled := True;
  2937. actShowBlacklists.Execute;
  2938. FShowTeams := not StyleConfigNode.ChildNodes.FindNode('ShowTeams').Attributes['Value'];
  2939. actShowTeams.Enabled := True;
  2940. actShowTeams.Execute;
  2941. FShowLatests := not StyleConfigNode.ChildNodes.FindNode('ShowLatests').Attributes['Value'];
  2942. actShowLatests.Enabled := True;
  2943. actShowLatests.Execute;
  2944. FTalkingFormAlwaysOnTop := StyleConfigNode.ChildNodes.FindNode('TalkingFormAlwaysOnTop').Attributes['Value'];
  2945. FCtrlEnterSendMessage := StyleConfigNode.ChildNodes.FindNode('CtrlEnterSendMessage').Attributes['Value'];
  2946. if not Assigned(StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm')) then
  2947. begin
  2948. StyleConfigNode.AddChild('CopyScreenHideTalkForm').Attributes['Value'] := False;
  2949. XMLDocument.SaveToFile();
  2950. end;
  2951. FCopyScreenHideTalkForm := StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm').Attributes['Value'];
  2952. finally
  2953. XMLDocument.Free;
  2954. end;
  2955. end;
  2956. //------------------------------------------------------------------------------
  2957. procedure TMainForm.SaveStyleConfigs;
  2958. var
  2959. XMLFile: string;
  2960. XMLDocument: TXMLDocument;
  2961. StyleConfigNode: IXMLNode;
  2962. begin
  2963. XMLFile := TRealICQClient.GetUserDir + StyleConfigXMLFile;
  2964. XMLDocument := TXMLDocument.Create(Self);
  2965. try
  2966. XMLDocument.Active := True;
  2967. if not FileExists(XMLFile) then
  2968. begin
  2969. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + StyleConfigXMLFile), PChar(XMLFile), False);
  2970. XMLDocument.Active := True;
  2971. end;
  2972. XMLDocument.LoadFromFile(XMLFile);
  2973. StyleConfigNode := XMLDocument.DocumentElement;
  2974. StyleConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'] := SkinName;
  2975. StyleConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'] := FUIMainColor;
  2976. StyleConfigNode.ChildNodes.FindNode('ShowTree').Attributes['Value'] := FShowTree;
  2977. StyleConfigNode.ChildNodes.FindNode('LVStyle').Attributes['Value'] := FLVStyle;
  2978. StyleConfigNode.ChildNodes.FindNode('LVCaptionStyle').Attributes['Value'] := FLVCaptionStyle;
  2979. StyleConfigNode.ChildNodes.FindNode('ShowStrangers').Attributes['Value'] := FShowStrangers;
  2980. StyleConfigNode.ChildNodes.FindNode('ShowBlacklists').Attributes['Value'] := FShowBlacklists;
  2981. StyleConfigNode.ChildNodes.FindNode('ShowTeams').Attributes['Value'] := FShowTeams;
  2982. StyleConfigNode.ChildNodes.FindNode('ShowLatests').Attributes['Value'] := FShowLatests;
  2983. StyleConfigNode.ChildNodes.FindNode('ShowGIFInMailForm').Attributes['Value'] := FShowGIFInMailForm;
  2984. StyleConfigNode.ChildNodes.FindNode('ShowGIFInTalkingForm').Attributes['Value'] := FShowGIFInTalkingForm;
  2985. StyleConfigNode.ChildNodes.FindNode('TalkingFormAlwaysOnTop').Attributes['Value'] := FTalkingFormAlwaysOnTop;
  2986. StyleConfigNode.ChildNodes.FindNode('CtrlEnterSendMessage').Attributes['Value'] := FCtrlEnterSendMessage;
  2987. StyleConfigNode.ChildNodes.FindNode('CopyScreenHideTalkForm').Attributes['Value'] := FCopyScreenHideTalkForm;
  2988. XMLDocument.SaveToFile();
  2989. finally
  2990. XMLDocument.Free;
  2991. end;
  2992. end;
  2993. //------------------------------------------------------------------------------
  2994. procedure TMainForm.LoadAutoUpdateConfigs;
  2995. var
  2996. XMLFile: string;
  2997. XMLDocument: TXMLDocument;
  2998. AutoUpdateConfigNode: IXMLNode;
  2999. begin
  3000. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + AutoUpdateConfigXMLFile;
  3001. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3002. XMLDocument := TXMLDocument.Create(Self);
  3003. try
  3004. XMLDocument.Active := True;
  3005. XMLDocument.LoadFromFile(XMLFile);
  3006. AutoUpdateConfigNode := XMLDocument.DocumentElement;
  3007. FAutoUpdate := AutoUpdateConfigNode.ChildNodes.FindNode('AutoUpdate').Attributes['Value'];
  3008. finally
  3009. XMLDocument.Free;
  3010. end;
  3011. end;
  3012. //------------------------------------------------------------------------------
  3013. procedure TMainForm.SaveAutoUpdateConfigs;
  3014. var
  3015. XMLFile: string;
  3016. XMLDocument: TXMLDocument;
  3017. AutoUpdateConfigNode: IXMLNode;
  3018. begin
  3019. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + AutoUpdateConfigXMLFile;
  3020. XMLDocument := TXMLDocument.Create(Self);
  3021. try
  3022. XMLDocument.Active := True;
  3023. XMLDocument.LoadFromFile(XMLFile);
  3024. AutoUpdateConfigNode := XMLDocument.DocumentElement;
  3025. AutoUpdateConfigNode.ChildNodes.FindNode('AutoUpdate').Attributes['Value'] := FAutoUpdate;
  3026. XMLDocument.SaveToFile();
  3027. finally
  3028. XMLDocument.Free;
  3029. end;
  3030. end;
  3031. //------------------------------------------------------------------------------
  3032. procedure TMainForm.LoadDefaultConfigs;
  3033. var
  3034. XMLFile: string;
  3035. XMLDocument: TXMLDocument;
  3036. DefaultConfigNode: IXMLNode;
  3037. OldSkinName: string;
  3038. BaseTop, BaseLeft: Integer;
  3039. begin
  3040. BaseTop := (Height - ClientHeight) div 2;
  3041. BaseLeft := (Width - ClientWidth) div 2;
  3042. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + DefaultConfigXMLFile;
  3043. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3044. XMLDocument := TXMLDocument.Create(Self);
  3045. try
  3046. XMLDocument.Active := True;
  3047. XMLDocument.LoadFromFile(XMLFile);
  3048. DefaultConfigNode := XMLDocument.DocumentElement;
  3049. FUIMainColor := DefaultConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'];
  3050. OldSkinName := SkinName;
  3051. try
  3052. SkinName := DefaultConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'];
  3053. except
  3054. SkinName := OldSkinName;
  3055. end;
  3056. FShowMainFormOnStart := DefaultConfigNode.ChildNodes.FindNode('ShowMainFormOnStart').Attributes['Value'];
  3057. FMainFormLeft := DefaultConfigNode.ChildNodes.FindNode('MainFormLeft').Attributes['Value'];
  3058. FMainFormTop := DefaultConfigNode.ChildNodes.FindNode('MainFormTop').Attributes['Value'];
  3059. FMainFormWidth := DefaultConfigNode.ChildNodes.FindNode('MainFormWidth').Attributes['Value'];
  3060. FMainFormHeight := DefaultConfigNode.ChildNodes.FindNode('MainFormHeight').Attributes['Value'];
  3061. FTalkingFormLeft := DefaultConfigNode.ChildNodes.FindNode('TalkingFormLeft').Attributes['Value'];
  3062. FTalkingFormTop := DefaultConfigNode.ChildNodes.FindNode('TalkingFormTop').Attributes['Value'];
  3063. FTalkingFormWidth := DefaultConfigNode.ChildNodes.FindNode('TalkingFormWidth').Attributes['Value'];
  3064. FTalkingFormHeight := DefaultConfigNode.ChildNodes.FindNode('TalkingFormHeight').Attributes['Value'];
  3065. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('TalkingRightWidth')) then
  3066. begin
  3067. DefaultConfigNode.AddChild('TalkingRightWidth').Attributes['Value'] := 0;
  3068. XMLDocument.SaveToFile();
  3069. end;
  3070. FTalkingRightWidth := DefaultConfigNode.ChildNodes.FindNode('TalkingRightWidth').Attributes['Value'];
  3071. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft')) then
  3072. begin
  3073. DefaultConfigNode.AddChild('SMSFormLeft').Attributes['Value'] := -1;
  3074. XMLDocument.SaveToFile();
  3075. end;
  3076. FSMSFormLeft := DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft').Attributes['Value'];
  3077. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormTop')) then
  3078. begin
  3079. DefaultConfigNode.AddChild('SMSFormTop').Attributes['Value'] := -1;
  3080. XMLDocument.SaveToFile();
  3081. end;
  3082. FSMSFormTop := DefaultConfigNode.ChildNodes.FindNode('SMSFormTop').Attributes['Value'];
  3083. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth')) then
  3084. begin
  3085. DefaultConfigNode.AddChild('SMSFormWidth').Attributes['Value'] := -1;
  3086. XMLDocument.SaveToFile();
  3087. end;
  3088. FSMSFormWidth := DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth').Attributes['Value'];
  3089. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight')) then
  3090. begin
  3091. DefaultConfigNode.AddChild('SMSFormHeight').Attributes['Value'] := -1;
  3092. XMLDocument.SaveToFile();
  3093. end;
  3094. FSMSFormHeight := DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight').Attributes['Value'];
  3095. if FMainFormHeight <= 0 then
  3096. FMainFormHeight := Round(Screen.WorkAreaHeight * 0.8);
  3097. if FMainFormWidth <= 0 then
  3098. FMainFormWidth := 258;
  3099. if (FMainFormLeft + FMainFormWidth - BaseLeft < 2) then
  3100. FMainFormLeft := 0;
  3101. if (FMainFormLeft - BaseLeft > Screen.WorkAreaWidth - 2) then
  3102. FMainFormLeft := Screen.WorkAreaWidth - FMainFormWidth;
  3103. if (FMainFormTop + FMainFormHeight - BaseTop < 2) then
  3104. FMainFormTop := 0;
  3105. if (FMainFormTop > Screen.WorkAreaHeight) then
  3106. FMainFormTop := 0;
  3107. if FTalkingFormHeight <= 0 then
  3108. FTalkingFormHeight := Round(Screen.WorkAreaHeight * 0.6);
  3109. if FTalkingFormWidth <= 0 then
  3110. FTalkingFormWidth := Round(Screen.WorkAreaWidth * 0.6);
  3111. if (FTalkingFormLeft < 0) or (FTalkingFormLeft > Screen.WorkAreaWidth) then
  3112. FTalkingFormLeft := (Screen.WorkAreaWidth - FTalkingFormWidth) div 2;
  3113. if (FTalkingFormTop < 0) or (FTalkingFormTop > Screen.WorkAreaHeight) then
  3114. FTalkingFormTop := (Screen.WorkAreaHeight - FTalkingFormHeight) div 2;
  3115. if FSMSFormHeight <= 0 then
  3116. FSMSFormHeight := 410;
  3117. if FSMSFormWidth <= 0 then
  3118. FSMSFormWidth := 460;
  3119. if (FSMSFormLeft < 0) or (FSMSFormLeft > Screen.WorkAreaWidth) then
  3120. FSMSFormLeft := (Screen.WorkAreaWidth - FSMSFormWidth) div 2;
  3121. if (FSMSFormTop < 0) or (FSMSFormTop > Screen.WorkAreaHeight) then
  3122. FSMSFormTop := (Screen.WorkAreaHeight - FSMSFormHeight) div 2;
  3123. Left := FMainFormLeft;
  3124. Top := FMainFormTop;
  3125. Width := FMainFormWidth;
  3126. Height := FMainFormHeight;
  3127. FAlwaysOnTop := DefaultConfigNode.ChildNodes.FindNode('AlwaysOnTop').Attributes['Value'];
  3128. actAlwaysOnTop.Enabled := True;
  3129. actAlwaysOnTop.Execute;
  3130. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm')) then
  3131. begin
  3132. DefaultConfigNode.AddChild('AutoHideMainForm').Attributes['Value'] := True;
  3133. XMLDocument.SaveToFile();
  3134. end;
  3135. FAutoHide := DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm').Attributes['Value'];
  3136. CheckWindowPositon;
  3137. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage')) then
  3138. begin
  3139. DefaultConfigNode.AddChild('AutoShowRequestMessage').Attributes['Value'] := False;
  3140. XMLDocument.SaveToFile();
  3141. end;
  3142. FAutoShowRequestMessage := DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage').Attributes['Value'];
  3143. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile')) then
  3144. begin
  3145. DefaultConfigNode.AddChild('ConfirmSendOfflineFile').Attributes['Value'] := True;
  3146. XMLDocument.SaveToFile();
  3147. end;
  3148. FConfirmSendOfflineFile := DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile').Attributes['Value'];
  3149. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('AppEnable')) then
  3150. begin
  3151. DefaultConfigNode.AddChild('AppEnable').Attributes['Value'] := False;
  3152. XMLDocument.SaveToFile();
  3153. end;
  3154. ImgApp.Visible := DefaultConfigNode.ChildNodes.FindNode('AppEnable').Attributes['Value'];
  3155. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('NewConsole')) then
  3156. begin
  3157. DefaultConfigNode.AddChild('NewConsole').Attributes['Value'] := True;
  3158. XMLDocument.SaveToFile();
  3159. end;
  3160. FNewConsole := DefaultConfigNode.ChildNodes.FindNode('NewConsole').Attributes['Value'];
  3161. if not Assigned(DefaultConfigNode.ChildNodes.FindNode('CaEnable')) then
  3162. begin
  3163. DefaultConfigNode.AddChild('CaEnable').Attributes['Value'] := False;
  3164. XMLDocument.SaveToFile();
  3165. end;
  3166. RealICQClient.CaEnable := DefaultConfigNode.ChildNodes.FindNode('CaEnable').Attributes['Value'];
  3167. btnCALogin.Visible := RealICQClient.CaEnable;
  3168. finally
  3169. XMLDocument.Free;
  3170. end;
  3171. end;
  3172. //------------------------------------------------------------------------------
  3173. procedure TMainForm.SaveDefaultConfigs;
  3174. var
  3175. XMLFile: string;
  3176. XMLDocument: TXMLDocument;
  3177. DefaultConfigNode: IXMLNode;
  3178. begin
  3179. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + DefaultConfigXMLFile;
  3180. XMLDocument := TXMLDocument.Create(Self);
  3181. try
  3182. XMLDocument.Active := True;
  3183. XMLDocument.LoadFromFile(XMLFile);
  3184. DefaultConfigNode := XMLDocument.DocumentElement;
  3185. DefaultConfigNode.ChildNodes.FindNode('SkinName').Attributes['Value'] := SkinName;
  3186. DefaultConfigNode.ChildNodes.FindNode('UIMainColor').Attributes['Value'] := FUIMainColor;
  3187. DefaultConfigNode.ChildNodes.FindNode('AlwaysOnTop').Attributes['Value'] := FAlwaysOnTop;
  3188. DefaultConfigNode.ChildNodes.FindNode('AutoHideMainForm').Attributes['Value'] := FAutoHide;
  3189. DefaultConfigNode.ChildNodes.FindNode('AutoShowRequestMessage').Attributes['Value'] := FAutoShowRequestMessage;
  3190. DefaultConfigNode.ChildNodes.FindNode('ShowMainFormOnStart').Attributes['Value'] := FShowMainFormOnStart;
  3191. try
  3192. DefaultConfigNode.ChildNodes.FindNode('ConfirmSendOfflineFile').Attributes['Value'] := FConfirmSendOfflineFile;
  3193. except
  3194. end;
  3195. DefaultConfigNode.ChildNodes.FindNode('MainFormLeft').Attributes['Value'] := FMainFormLeft;
  3196. DefaultConfigNode.ChildNodes.FindNode('MainFormTop').Attributes['Value'] := FMainFormTop;
  3197. DefaultConfigNode.ChildNodes.FindNode('MainFormWidth').Attributes['Value'] := FMainFormWidth;
  3198. DefaultConfigNode.ChildNodes.FindNode('MainFormHeight').Attributes['Value'] := FMainFormHeight;
  3199. DefaultConfigNode.ChildNodes.FindNode('TalkingFormLeft').Attributes['Value'] := FTalkingFormLeft;
  3200. DefaultConfigNode.ChildNodes.FindNode('TalkingFormTop').Attributes['Value'] := FTalkingFormTop;
  3201. DefaultConfigNode.ChildNodes.FindNode('TalkingFormWidth').Attributes['Value'] := FTalkingFormWidth;
  3202. DefaultConfigNode.ChildNodes.FindNode('TalkingFormHeight').Attributes['Value'] := FTalkingFormHeight;
  3203. DefaultConfigNode.ChildNodes.FindNode('TalkingRightWidth').Attributes['Value'] := FTalkingRightWidth;
  3204. DefaultConfigNode.ChildNodes.FindNode('SMSFormLeft').Attributes['Value'] := FSMSFormLeft;
  3205. DefaultConfigNode.ChildNodes.FindNode('SMSFormTop').Attributes['Value'] := FSMSFormTop;
  3206. DefaultConfigNode.ChildNodes.FindNode('SMSFormWidth').Attributes['Value'] := FSMSFormWidth;
  3207. DefaultConfigNode.ChildNodes.FindNode('SMSFormHeight').Attributes['Value'] := FSMSFormHeight;
  3208. XMLDocument.SaveToFile();
  3209. finally
  3210. XMLDocument.Free;
  3211. end;
  3212. end;
  3213. //------------------------------------------------------------------------------
  3214. //procedure TMainForm.LoadGroupConfig;
  3215. //var
  3216. // XMLDocument: TXMLDocument;
  3217. // ServerConfigNode: IXMLNode;
  3218. //begin
  3219. // XMLDocument := TXMLDocument.Create(Self);
  3220. // try
  3221. // XMLDocument.Active := True;
  3222. //
  3223. // if csDesigning in ComponentState then
  3224. // exit;
  3225. // XMLDocument.LoadFromFile(ExtractFilePath(Application.ExeName) + ConfigXMLFilePath + 'GroupServerConfig.xml');
  3226. //
  3227. // ServerConfigNode := XMLDocument.DocumentElement;
  3228. //
  3229. // FGroupAddress := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['Address'];
  3230. // FGroupPort := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['Port'];
  3231. // FGroupImagePort := ServerConfigNode.ChildNodes.FindNode('GroupServer').Attributes['ImagePort'];
  3232. // FGroupShareAddress := ServerConfigNode.ChildNodes.FindNode('GroupShareServer').Attributes['Address'];
  3233. // FGroupSharePort := ServerConfigNode.ChildNodes.FindNode('GroupShareServer').Attributes['Port'];
  3234. // except
  3235. // on E: Exception do
  3236. // begin
  3237. // Error(E.Message, 'TMainForm.LoadGroupConfig');
  3238. // XMLDocument.Free;
  3239. // end;
  3240. // end;
  3241. // XMLDocument.Free;
  3242. //end;
  3243. procedure TMainForm.LoadGroupConfigs;
  3244. var
  3245. XMLFile: string;
  3246. XMLDocument: TXMLDocument;
  3247. GroupConfigNode, GroupListNode, GroupNode: IXMLNode;
  3248. GroupMembers: TStringList;
  3249. iLoop, jLoop: Integer;
  3250. begin
  3251. XMLFile := TRealICQClient.GetUserDir + GroupConfigXMLFile;
  3252. SetFileAttributes(Pchar(XMLFile), file_attribute_normal);
  3253. XMLDocument := TXMLDocument.Create(Self);
  3254. try
  3255. XMLDocument.Active := True;
  3256. if not FileExists(XMLFile) then
  3257. begin
  3258. CopyFile(PChar(ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + GroupConfigXMLFile), PChar(XMLFile), False);
  3259. XMLDocument.Active := True;
  3260. end;
  3261. XMLDocument.LoadFromFile(XMLFile);
  3262. GroupConfigNode := XMLDocument.DocumentElement;
  3263. FShowGroup := GroupConfigNode.ChildNodes.FindNode('ShowGroup').Attributes['Value'];
  3264. actShowGroup.Checked := FShowGroup;
  3265. GroupListNode := GroupConfigNode.ChildNodes.FindNode('Groups');
  3266. FGroups.Clear;
  3267. for iLoop := 0 to GroupListNode.ChildNodes.Count - 1 do
  3268. begin
  3269. GroupNode := GroupListNode.ChildNodes[iLoop];
  3270. GroupMembers := TStringList.Create;
  3271. for jLoop := 0 to GroupNode.ChildNodes.Count - 1 do
  3272. begin
  3273. GroupMembers.Add(GroupNode.ChildNodes[jLoop].Text);
  3274. end;
  3275. FGroups.InsertObject(GroupNode.Attributes['Position'], GroupNode.Attributes['Name'], GroupMembers);
  3276. end;
  3277. except
  3278. on E: Exception do
  3279. begin
  3280. Error(E.Message, 'TMainForm.LoadGroupConfigs');
  3281. XMLDocument.Free;
  3282. end;
  3283. end;
  3284. XMLDocument.Free;
  3285. end;
  3286. //------------------------------------------------------------------------------
  3287. procedure TMainForm.miMoveToStrangersClick(Sender: TObject);
  3288. {var
  3289. GroupIndex, iLoop: Integer;
  3290. GroupName: String;
  3291. ListView: TRealICQContacterListView;
  3292. ListItem: TRealICQContacterListItem;
  3293. ItemIndex: Integer;
  3294. RealICQContacterTreeView: TRealICQContacterTreeView;
  3295. Employee: TRealICQEmployee; }
  3296. begin
  3297. { if MessageBox(Handle,
  3298. '确实要将选中的用户移至陌生人中吗?',
  3299. '确认',
  3300. MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then Exit;
  3301. GroupName :='陌生人';// navForContacters.Groups[navForContacters.ActiveGroupIndex];
  3302. if (GroupName = lvStrangers)then exit;
  3303. if GroupName = LVMyContacters then
  3304. begin
  3305. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3306. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3307. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  3308. RealICQClient.MoveToStrangers(Employee.LoginName);
  3309. Exit;
  3310. end;
  3311. GroupIndex := FContacterListViews.IndexOf(GroupName);
  3312. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  3313. ListView.DisableAlign;
  3314. try
  3315. for iLoop := ListView.Items.Count - 1 downto 0 do
  3316. begin
  3317. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  3318. if ListItem.Selected then
  3319. begin
  3320. RealICQClient.MoveToStrangers(ListItem.LoginName);
  3321. Sleep(15);
  3322. end;
  3323. end;
  3324. finally
  3325. ListView.EnableAlign;
  3326. end;
  3327. }
  3328. end;
  3329. procedure TMainForm.miMuteClick(Sender: TObject);
  3330. begin
  3331. FLoginState := stMute;
  3332. FLeaveMessage := '勿扰';
  3333. SetLoginStateControlState;
  3334. end;
  3335. //------------------------------------------------------------------------------
  3336. procedure TMainForm.miOnlineClick(Sender: TObject);
  3337. begin
  3338. FLoginState := stOnline;
  3339. FLeaveMessage := '';
  3340. SetLoginStateControlState;
  3341. end;
  3342. //------------------------------------------------------------------------------
  3343. procedure TMainForm.miOtherStateClick(Sender: TObject);
  3344. var
  3345. LeaveMessage: string;
  3346. begin
  3347. LeaveMessage := Trim(ShowMyInputBox('其它状态', '请输入离开状态说明文字', '', 16));
  3348. if Length(LeaveMessage) > 0 then
  3349. begin
  3350. FLoginState := stLeave;
  3351. FLeaveMessage := LeaveMessage;
  3352. SetLoginStateControlState;
  3353. end;
  3354. end;
  3355. //------------------------------------------------------------------------------
  3356. procedure TMainForm.miMoveToBlacklistsClick(Sender: TObject);
  3357. var
  3358. GroupName: string;
  3359. TreeView: TRealICQContacterTreeView;
  3360. ItemIndex: Integer;
  3361. Friend: TRealICQEmployee;
  3362. Black: TRealICQEmployee;
  3363. begin
  3364. if MessageBox(Handle, '确实要将选中的用户移至黑名单吗?', '确认', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  3365. Exit;
  3366. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  3367. TreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3368. Friend := TreeView.GetSelectedEmployee;
  3369. if Friend = nil then
  3370. Exit;
  3371. Black := TRealICQEmployee.Create(Friend.LoginName);
  3372. Black.BranchID := LvBlackLists;
  3373. Black.DisplayName := Friend.DisplayName;
  3374. GroupName := Friend.BranchID;
  3375. if (GroupName = lvBlacklists) then
  3376. exit;
  3377. if GroupName = LvFriends then
  3378. begin
  3379. RealICQClient.DelFriend(Friend.LoginName);
  3380. RealICQClient.MoveToBlacklists(Friend.LoginName);
  3381. TreeView.AddEmployee(Black);
  3382. end;
  3383. end;
  3384. procedure TMainForm.miSkinClick(Sender: TObject);
  3385. var
  3386. OldSkin: string;
  3387. begin
  3388. OldSkin := SkinName;
  3389. try
  3390. SkinName := (Sender as TMenuItem).Caption;
  3391. ChangeAddFriendFormSkin(SkinName);
  3392. ChangeAddFriendRequestFormSkin(SkinName);
  3393. ChangeTalkingFormSkin(SkinName);
  3394. ChangeSMSFormSkin(SkinName);
  3395. ChangeSeeUserInformationFormsSkin(SkinName);
  3396. ChangeSystemMessageFormsSkin(SkinName);
  3397. ChangeTeamOptionsFormSkin(SkinName);
  3398. if VideoForm <> nil then
  3399. begin
  3400. VideoForm.SkinName := SkinName;
  3401. VideoForm.ChangeUIColor(VideoForm.TalkingForm.WindowColor);
  3402. end;
  3403. if CreateTeamForm <> nil then
  3404. begin
  3405. CreateTeamForm.SkinName := SkinName;
  3406. CreateTeamForm.ChangeUIColor(UIMainColor);
  3407. end;
  3408. if SearchForm <> nil then
  3409. begin
  3410. SearchForm.SkinName := SkinName;
  3411. SearchForm.ChangeUIColor(UIMainColor);
  3412. end;
  3413. if SearchTeamForm <> nil then
  3414. begin
  3415. SearchTeamForm.SkinName := SkinName;
  3416. SearchTeamForm.ChangeUIColor(UIMainColor);
  3417. end;
  3418. if CustomFacesManagerForm <> nil then
  3419. begin
  3420. CustomFacesManagerForm.SkinName := SkinName;
  3421. CustomFacesManagerForm.ChangeUIColor(UIMainColor);
  3422. end;
  3423. if VCardForm <> nil then
  3424. begin
  3425. VCardForm.SkinName := SkinName;
  3426. VCardForm.ChangeUIColor(UIMainColor);
  3427. end;
  3428. except
  3429. MessageBox(Handle, '加载界面时出错!', '错误', MB_ICONERROR);
  3430. SkinName := OldSkin;
  3431. end;
  3432. ChangeUIColor(UIMainColor);
  3433. PostMessage(Handle, WM_SIZE, 0, 0);
  3434. if RealICQClient.Logined and RealICQClient.Connected then
  3435. SaveStyleConfigs;
  3436. SaveDefaultConfigs;
  3437. end;
  3438. //----------------------------------------------------
  3439. procedure TMainForm.ImageButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  3440. begin
  3441. FHintWindow.ReleaseHandle;
  3442. FHintWindow.Visible := False;
  3443. SetToolBarState(Sender);
  3444. end;
  3445. procedure TMainForm.tsContactersResize(Sender: TObject);
  3446. begin
  3447. { TODO -olqq -c : 注释 2015/1/22 15:30:11 }
  3448. // ScrollBoxContacters.Width := pnlGroups.Width;
  3449. // PnlMoreUser.Width := pnlGroups.Width;
  3450. // ScrollBoxMyFriend.Width := pnlGroups.Width;
  3451. // ScrollBoxTeam.Width := pnlGroups.Width;
  3452. // ScrollBoxLatests.Width := pnlGroups.Width;
  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. // ScrollBoxContacters.Top := 0;
  3478. // PnlMoreUser.Top := 0;
  3479. // ScrollBoxMyFriend.Top := 0;
  3480. // ScrollBoxTeam.Top := 0;
  3481. // ScrollBoxLatests.Top := 0;
  3482. tsContactersResize(tsContacters);
  3483. end;
  3484. //-----------------------------------------------------
  3485. procedure TMainForm.SetToolBarState(Sender: TObject);
  3486. var
  3487. ImageButton: TRealICQHoverImage;
  3488. TmpImageButton: TRealICQHoverImage;
  3489. TmpImageButtonIcon: TRealICQHoverImage;
  3490. iLoop: Integer;
  3491. OldControl, NewControl: TWinControl;
  3492. ItemIndex, divSize: Integer;
  3493. RealICQContacterTreeView: TRealICQContacterTreeView;
  3494. begin
  3495. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3496. OldControl := nil;
  3497. if ScrollBoxContacters.Visible then
  3498. OldControl := ScrollBoxContacters;
  3499. if PnlMoreUser.Visible then
  3500. OldControl := PnlMoreUser;
  3501. if ScrollBoxMyFriend.Visible then
  3502. OldControl := ScrollBoxMyFriend;
  3503. if ScrollBoxTeam.Visible then
  3504. OldControl := ScrollBoxTeam;
  3505. if ScrollBoxLatests.Visible then
  3506. OldControl := ScrollBoxLatests;
  3507. {if ImageButton.Tag = 2 then
  3508. begin
  3509. if ScrollBoxMoreUser.Tag = 0 then
  3510. begin
  3511. ScrollBoxMoreUser.Tag := 1;
  3512. end;
  3513. end; }
  3514. NewControl := nil;
  3515. if ImageButton.Tag = 1 then
  3516. NewControl := ScrollBoxContacters;
  3517. if ImageButton.Tag = 2 then
  3518. NewControl := PnlMoreUser;
  3519. if ImageButton.Tag = 3 then
  3520. NewControl := ScrollBoxMyFriend;
  3521. if ImageButton.Tag = 4 then
  3522. NewControl := ScrollBoxTeam;
  3523. if ImageButton.Tag = 5 then
  3524. NewControl := ScrollBoxLatests;
  3525. if False and (OldControl <> nil) then
  3526. begin
  3527. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3528. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3529. RealICQContacterTreeView.HideScroll;
  3530. RealICQContacterTreeView.ReDrawAll;
  3531. RealICQContacterTreeView.BeginUpdate;
  3532. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  3533. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3534. RealICQContacterTreeView.HideScroll;
  3535. RealICQContacterTreeView.ReDrawAll;
  3536. RealICQContacterTreeView.BeginUpdate;
  3537. Application.ProcessMessages;
  3538. //Exit;
  3539. NewControl.DisableAlign;
  3540. NewControl.Enabled := False;
  3541. OldControl.DisableAlign;
  3542. OldControl.Enabled := False;
  3543. divSize := pnlGroups.Width div 10;
  3544. try
  3545. if OldControl.Tag < NewControl.Tag then
  3546. begin
  3547. NewControl.Left := OldControl.Left + OldControl.Width;
  3548. NewControl.Visible := True;
  3549. while NewControl.Left > 0 do
  3550. begin
  3551. if NewControl.Left - divSize < 0 then
  3552. begin
  3553. NewControl.Left := 0;
  3554. end
  3555. else
  3556. begin
  3557. OldControl.Left := OldControl.Left - divSize;
  3558. NewControl.Left := NewControl.Left - divSize;
  3559. end;
  3560. Application.ProcessMessages;
  3561. Sleep(10);
  3562. end;
  3563. OldControl.Visible := False;
  3564. end
  3565. else
  3566. begin
  3567. NewControl.Left := OldControl.Left - OldControl.Width;
  3568. NewControl.Visible := True;
  3569. while NewControl.Left < 0 do
  3570. begin
  3571. if NewControl.Left + divSize > 0 then
  3572. begin
  3573. NewControl.Left := 0;
  3574. end
  3575. else
  3576. begin
  3577. OldControl.Left := OldControl.Left + divSize;
  3578. NewControl.Left := NewControl.Left + divSize;
  3579. end;
  3580. Application.ProcessMessages;
  3581. Sleep(10);
  3582. end;
  3583. OldControl.Visible := False;
  3584. end;
  3585. finally
  3586. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  3587. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3588. RealICQContacterTreeView.EndUpdate;
  3589. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  3590. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3591. RealICQContacterTreeView.EndUpdate;
  3592. NewControl.EnableAlign;
  3593. NewControl.Enabled := True;
  3594. OldControl.EnableAlign;
  3595. OldControl.Enabled := True;
  3596. end;
  3597. end
  3598. else
  3599. begin
  3600. if OldControl <> nil then
  3601. OldControl.Visible := False;
  3602. NewControl.Left := 0;
  3603. NewControl.Visible := True;
  3604. end;
  3605. pnlTeams.Visible := ImageButton.Tag = 4;
  3606. if pnlTeams.Visible then
  3607. pnlTeams.Height := 22
  3608. else
  3609. pnlTeams.Height := 0;
  3610. {ScrollBoxContacters.Visible := ImageButton.Tag = 1;
  3611. PnlMoreUser.Visible := ImageButton.Tag = 2;
  3612. ScrollBoxMyFriend.Visible := ImageButton.Tag = 3;
  3613. ScrollBoxTeam.Visible := ImageButton.Tag = 4;
  3614. pnlTeams.Visible := ImageButton.Tag = 4;
  3615. if pnlTeams.Visible then
  3616. pnlTeams.Height := 22
  3617. else
  3618. pnlTeams.Height := 0;
  3619. ScrollBoxLatests.Visible := ImageButton.Tag = 5; }
  3620. ActiveButtonTag := ImageButton.Tag;
  3621. for iLoop := 0 to FToolBarButtonList.Count - 1 do
  3622. begin
  3623. TmpImageButton := FToolBarButtonList.Objects[iLoop] as TRealICQHoverImage;
  3624. TmpImageButtonIcon := FToolBarButtonIconList.Objects[iLoop] as TRealICQHoverImage;
  3625. if TmpImageButton.Tag = ImageButton.Tag then
  3626. begin
  3627. TmpImageButton.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\menu\01_On.bmp');
  3628. TmpImageButton.OnMouseUp := nil;
  3629. TmpImageButton.OnMouseEnter := nil;
  3630. TmpImageButton.OnMouseLeave := nil;
  3631. TmpImageButtonIcon.OnMouseUp := nil;
  3632. TmpImageButtonIcon.OnMouseEnter := nil;
  3633. TmpImageButtonIcon.OnMouseLeave := nil;
  3634. end
  3635. else
  3636. begin
  3637. TmpImageButton.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\menu\01_Off.bmp');
  3638. TmpImageButton.OnMouseUp := ImageButtonMouseUp;
  3639. TmpImageButton.OnMouseEnter := ImageButtonEnter;
  3640. TmpImageButton.OnMouseLeave := ImageButtonLeave;
  3641. TmpImageButtonIcon.OnMouseUp := ImageButtonMouseUp;
  3642. TmpImageButtonIcon.OnMouseEnter := ImageButtonEnter;
  3643. TmpImageButtonIcon.OnMouseLeave := ImageButtonLeave;
  3644. end;
  3645. ConvertBitmapToColor(TmpImageButton.Picture.Bitmap, UIMainColor);
  3646. end;
  3647. end;
  3648. //----------------------------
  3649. procedure TMainForm.ImageButtonEnter(Sender: TObject);
  3650. var
  3651. ImageButton: TRealICQHoverImage;
  3652. ImagePath: string;
  3653. procedure OpenHint(HintStr: string);
  3654. var
  3655. TextWidth, TextHeight: Integer;
  3656. rect: TRect;
  3657. begin
  3658. TextWidth := FHintWindow.Canvas.TextWidth(HintStr);
  3659. TextHeight := FHintWindow.Canvas.TextHeight(HintStr);
  3660. rect.Left := Mouse.CursorPos.X;
  3661. rect.Top := Mouse.CursorPos.Y + 20;
  3662. rect.Right := rect.Left + TextWidth + 5;
  3663. rect.Bottom := rect.Top + TextHeight;
  3664. FHintWindow.Color := clInfoBk;
  3665. FHintWindow.ActivateHint(Rect, HintStr);
  3666. FHintWindow.Visible := True;
  3667. end;
  3668. begin
  3669. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3670. ImagePath := ExtractFilePath(Application.ExeName) + 'Images\menu\01_Over.bmp';
  3671. ImageButton.Picture.LoadFromFile(ImagePath);
  3672. ConvertBitmapToColor(ImageButton.Picture.Bitmap, UIMainColor);
  3673. OpenHint(FToolBarButtonList[ImageButton.Tag - 1]);
  3674. end;
  3675. //-----------------------------
  3676. procedure TMainForm.ImageButtonLeave(Sender: TObject);
  3677. var
  3678. ImageButton: TRealICQHoverImage;
  3679. ImagePath: string;
  3680. begin
  3681. ImageButton := FToolBarButtonList.Objects[(Sender as TRealICQHoverImage).Tag - 1] as TRealICQHoverImage;
  3682. ImagePath := ExtractFilePath(Application.ExeName) + 'Images\menu\01_Off.bmp';
  3683. ImageButton.Picture.LoadFromFile(ImagePath);
  3684. ConvertBitmapToColor(ImageButton.Picture.Bitmap, UIMainColor);
  3685. FHintWindow.ReleaseHandle;
  3686. FHintWindow.Visible := False;
  3687. end;
  3688. procedure TMainForm.miChangeLoginNameClick(Sender: TObject);
  3689. var
  3690. LoginUser: TLoginUser;
  3691. begin
  3692. try
  3693. LoginUser := RealICQClient.LoginedUsers.Objects[(Sender as TMenuItem).Tag] as TLoginUser;
  3694. edPassword.Text := '';
  3695. edLoginName.Text := LoginUser.LoginName;
  3696. if (LoginUser.Password <> '') and (LoginUser.LoginName <> '') then
  3697. begin
  3698. edPassword.Text := RealICQClient.DecyptPassword(LoginUser.Password);
  3699. FSavePassword := True;
  3700. self.ImgLstCheckStates.GetIcon(1, spbSavePassword.Icon);
  3701. end;
  3702. self.lblRemoveMyLoginInfo.Visible := True;
  3703. except
  3704. edLoginName.Text := '';
  3705. end;
  3706. end;
  3707. //------------------------------------------------------------------------------
  3708. procedure TMainForm.miClearLoginHistoryClick(Sender: TObject);
  3709. var
  3710. ClearAll: Boolean;
  3711. begin
  3712. ClearAll := True;
  3713. if UpperCase(Sender.ClassName) = UpperCase('TLabel') then
  3714. ClearAll := False;
  3715. MainForm.RealICQClient.ClearLoginHistory(ClearAll, edLoginName.Text);
  3716. edLoginName.Text := '';
  3717. edPassword.Text := '';
  3718. actLoginAs.Visible := False;
  3719. SetLoginControlsVisible(True);
  3720. end;
  3721. //------------------------------------------------------------------------------
  3722. procedure TMainForm.miColorClick(Sender: TObject);
  3723. begin
  3724. FUIMainColor := (Sender as TMenuItem).Tag;
  3725. ChangeUIColor((Sender as TMenuItem).Tag);
  3726. if RealICQClient.Logined and RealICQClient.Connected then
  3727. SaveStyleConfigs;
  3728. SaveDefaultConfigs;
  3729. end;
  3730. //------------------------------------------------------------------------------
  3731. procedure TMainForm.miHiddenClick(Sender: TObject);
  3732. begin
  3733. FLoginState := stHidden;
  3734. FLeaveMessage := '';
  3735. SetLoginStateControlState;
  3736. end;
  3737. //------------------------------------------------------------------------------
  3738. procedure TMainForm.miMeetingClick(Sender: TObject);
  3739. begin
  3740. FLoginState := stLeave;
  3741. FLeaveMessage := (Sender as TMenuItem).Caption;
  3742. SetLoginStateControlState;
  3743. end;
  3744. //------------------------------------------------------------------------------
  3745. procedure TMainForm.miMoreColorsClick(Sender: TObject);
  3746. begin
  3747. ColorDialog.Color := FUIMainColor;
  3748. if ColorDialog.Execute then
  3749. begin
  3750. ChangeUIColor(ColorDialog.Color);
  3751. FUIMainColor := ColorDialog.Color;
  3752. if RealICQClient.Logined and RealICQClient.Connected then
  3753. SaveStyleConfigs;
  3754. SaveDefaultConfigs;
  3755. end;
  3756. end;
  3757. //------------------------------------------------------------------------------
  3758. procedure TMainForm.miMoveGroupClick(Sender: TObject);
  3759. var
  3760. GroupName, TargetGroupName: string;
  3761. MenuItem: TMenuItem;
  3762. GroupIndex, itemIndex: Integer;
  3763. TreeView: TRealICQContacterTreeView;
  3764. Friend: TRealICQEmployee;
  3765. GroupMembers, TargetGroupMembers: TStringList;
  3766. RealICQUser: TRealICQUser;
  3767. OldScrollBarTop: Integer;
  3768. begin
  3769. MenuItem := Sender as TMenuItem;
  3770. if MenuItem <> nil then
  3771. TargetGroupName := MenuItem.Caption
  3772. else
  3773. TargetGroupName := LVFriends;
  3774. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  3775. TreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  3776. Friend := TreeView.GetSelectedEmployee;
  3777. if Friend = nil then
  3778. Exit;
  3779. GroupName := Friend.BranchID;
  3780. OldScrollBarTop := TreeView.ScrollBarTop;
  3781. SetFlashCaptionOnOnlineValue(False);
  3782. LockWindowUpdate(GetDesktopWindow);
  3783. try
  3784. if FGroups.IndexOf(GroupName) >= 0 then
  3785. begin
  3786. GroupIndex := FGroups.IndexOf(GroupName);
  3787. GroupMembers := FGroups.Objects[GroupIndex] as TStringList;
  3788. GroupMembers.Delete(GroupMembers.IndexOf(Friend.LoginName));
  3789. end;
  3790. RealICQUser := Friend.Data;
  3791. TreeView.EmployeeItems.Delete(TreeView.EmployeeItems.IndexOf(Friend.LoginName));
  3792. //在树节点之间移动()
  3793. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  3794. Friend.BranchID := TargetGroupName;
  3795. TreeView.AddEmployee(Friend);
  3796. //UpdateFriendNode(Friend, RealICQUser, True);
  3797. TUsersService.GetUsersService.UpdateTreeNode(TreeView, Friend, RealICQUser);
  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. //------------------------------------------------------------------------------
  3838. procedure TMainForm.NodeIconButtonClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  3839. var
  3840. RealICQUser: TRealICQUser;
  3841. begin
  3842. if IconButtonType = itHeadImage then
  3843. begin
  3844. HideUserCardForm;
  3845. end;
  3846. if IconButtonType = itSNS then
  3847. begin
  3848. RealICQUser := Employee.Data;
  3849. RealICQUser.ClickedSNSIcon;
  3850. try
  3851. RealICQClientUserInformationReady(RealICQClient, RealICQUser);
  3852. //UpdateEmployeeNode(Employee, RealICQUser, True);
  3853. //TUsersService.GetUsersService.UpdateTreeNode(Employee, RealICQUser, True);
  3854. finally
  3855. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + SNSHomePage, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(RealICQUser.LoginName)])), '', SW_SHOWDEFAULT);
  3856. end;
  3857. end;
  3858. end;
  3859. //小图标双击事件处理
  3860. //------------------------------------------------------------------------------
  3861. procedure TMainForm.NodeIconButtonDblClick(Sender: TObject; Employee: TRealICQEmployee; IconButtonType: TRealICQContacterTreeNodeIconButtonType);
  3862. var
  3863. TalkingForm: TTalkingForm;
  3864. iWaitTimes: Integer;
  3865. RealICQUser: TRealICQUser;
  3866. SMSForm: TSMSForm;
  3867. begin
  3868. HideUserCardForm;
  3869. if (pgcMainWorkArea.ActivePage = tsAddrBook) then
  3870. begin
  3871. SMSForm := OpenSMSForm('', True);
  3872. SMSForm.edMobiles.Text := Employee.Mobile;
  3873. Exit;
  3874. end;
  3875. if IconButtonType = itCamera then
  3876. begin
  3877. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3878. begin
  3879. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3880. Exit;
  3881. end;
  3882. TalkingForm := GetTalkingForm(Employee.LoginName);
  3883. if TalkingForm = nil then
  3884. begin
  3885. TalkingForm := OpenTalkingForm(Employee.LoginName, True);
  3886. end;
  3887. iWaitTimes := 0;
  3888. while not TalkingForm.CanWriteMessage do
  3889. begin
  3890. Application.ProcessMessages;
  3891. Inc(iWaitTimes);
  3892. if iWaitTimes > 1000 then
  3893. break;
  3894. Sleep(10);
  3895. end;
  3896. TalkingForm.actVideo.Execute;
  3897. end;
  3898. if IconButtonType = itHeadImage then
  3899. begin
  3900. if pgcMainWorkArea.ActivePage = tsAddrBook then
  3901. Exit;
  3902. if AnsiSameText(Employee.LoginName, RealICQClient.Me.LoginName) then
  3903. begin
  3904. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  3905. Exit;
  3906. end;
  3907. //Employee.UserType
  3908. OpenTalkingForm(Employee.LoginName, True);
  3909. //Employee.UserType
  3910. end;
  3911. if IconButtonType = itSMS then
  3912. begin
  3913. OpenSMSForm(Employee.LoginName, True);
  3914. end;
  3915. if IconButtonType = itEmail then
  3916. begin
  3917. ShellExecute(Handle, 'open', PChar('"mailto:' + Employee.Email +'"'), nil, nil, SW_SHOWNORMAL);
  3918. //AddWebBrowserToPageControl(Format('http://mail.lishui.gov.cn/web_email/module.phtml?module=mcomposef&to=%s', [RealICQUser.Email]), 999);
  3919. //AddWebBrowserToPageControl(Format('http://www.lxtalk.com/rd/', [RealICQUser.Email]), 999);
  3920. end;
  3921. if IconButtonType = itAddFriend then
  3922. begin
  3923. //MessageBox(Handle, '添加好友', '提示', MB_ICONINFORMATION);
  3924. if AnsiSameText(MainForm.RealICQClient.LoginName, Employee.LoginName) then
  3925. begin
  3926. MessageBox(Handle, '不能添加自己为好友', '提示', MB_ICONINFORMATION);
  3927. Exit;
  3928. end;
  3929. ShowAddFriendWindow(Self, Employee.LoginName, Employee.DisplayName);
  3930. end;
  3931. if IconButtonType = itTel then
  3932. begin
  3933. MessageBox(Handle, '电话', '提示', MB_ICONINFORMATION);
  3934. { if not FPCAMessage.GetPCALoginStatus then Exit;
  3935. if (Employee.Mobile<>'') and (Employee.Tel<>'') then
  3936. begin
  3937. MenuItem:=ppSelCallTel.Items[0];
  3938. MenuItem.Hint:=Employee.Mobile+char(10)+Employee.DisplayName;
  3939. MenuItem:=ppSelCallTel.Items[1];
  3940. MenuItem.Hint:=Employee.Tel+char(10)+Employee.DisplayName;
  3941. ppSelCallTel.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y - 50);
  3942. Exit;
  3943. end;
  3944. if Employee.Mobile<>'' then CallNumber:=Employee.Mobile;
  3945. if Employee.Tel<>'' then CallNumber:=Employee.Tel;
  3946. FPCAMessage.SendCallTelOutPCAMessage(CallNumber,Employee.DisplayName);
  3947. }
  3948. end;
  3949. end;
  3950. //------------------------------------------------------------------------------
  3951. procedure TMainForm.miGoSpaceClick(Sender: TObject);
  3952. var
  3953. LoginName: string;
  3954. RealICQUser: TRealICQUser;
  3955. begin
  3956. LoginName := GetSelectedLoginName;
  3957. if LoginName <> '' then
  3958. begin
  3959. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  3960. RealICQUser.ClickedSNSIcon;
  3961. try
  3962. RealICQClientUserInformationReady(RealICQClient, RealICQUser);
  3963. finally
  3964. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + SNSHomePage, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(RealICQUser.LoginName)])), '', SW_SHOWDEFAULT);
  3965. end;
  3966. end;
  3967. end;
  3968. //------------------------------------------------------------------------------
  3969. procedure TMainForm.NodeOnline(Employee: TRealICQEmployee);
  3970. var
  3971. ARealICQUser: TRealICQUser;
  3972. begin
  3973. //MessageBox(Handle, '4', '4', MB_OK);
  3974. if RealICQClient.Me = nil then
  3975. Exit;
  3976. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  3977. Exit;
  3978. //MessageBox(Handle, '5', '5', MB_OK);
  3979. if Employee.Data <> nil then
  3980. begin
  3981. ARealICQUser := TRealICQUser(Employee.Data);
  3982. if ARealICQUser = RealICQClient.Me then
  3983. Exit;
  3984. if PlaySoundOnOnline then
  3985. PlayEventSound(OnlineEventSound);
  3986. if ShowHintOnOnline then
  3987. ShowOnOffAlertForm(ARealICQUser);
  3988. end;
  3989. //MessageBox(Handle, '6', '6', MB_OK);
  3990. end;
  3991. //------------------------------------------------------------------------------
  3992. procedure TMainForm.NodeOffline(Employee: TRealICQEmployee);
  3993. var
  3994. ARealICQUser: TRealICQUser;
  3995. begin
  3996. if RealICQClient.Me = nil then
  3997. Exit;
  3998. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  3999. Exit;
  4000. if Employee.Data <> nil then
  4001. begin
  4002. ARealICQUser := TRealICQUser(Employee.Data);
  4003. if ARealICQUser = RealICQClient.Me then
  4004. Exit;
  4005. if PlaySoundOnOffline then
  4006. PlayEventSound(OfflineEventSound);
  4007. if ShowHintOnOffline then
  4008. ShowOnOffAlertForm(ARealICQUser);
  4009. end;
  4010. end;
  4011. procedure TMainForm.TimerForShowUserCardTimer(Sender: TObject);
  4012. begin
  4013. TimerForShowUserCard.Enabled := False;
  4014. TimerForHideUserCard.Enabled := False;
  4015. if not Assigned(UserCardForm) then
  4016. UserCardForm := TUserCardForm.Create(Self);
  4017. UserCardForm.TargetTop := FShowUserCardTargetTop;
  4018. UserCardForm.LoginName := FNeedShowUserCardLoginName;
  4019. // if not Assigned(UserCardViewForm) then
  4020. // UserCardViewForm := TUserCardViewForm.Create(Self);
  4021. // UserCardViewForm.TargetTop := FShowUserCardTargetTop;
  4022. // UserCardViewForm.Update(FNeedShowUserCardLoginName);
  4023. end;
  4024. //------------------------------------------------------------------------------
  4025. procedure TMainForm.TimerForHideUserCardTimer(Sender: TObject);
  4026. var
  4027. Rect: TRect;
  4028. begin
  4029. TimerForHideUserCard.Enabled := False;
  4030. if Assigned(UserCardForm) then
  4031. begin
  4032. Rect.Left := UserCardForm.Left;
  4033. Rect.Top := UserCardForm.Top;
  4034. Rect.Right := UserCardForm.Left + UserCardForm.Width;
  4035. Rect.Bottom := UserCardForm.Top + UserCardForm.Height;
  4036. if PtInRect(Rect, Mouse.CursorPos) then
  4037. begin
  4038. UserCardForm.TimerForClose.Enabled := True;
  4039. Exit;
  4040. end;
  4041. end;
  4042. if not TimerForShowUserCard.Enabled then
  4043. FreeAndNil(UserCardForm);
  4044. // TimerForHideUserCard.Enabled := False;
  4045. // if Assigned(UserCardViewForm) then
  4046. // begin
  4047. // Rect.Left := UserCardViewForm.Left;
  4048. // Rect.Top := UserCardViewForm.Top;
  4049. // Rect.Right := UserCardViewForm.Left + UserCardViewForm.Width;
  4050. // Rect.Bottom := UserCardViewForm.Top + UserCardViewForm.Height;
  4051. // if PtInRect(Rect, Mouse.CursorPos) then
  4052. // begin
  4053. // UserCardViewForm.tmrForClose.Enabled := True;
  4054. // Exit;
  4055. // end;
  4056. // end;
  4057. // if not TimerForShowUserCard.Enabled then
  4058. // FreeAndNil(UserCardViewForm);
  4059. end;
  4060. //------------------------------------------------------------------------------
  4061. procedure TMainForm.NodeOnHeadImageMouseEnter(Employee: TRealICQEmployee);
  4062. var
  4063. Rect: TRect;
  4064. P: TPoint;
  4065. begin
  4066. Rect := Employee.Node.DisplayRect(False);
  4067. P.X := Rect.Left;
  4068. P.Y := Rect.Top;
  4069. P := Employee.Node.TreeView.ClientToScreen(P);
  4070. if UserCardForm <> nil then
  4071. begin
  4072. FNeedShowUserCardLoginName := Employee.LoginName;
  4073. FShowUserCardTargetTop := P.Y;
  4074. TimerForShowUserCardTimer(nil);
  4075. end
  4076. else
  4077. begin
  4078. ShowUserCardForm(Employee.LoginName, P.Y);
  4079. end;
  4080. end;
  4081. procedure TMainForm.NodeOnHeadImageMouseLeave(Employee: TRealICQEmployee);
  4082. begin
  4083. HideUserCardForm;
  4084. end;
  4085. procedure TMainForm.ItemOnHeadImageEnter(Item: TRealICQContacterListItem);
  4086. var
  4087. Rect: TRect;
  4088. P: TPoint;
  4089. begin
  4090. Rect := Item.ListView.ListBox.ItemRect(Item.ItemIndex);
  4091. P.X := Rect.Left;
  4092. P.Y := Rect.Top;
  4093. P := Item.ListView.ListBox.ClientToScreen(P);
  4094. if UserCardForm <> nil then
  4095. begin
  4096. FNeedShowUserCardLoginName := Item.LoginName;
  4097. FShowUserCardTargetTop := P.Y;
  4098. TimerForShowUserCardTimer(nil);
  4099. end
  4100. else
  4101. begin
  4102. ShowUserCardForm(Item.LoginName, P.Y);
  4103. end;
  4104. end;
  4105. procedure TMainForm.ItemOnHeadImageLeave(Item: TRealICQContacterListItem);
  4106. begin
  4107. HideUserCardForm;
  4108. end;
  4109. procedure TMainForm.imgHeadImageBorderMouseEnter(Sender: TObject);
  4110. var
  4111. P: TPoint;
  4112. begin
  4113. P.X := 0;
  4114. P.Y := 0;
  4115. P := imgHeadImageBorder.ClientToScreen(P);
  4116. if UserCardForm <> nil then
  4117. begin
  4118. FNeedShowUserCardLoginName := RealICQClient.LoginName;
  4119. FShowUserCardTargetTop := P.Y;
  4120. TimerForShowUserCardTimer(nil);
  4121. end
  4122. else
  4123. begin
  4124. ShowUserCardForm(RealICQClient.LoginName, P.Y);
  4125. end;
  4126. end;
  4127. procedure TMainForm.imgHeadImageBorderMouseLeave(Sender: TObject);
  4128. begin
  4129. HideUserCardForm;
  4130. end;
  4131. procedure TMainForm.ShowUserCardForm(ALoginName: string; ATargetTop: Integer);
  4132. begin
  4133. FNeedShowUserCardLoginName := ALoginName;
  4134. FShowUserCardTargetTop := ATargetTop;
  4135. TimerForShowUserCard.Enabled := False;
  4136. TimerForShowUserCard.Enabled := True;
  4137. TimerForHideUserCard.Enabled := False;
  4138. end;
  4139. procedure TMainForm.HideUserCardForm;
  4140. begin
  4141. if TimerForHideUserCard <> nil then
  4142. begin
  4143. TimerForHideUserCard.Enabled := False;
  4144. TimerForHideUserCard.Enabled := True;
  4145. TimerForShowUserCard.Enabled := False;
  4146. end;
  4147. end;
  4148. //------------------------------------------------------------------------------
  4149. procedure TMainForm.NodeOnMouseEnter(Employee: TRealICQEmployee);
  4150. begin
  4151. end;
  4152. //------------------------------------------------------------------------------
  4153. procedure TMainForm.NodeOnMouseLeave(Employee: TRealICQEmployee);
  4154. begin
  4155. end;
  4156. //------------------------------------------------------------------------------
  4157. procedure TMainForm.ItemOnMouseEnter(Item: TRealICQContacterListItem);
  4158. begin
  4159. end;
  4160. //------------------------------------------------------------------------------
  4161. procedure TMainForm.ItemOnMouseLeave(Item: TRealICQContacterListItem);
  4162. begin
  4163. end;
  4164. //------------------------------------------------------------------------------
  4165. procedure TMainForm.ItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  4166. begin
  4167. if IconButtonType = ltHeadImage then
  4168. begin
  4169. if UserCardForm = nil then
  4170. UserCardForm := TUserCardForm.Create(Self);
  4171. if UserCardForm.Width - 10 >= Left then
  4172. UserCardForm.Left := Left + pnlWorkArea.Width + 20
  4173. else
  4174. UserCardForm.Left := Left - UserCardForm.Width + 10;
  4175. UserCardForm.Top := Mouse.CursorPos.Y - 50;
  4176. UserCardForm.LoginName := Item.LoginName;
  4177. Application.ProcessMessages;
  4178. UserCardForm.Show;
  4179. end;
  4180. end;
  4181. //------------------------------------------------------------------------------
  4182. procedure TMainForm.ItemIconButtonDblClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  4183. var
  4184. TalkingForm: TTalkingForm;
  4185. iWaitTimes: Integer;
  4186. RealICQUser: TRealICQUser;
  4187. // CallNumber:String;
  4188. // MenuItem:TMenuItem;
  4189. begin
  4190. if FSearchListViewInVisible then //设置查找输入框为初始状态
  4191. begin
  4192. edFilterKeyword.Text := '查找联系人...';
  4193. edFilterKeyword.Font.Color := clGray;
  4194. end;
  4195. if pnlSearchMoreUser.Visible then
  4196. begin
  4197. edtSearchMoreUser.Text := '查找联系人...';
  4198. edtSearchMoreUser.Font.Color := clGray;
  4199. end;
  4200. if IconButtonType = ltCamera then
  4201. begin
  4202. TalkingForm := GetTalkingForm(Item.LoginName);
  4203. if TalkingForm = nil then
  4204. begin
  4205. TalkingForm := OpenTalkingForm(Item.LoginName, True);
  4206. end;
  4207. iWaitTimes := 0;
  4208. while not TalkingForm.CanWriteMessage do
  4209. begin
  4210. Application.ProcessMessages;
  4211. Inc(iWaitTimes);
  4212. if iWaitTimes > 1000 then
  4213. break;
  4214. Sleep(10);
  4215. end;
  4216. TalkingForm.actVideo.Execute;
  4217. end;
  4218. if IconButtonType = ltHeadImage then
  4219. begin
  4220. if AnsiSameText(Item.LoginName, RealICQClient.Me.LoginName) then
  4221. begin
  4222. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  4223. Exit;
  4224. end;
  4225. OpenTalkingForm(Item.LoginName, True);
  4226. end;
  4227. if IconButtonType = ltSMS then
  4228. begin
  4229. OpenSMSForm(Item.LoginName, True);
  4230. end;
  4231. if IconButtonType = ltEmail then
  4232. begin
  4233. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(Item.LoginName);
  4234. if RealICQUser <> nil then
  4235. //AddWebBrowserToPageControl(Format('http://mail.lishui.gov.cn/web_email/module.phtml?module=mcomposef&to=%s', [RealICQUser.Email]), 999);
  4236. end;
  4237. if IconButtonType = ltAddFriend then
  4238. begin
  4239. if AnsiSameText(MainForm.RealICQClient.LoginName, Item.LoginName) then
  4240. begin
  4241. MessageBox(Handle, '不能添加自己为好友', '提示', MB_ICONINFORMATION);
  4242. Exit;
  4243. end;
  4244. ShowAddFriendWindow(Self, Item.LoginName, Item.DisplayName);
  4245. end;
  4246. if IconButtonType = ltTel then
  4247. begin
  4248. { if not FPCAMessage.GetPCALoginStatus then Exit;
  4249. if (Item.Mobile<>'') and (Item.Tel<>'') then
  4250. begin
  4251. MenuItem:=ppSelCallTel.Items[0];
  4252. MenuItem.Hint:=Item.Mobile+char(10)+Item.DisplayName;
  4253. MenuItem:=ppSelCallTel.Items[1];
  4254. MenuItem.Hint:=Item.Tel+char(10)+Item.DisplayName;
  4255. ppSelCallTel.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y - 50);
  4256. Exit;
  4257. end;
  4258. if Item.Mobile<>'' then CallNumber:=Item.Mobile;
  4259. if Item.Tel<>'' then CallNumber:=Item.Tel;
  4260. FPCAMessage.SendCallTelOutPCAMessage(CallNumber,Item.DisplayName);
  4261. }
  4262. end;
  4263. end;
  4264. //------------------------------------------------------------------------------
  4265. procedure TMainForm.ItemDoubleClick(Item: TRealICQContacterListItem);
  4266. var
  4267. ATeam: TRealICQTeam;
  4268. Branch: TRealICQBranch;
  4269. begin
  4270. if FSearchListViewInVisible then //设置查找输入框为初始状态
  4271. begin
  4272. edFilterKeyword.Text := '查找联系人...';
  4273. edFilterKeyword.Font.Color := clGray;
  4274. end;
  4275. if IsChild(Handle, Item.ListView.Handle) then
  4276. begin
  4277. if GetActiveTabSheetName = LVTeams then
  4278. begin
  4279. ATeam := TRealICQTeam(Item.Data);
  4280. OpenTeamTalkingForm(ATeam.TeamID);
  4281. Exit;
  4282. end;
  4283. end;
  4284. if (Item.StateIndex = 0) and (Item.Data <> nil) then //双击的是部门
  4285. begin
  4286. Branch := Item.Data;
  4287. Branch.Node.Selected := True;
  4288. end
  4289. else if (Item.Data <> nil) then
  4290. begin
  4291. if AnsiSameText(Item.LoginName, RealICQClient.Me.LoginName) then
  4292. begin
  4293. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  4294. Exit;
  4295. end;
  4296. OpenTalkingForm(Item.LoginName);
  4297. end;
  4298. if pnlSearchMoreUser.Visible then
  4299. begin
  4300. edtSearchMoreUser.Text := '查找联系人...';
  4301. end;
  4302. end;
  4303. //------------------------------------------------------------------------------
  4304. procedure TMainForm.ItemOnline(Item: TRealICQContacterListItem);
  4305. var
  4306. iIndex: Integer;
  4307. ARealICQUser: TRealICQUser;
  4308. begin
  4309. //MessageBox(Handle, '1', '1', MB_OK);
  4310. if RealICQClient.Me = nil then
  4311. Exit;
  4312. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  4313. Exit;
  4314. iIndex := FContacterListViews.IndexOfObject(Item.ListView);
  4315. if FContacterListViews[iIndex] = LVLatests then
  4316. exit;
  4317. //MessageBox(Handle, '2', '2', MB_OK);
  4318. if Item.Data <> nil then
  4319. begin
  4320. ARealICQUser := TRealICQUser(Item.Data);
  4321. if (TFriendsService.GetService.IsFriend(ARealICQUser.LoginName)) and (TWorkmatesService.GetService.IsWorkmate(ARealICQUser.LoginName)) then
  4322. begin
  4323. if PlaySoundOnOnline then
  4324. PlayEventSound(OnlineEventSound);
  4325. if ShowHintOnOnline then
  4326. ShowOnOffAlertForm(ARealICQUser);
  4327. end;
  4328. end;
  4329. //MessageBox(Handle, '3', '3', MB_OK);
  4330. end;
  4331. //------------------------------------------------------------------------------
  4332. procedure TMainForm.ItemOffline(Item: TRealICQContacterListItem);
  4333. var
  4334. iIndex: Integer;
  4335. ARealICQUser: TRealICQUser;
  4336. begin
  4337. if RealICQClient.Me = nil then
  4338. Exit;
  4339. if (DontShowHintOnBusy = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌') then
  4340. Exit;
  4341. iIndex := FContacterListViews.IndexOfObject(Item.ListView);
  4342. if FContacterListViews[iIndex] = LVLatests then
  4343. exit;
  4344. if Item.Data <> nil then
  4345. begin
  4346. ARealICQUser := TRealICQUser(Item.Data);
  4347. if (TFriendsService.GetService.IsFriend(ARealICQUser.LoginName)) and (TWorkmatesService.GetService.IsWorkmate(ARealICQUser.LoginName)) then
  4348. begin
  4349. if PlaySoundOnOffline then
  4350. PlayEventSound(OfflineEventSound);
  4351. if ShowHintOnOffline then
  4352. ShowOnOffAlertForm(ARealICQUser);
  4353. end;
  4354. end;
  4355. end;
  4356. //------------------------------------------------------------------------------
  4357. procedure TMainForm.lblLogsClick(Sender: TObject);
  4358. var
  4359. ANoticesRecord: TSystemNotices;
  4360. begin
  4361. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  4362. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(ReadMessageURL + ANoticesRecord.URL)])), '', SW_SHOWDEFAULT);
  4363. end;
  4364. procedure TMainForm.lblLogsMouseEnter(Sender: TObject);
  4365. begin
  4366. lblLogs.Font.Style := [fsUnderline];
  4367. TimerForShowSystemNotices.Enabled := False;
  4368. end;
  4369. procedure TMainForm.lblLogsMouseLeave(Sender: TObject);
  4370. begin
  4371. lblLogs.Font.Style := [];
  4372. TimerForShowSystemNotices.Enabled := FSystemNotices.Count > 0;
  4373. end;
  4374. procedure TMainForm.lblReConnectClick(Sender: TObject);
  4375. begin
  4376. RealICQClient.ReConnectAndLogin;
  4377. end;
  4378. //------------------------------------------------------------------------------
  4379. procedure TMainForm.lblRegisterMouseEnter(Sender: TObject);
  4380. begin
  4381. (Sender as TLabel).Font.Style := [fsUnderline];
  4382. end;
  4383. //------------------------------------------------------------------------------
  4384. procedure TMainForm.lblRegisterMouseLeave(Sender: TObject);
  4385. begin
  4386. (Sender as TLabel).Font.Style := [];
  4387. end;
  4388. //------------------------------------------------------------------------------
  4389. procedure TMainForm.ChangeUIColor(AColor: TColor);
  4390. var
  4391. iLoop: Integer;
  4392. IUIColor: IRealICQUIColor;
  4393. begin
  4394. inherited ChangeUIColor(AColor);
  4395. //spb360SD.ChangeUIColor(AColor);
  4396. //spb360Safe.ChangeUIColor(AColor);
  4397. spbNetworkBackup.ChangeUIColor(AColor);
  4398. spbRefreshBranchUsers.ChangeUIColor(AColor);
  4399. btShowMiniPage.ChangeUIColor(AColor);
  4400. spbDisplayName.ChangeUIColor(AColor);
  4401. spbWatchword.ChangeUIColor(AColor);
  4402. shpWatchwordBorder.Pen.Color := ConvertColorToColor(shpWatchwordBorder.Pen.Color, AColor);
  4403. spbSelUIColor.ChangeUIColor(AColor);
  4404. spbHistroyMessage.ChangeUIColor(AColor);
  4405. spbAddFriend.ChangeUIColor(AColor);
  4406. spblock.ChangeUIColor(AColor);
  4407. btMainMenu.ChangeUIColor(AColor);
  4408. //btOA.ChangeUIColor(AColor);
  4409. //btSwap.ChangeUIColor(AColor);
  4410. spbShowNotReadMessage.ChangeUIColor(AColor);
  4411. spbWinMeet.ChangeUIColor(AColor);
  4412. spbAddFriend.Font.Color := ConvertColorToColor(spbAddFriend.Font.Color, AColor);
  4413. spbHistroyMessage.Font.Color := ConvertColorToColor(spbHistroyMessage.Font.Color, AColor);
  4414. spblock.Font.Color := ConvertColorToColor(spblock.Font.Color, AColor);
  4415. ConvertBitmapToColor(MyContacters.Picture.Bitmap, AColor);
  4416. ConvertBitmapToColor(SysMsg.Picture.Bitmap, AColor);
  4417. ConvertBitmapToColor(MyFriend.Picture.Bitmap, AColor);
  4418. ConvertBitmapToColor(MyTeam.Picture.Bitmap, AColor);
  4419. ConvertBitmapToColor(Latests.Picture.Bitmap, AColor);
  4420. ConvertBitmapToColor(MyContactersIcon.Picture.Bitmap, AColor);
  4421. ConvertBitmapToColor(SysMsgIcon.Picture.Bitmap, AColor);
  4422. ConvertBitmapToColor(MyFriendIcon.Picture.Bitmap, AColor);
  4423. ConvertBitmapToColor(MyTeamIcon.Picture.Bitmap, AColor);
  4424. ConvertBitmapToColor(LatestsIcon.Picture.Bitmap, AColor);
  4425. ConvertBitmapToColor(RealICQHoverImage1.Picture.Bitmap, AColor);
  4426. {通讯录}
  4427. ConvertBitmapToColor(imgAddrBookToolbarBack.Picture.Bitmap, AColor);
  4428. imgAddrBookToolbarBack.Invalidate;
  4429. spbAddGroupUser.ChangeUIColor(AColor);
  4430. spbAddGroup.ChangeUIColor(AColor);
  4431. spbImportGroupUser.ChangeUIColor(AColor);
  4432. {通讯录}
  4433. ShpHint.Pen.Color := ConvertColorToColor(ShpHint.Pen.Color, AColor);
  4434. btPrevLog.ChangeUIColor(AColor);
  4435. btNextLog.ChangeUIColor(AColor);
  4436. ConvertBitmapToColor(ImageForCustomerTop.Picture.Bitmap, AColor);
  4437. ImageForCustomerTop.Invalidate;
  4438. btCustomerLogin.ChangeUIColor(AColor);
  4439. btCustomerLogout.ChangeUIColor(AColor);
  4440. btCustomerDisplayName.ChangeUIColor(AColor);
  4441. ShpLeft.Pen.Color := ConvertColorToColor(ShpLeft.Pen.Color, AColor);
  4442. ShpBottom.Pen.Color := ConvertColorToColor(ShpBottom.Pen.Color, AColor);
  4443. ShpRight.Pen.Color := ConvertColorToColor(ShpRight.Pen.Color, AColor);
  4444. ShpSearchLeft.Pen.Color := ConvertColorToColor(ShpSearchLeft.Pen.Color, AColor);
  4445. ShpSearchBottom.Pen.Color := ConvertColorToColor(ShpSearchBottom.Pen.Color, AColor);
  4446. ShpSearchRight.Pen.Color := ConvertColorToColor(ShpSearchRight.Pen.Color, AColor);
  4447. spbEmail.ChangeUIColor(AColor);
  4448. sbpSMS.ChangeUIColor(AColor);
  4449. spbPersonManage.ChangeUIColor(AColor);
  4450. spbTelMeeting.ChangeUIColor(AColor);
  4451. pnlToolBar.Color := FormColor;
  4452. PnlTop.Color := FormColor;
  4453. pnlWorkArea.Color := FormColor;
  4454. pnlLogout.Color := FormColor;
  4455. pgcMainWorkArea.BackColor := FormColor;
  4456. pnlLocked.Color := FormColor;
  4457. btn_lock_DisplayName.ChangeUIColor(AColor);
  4458. btn_unlock.ChangeUIColor(AColor);
  4459. ConvertBitmapToColor(img_lockback_top.Picture.Bitmap, AColor);
  4460. //ConvertBitmapToColor(shp_lock_client.Picture.Bitmap, AColor);
  4461. //txt_locked.color:= FormColor;
  4462. pnlClient.Color := FormColor;
  4463. pnlNDToolBar.Color := FormColor;
  4464. pnlNDStateBar.Color := FormColor;
  4465. pnlMiddleClient.Color := FormColor;
  4466. pnlAddrBkStateBar.Color := FormColor;
  4467. pnlCustomerServiceStatus.Color := FormColor;
  4468. ConvertBitmapToColor(imgWebToolBack.Picture.Bitmap, AColor);
  4469. imgWebToolBack.Invalidate;
  4470. spbPrev.ChangeUIColor(AColor);
  4471. spbNext.ChangeUIColor(AColor);
  4472. spbStop.ChangeUIColor(AColor);
  4473. spbRefresh.ChangeUIColor(AColor);
  4474. spbAddToNA.ChangeUIColor(AColor);
  4475. spbGo.ChangeUIColor(AColor);
  4476. spbWebClose.ChangeUIColor(AColor);
  4477. sbpNewWebTab.ChangeUIColor(AColor);
  4478. TabSetMuiltWeb.BackgroundColor := ConvertColorToColor(TabSetMuiltWeb.BackgroundColor, AColor);
  4479. TabSetMuiltWeb.SelectedColor := ConvertColorToColor(TabSetMuiltWeb.SelectedColor, AColor);
  4480. shpWebStatus.Pen.Color := ConvertColorToColor(shpWebStatus.Pen.Color, AColor);
  4481. shpWebLeftBorder.Pen.Color := ConvertColorToColor(shpWebLeftBorder.Pen.Color, AColor);
  4482. ConvertBitmapToColor(imgNDToolbarBack.Picture.Bitmap, AColor);
  4483. imgNDToolbarBack.Invalidate;
  4484. ConvertBitmapToColor(imgLogoutBKTop.Picture.Bitmap, AColor);
  4485. imgLogoutBKTop.Invalidate;
  4486. ConvertBitmapToColor(imgLogoutBK.Picture.Bitmap, AColor);
  4487. imgLogoutBK.Invalidate;
  4488. spLoginNameBorder.Pen.Color := ConvertColorToColor(spLoginNameBorder.Pen.Color, AColor);
  4489. spbChangeLoginName.ChangeUIColor(AColor);
  4490. spPasswordBorder.Pen.Color := ConvertColorToColor(spPasswordBorder.Pen.Color, AColor);
  4491. pnlSelectServer.Color := FormColor;
  4492. spServerListBorder.Pen.Color := ConvertColorToColor(spServerListBorder.Pen.Color, AColor);
  4493. spbSelectServer.ChangeUIColor(AColor);
  4494. shpSearchMoreUser.Pen.Color := ConvertColorToColor(shpSearchMoreUser.Pen.Color, AColor);
  4495. spbCancelFilter.ChangeUIColor(AColor);
  4496. shpFilterBorder.Pen.Color := ConvertColorToColor(shpFilterBorder.Pen.Color, AColor);
  4497. spbLoginState.ChangeUIColor(AColor);
  4498. spbSavePassword.ChangeUIColor(AColor);
  4499. spbAutoLogin.ChangeUIColor(AColor);
  4500. btLogin.ChangeUIColor(AColor);
  4501. spbNDMoveUp.ChangeUIColor(AColor);
  4502. spbNDNewDir.ChangeUIColor(AColor);
  4503. spbNDDelete.ChangeUIColor(AColor);
  4504. shpNDDirBorder.Pen.Color := ConvertColorToColor(shpNDDirBorder.Pen.Color, AColor);
  4505. spbNDUpload.ChangeUIColor(AColor);
  4506. spbNDDownload.ChangeUIColor(AColor);
  4507. spbNDConnect.ChangeUIColor(AColor);
  4508. spbNDDisconnect.ChangeUIColor(AColor);
  4509. spbNDRefresh.ChangeUIColor(AColor);
  4510. spbNDCancelAll.ChangeUIColor(AColor);
  4511. TabSetNDMissions.SelectedColor := clWhite;
  4512. TabSetNDMissions.BackgroundColor := clWhite;
  4513. pnlNDMissions.Color := clWhite;
  4514. ConvertBitmapToColor(imgHeadImageBorder.Picture.Bitmap, AColor);
  4515. imgHeadImageBorder.Invalidate;
  4516. ConvertBitmapToColor(imgBottomMenu.Picture.Bitmap, AColor);
  4517. imgBottomMenu.Invalidate;
  4518. ConvertBitmapToColor(imgTitleBackMiddle.Picture.Bitmap, AColor);
  4519. imgTitleBackMiddle.Invalidate;
  4520. IUIColor := pgcMainWorkArea;
  4521. IUIColor.ChangeUIColor(AColor);
  4522. for iLoop := 0 to FContacterListViews.Count - 1 do
  4523. begin
  4524. IUIColor := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  4525. IUIColor.ChangeUIColor(AColor);
  4526. end;
  4527. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  4528. begin
  4529. IUIColor := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  4530. IUIColor.ChangeUIColor(AColor);
  4531. end;
  4532. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  4533. begin
  4534. IUIColor := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  4535. IUIColor.ChangeUIColor(AColor);
  4536. end;
  4537. if Assigned(FTVCustomerLatests) then
  4538. FTVCustomerLatests.ChangeUIColor(AColor);
  4539. // if Assigned(FLVCustomers) then FLVCustomers.ChangeUIColor(AColor);
  4540. if Assigned(FLVSystemMessage) then
  4541. FLVSystemMessage.ChangeUIColor(AColor);
  4542. if Assigned(FLVTeams) then
  4543. FLVTeams.ChangeUIColor(AColor);
  4544. if tsNetWorkDisk.Parent <> nil then
  4545. begin
  4546. FLVNetWorkDisk.ChangeUIColor(AColor);
  4547. FLVNetWorkDiskUploadingFiles.ChangeUIColor(AColor);
  4548. FLVNetWorkDiskDownloadingFiles.ChangeUIColor(AColor);
  4549. end;
  4550. btLogin.ChangeUIColor(AColor);
  4551. btLogin.Invalidate;
  4552. spbContacterViewStyle.ChangeUIColor(AColor);
  4553. spbCreateTeam.ChangeUIColor(AColor);
  4554. spbFindTeam.ChangeUIColor(AColor);
  4555. pnlTeams.Color := ConvertColorToColor(pnlTeams.Color, AColor);
  4556. if CreateTeamForm <> nil then
  4557. CreateTeamForm.ChangeUIColor(AColor);
  4558. if SearchForm <> nil then
  4559. SearchForm.ChangeUIColor(AColor);
  4560. if SearchTeamForm <> nil then
  4561. SearchTeamForm.ChangeUIColor(AColor);
  4562. if SelFaceForm <> nil then
  4563. SelFaceForm.ChangeUIColor(AColor);
  4564. if CustomFacesManagerForm <> nil then
  4565. CustomFacesManagerForm.ChangeUIColor(AColor);
  4566. if NotReadMessageBoxForm <> nil then
  4567. NotReadMessageBoxForm.ChangeUIColor(AColor);
  4568. if VCardForm <> nil then
  4569. VCardForm.ChangeUIColor(UIMainColor);
  4570. ChangeAddFriendFormColor(AColor);
  4571. ChangeAddFriendRequestFormColor(AColor);
  4572. ChangeSeeUserInformationFormColor(AColor);
  4573. ChangeTalkingFormColor(AColor);
  4574. ChangeSMSFormColor(AColor);
  4575. ChangeTeamOptionsFormColor(AColor);
  4576. ChangeSystemMessageFormsColor(AColor);
  4577. TMainFormController.GetController.ChangeUIColor(AColor);
  4578. end;
  4579. //------------------------------------------------------------------------------
  4580. function TMainForm.GetListViewByLoginName(ALoginName: string; AOnlyInGroups: Boolean = False): TRealICQContacterListView;
  4581. var
  4582. GroupName: string;
  4583. iLoop, jLoop, iIndex, ContacterIndex: Integer;
  4584. GroupMembers: TStringList;
  4585. ListView: TRealICQContacterListView;
  4586. begin
  4587. Result := nil;
  4588. if not AOnlyInGroups then
  4589. begin
  4590. if (TFriendsService.GetService.IsFriend(ALoginName)) and (TWorkmatesService.GetService.IsWorkmate(ALoginName)) then
  4591. begin
  4592. ContacterIndex := FContacterListViews.IndexOf(LVFriends);
  4593. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4594. Result := ListView;
  4595. end
  4596. else if RealICQClient.Blacklists.IndexOf(ALoginName) >= 0 then
  4597. begin
  4598. ContacterIndex := FContacterListViews.IndexOf(LVBlacklists);
  4599. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4600. if ListView.Items.IndexOf(ALoginName) = -1 then
  4601. ListView.Items.Add(ALoginName);
  4602. Result := ListView;
  4603. exit;
  4604. end
  4605. else if RealICQClient.Strangers.IndexOf(ALoginName) >= 0 then
  4606. begin
  4607. ContacterIndex := FContacterListViews.IndexOf(LVStrangers);
  4608. ListView := FContacterListViews.Objects[ContacterIndex] as TRealICQContacterListView;
  4609. if ListView.Items.IndexOf(ALoginName) = -1 then
  4610. ListView.Items.Add(ALoginName);
  4611. Result := ListView;
  4612. exit;
  4613. end;
  4614. end;
  4615. if FShowGroup then
  4616. begin
  4617. for iLoop := 0 to FGroups.Count - 1 do
  4618. begin
  4619. GroupName := FGroups[iLoop];
  4620. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  4621. for jLoop := 0 to GroupMembers.Count - 1 do
  4622. begin
  4623. if AnsiSameText(GroupMembers[jLoop], ALoginName) then
  4624. begin
  4625. iIndex := FContacterListViews.IndexOf(GroupName);
  4626. if iIndex >= 0 then
  4627. begin
  4628. ListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  4629. if ListView.Items.IndexOf(ALoginName) = -1 then
  4630. ListView.Items.Add(ALoginName);
  4631. Result := ListView;
  4632. end;
  4633. exit;
  4634. end;
  4635. end;
  4636. end;
  4637. end;
  4638. if Result <> nil then
  4639. if Result.Items.IndexOf(ALoginName) = -1 then
  4640. Result.Items.Add(ALoginName);
  4641. end;
  4642. //-------------------显示好友列表---------------
  4643. procedure TMainForm.ShowFriendLists;
  4644. var
  4645. iLoop, itemIndex: Integer;
  4646. RealICQUser: TRealICQUser;
  4647. RealICQFriendTreeView: TRealICQContacterTreeView;
  4648. Friend: TRealICQEmployee;
  4649. begin
  4650. itemIndex := FContacterTreeViews.IndexOf(LvFriends);
  4651. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4652. for iLoop := FNotAddedEmployeeList.Count - 1 downto 0 do
  4653. begin
  4654. RealICQUser := FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  4655. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  4656. Continue;
  4657. if (RealICQFriendTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then
  4658. Continue;
  4659. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  4660. Friend.BranchID := LVFriends;
  4661. RealICQFriendTreeView.AddEmployee(Friend);
  4662. //UpdateFriendNode(Friend, RealICQUser, False);
  4663. TUsersService.GetUsersService.UpdateTreeNode(RealICQFriendTreeView, Friend, RealICQUser);
  4664. end;
  4665. end;
  4666. //------------------------------------------------------------------------------
  4667. procedure TMainForm.ShowGroupInterface;
  4668. var
  4669. GroupName, LoginName: string;
  4670. iLoop, jLoop, itemIndex: Integer;
  4671. RealICQUser: TRealICQUser;
  4672. RealICQFriendTreeView: TRealICQContacterTreeView;
  4673. Friend: TRealICQEmployee;
  4674. FriendGroup: TRealICQBranch;
  4675. GroupMembers: TStringList;
  4676. begin
  4677. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  4678. if ItemIndex >= 0 then
  4679. begin
  4680. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4681. try
  4682. RealICQFriendTreeView.Clear;
  4683. FreeAndNil(RealICQFriendTreeView);
  4684. FContacterTreeViews.Delete(ItemIndex);
  4685. except
  4686. end;
  4687. end;
  4688. ItemIndex := AddFriendTreeView(scrollBoxMyFriend, LVFriends);
  4689. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  4690. RealICQFriendTreeView.AdjustPosition := False;
  4691. RealICQFriendTreeView.HideSystemScrollBar;
  4692. RealICQFriendTreeView.BeginUpdate;
  4693. SetFlashCaptionOnOnlineValue(False);
  4694. Screen.Cursor := crHourGlass;
  4695. try
  4696. //显示好友
  4697. ShowFriendLists;
  4698. //显示黑名单
  4699. //ShowBlacklists;
  4700. {$region '添加自定义分组'}
  4701. if FShowGroup then
  4702. begin
  4703. for iLoop := 0 to FGroups.Count - 1 do
  4704. begin
  4705. GroupName := FGroups[iLoop];
  4706. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  4707. FriendGroup := TRealICQBranch.Create(GroupName);
  4708. FriendGroup.BranchID := GroupName;
  4709. FriendGroup.ParentID := '';
  4710. FriendGroup.BranchName := GroupName;
  4711. RealICQFriendTreeView.AddBranch(FriendGroup);
  4712. RealICQFriendTreeView.MoveBranch(GroupName, LvFriends);
  4713. for jLoop := 0 to GroupMembers.Count - 1 do
  4714. begin
  4715. LoginName := GroupMembers[jLoop];
  4716. if (not TFriendsService.GetService.IsFriend(LoginName)) and (not TWorkmatesService.GetService.IsWorkmate(LoginName)) then
  4717. continue;
  4718. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  4719. continue;
  4720. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  4721. ItemIndex := RealICQFriendTreeView.EmployeeItems.IndexOf(LoginName);
  4722. if ItemIndex >= 0 then
  4723. RealICQFriendTreeView.EmployeeItems.Delete(ItemIndex);
  4724. Friend := TRealICQEmployee.Create(LoginName);
  4725. Friend.BranchID := FriendGroup.BranchName;
  4726. RealICQFriendTreeView.AddEmployee(Friend);
  4727. //UpdateFriendNode(Friend, RealICQUser, False);
  4728. TUsersService.GetUsersService.UpdateTreeNode(RealICQFriendTreeView, Friend, RealICQUser);
  4729. end;
  4730. end;
  4731. end;
  4732. {$endregion}
  4733. //展开好友列表
  4734. ItemIndex := RealICQFriendTreeView.BranchItems.IndexOf(LvFriends);
  4735. FriendGroup := RealICQFriendTreeView.BranchItems.Objects[itemIndex] as TRealICQBranch;
  4736. FriendGroup.Node.Expanded := True;
  4737. finally
  4738. //RealICQFriendTreeView.MoveFriendGroup(LvBlackLists,LvFriends);
  4739. PostMessage(RealICQFriendTreeView.Handle, WM_SIZE, 0, 0);
  4740. RealICQFriendTreeView.EndUpdate;
  4741. Screen.Cursor := crDefault;
  4742. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  4743. end;
  4744. end;
  4745. //------------------------------------------------------------------------------
  4746. function TMainForm.AddFriendTreeView(AOwner: TWinControl; GroupName: string): Integer;
  4747. var
  4748. RealICQFriendTreeView: TRealICQContacterTreeView;
  4749. Group: TRealICQBranch;
  4750. begin
  4751. //log(AOwner.Name,'TMainForm.AddFriendTreeView');
  4752. RealICQFriendTreeView := TRealICQContacterTreeView.Create(AOwner);
  4753. RealICQFriendTreeView.Parent := AOwner;
  4754. RealICQFriendTreeView.Align := alClient;
  4755. RealICQFriendTreeView.Caption := '';
  4756. RealICQFriendTreeView.Color := clWhite;
  4757. RealICQFriendTreeView.ShowHint := True;
  4758. RealICQFriendTreeView.ParentFont := True;
  4759. RealICQFriendTreeView.ShowLine := False;
  4760. RealICQFriendTreeView.ShowBranchImage := False;
  4761. RealICQFriendTreeView.MustDrawButton := True;
  4762. RealICQFriendTreeView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4763. RealICQFriendTreeView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4764. RealICQFriendTreeView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4765. RealICQFriendTreeView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4766. RealICQFriendTreeView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4767. RealICQFriendTreeView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4768. RealICQFriendTreeView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4769. RealICQFriendTreeView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4770. RealICQFriendTreeView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4771. RealICQFriendTreeView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4772. RealICQFriendTreeView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4773. RealICQFriendTreeView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4774. RealICQFriendTreeView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4775. RealICQFriendTreeView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4776. RealICQFriendTreeView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4777. RealICQFriendTreeView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4778. RealICQFriendTreeView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4779. RealICQFriendTreeView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4780. RealICQFriendTreeView.ScrollBarButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarButtonPicture);
  4781. RealICQFriendTreeView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4782. RealICQFriendTreeView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4783. RealICQFriendTreeView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4784. RealICQFriendTreeView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4785. RealICQFriendTreeView.HeadImageBackColor := FLVHeadImageBackColor;
  4786. RealICQFriendTreeView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4787. RealICQFriendTreeView.DefaultPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4788. RealICQFriendTreeView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig44);
  4789. RealICQFriendTreeView.BranchClosedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + GroupClosedButtonPicture);
  4790. RealICQFriendTreeView.BranchOpenedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + GroupOpenedButtonPicture);
  4791. RealICQFriendTreeView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4792. RealICQFriendTreeView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4793. RealICQFriendTreeView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4794. RealICQFriendTreeView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4795. RealICQFriendTreeView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4796. RealICQFriendTreeView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4797. RealICQFriendTreeView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4798. RealICQFriendTreeView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4799. RealICQFriendTreeView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4800. RealICQFriendTreeView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4801. RealICQFriendTreeView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4802. RealICQFriendTreeView.ShowCameraButton := True;
  4803. RealICQFriendTreeView.ShowMobileButton := False;
  4804. RealICQFriendTreeView.ShowTelButton := True;
  4805. RealICQFriendTreeView.ShowHeadImageButton := True;
  4806. RealICQFriendTreeView.ShowEmailButton := True;
  4807. RealICQFriendTreeView.ShowSMSButton := True;
  4808. RealICQFriendTreeView.ShowAddFriendButton := False;
  4809. RealICQFriendTreeView.Style := FLVStyle;
  4810. RealICQFriendTreeView.CaptionStyle := FLVCaptionStyle;
  4811. RealICQFriendTreeView.ChangeUIColor(FUIMainColor);
  4812. RealICQFriendTreeView.PopupMenu := ppUserItemRightMenu;
  4813. RealICQFriendTreeView.OnItemOnline := NodeOnline;
  4814. RealICQFriendTreeView.OnItemOffline := NodeOffline;
  4815. RealICQFriendTreeView.OnItemDoubleClick := NodeDoubleClick;
  4816. RealICQFriendTreeView.OnItemIconButtonClick := NodeIconButtonClick;
  4817. RealICQFriendTreeView.OnItemIconButtonDblClick := NodeIconButtonDblClick;
  4818. RealICQFriendTreeView.OnItemMouseEnter := NodeOnMouseEnter;
  4819. RealICQFriendTreeView.OnItemMouseLeave := NodeOnMouseLeave;
  4820. Result := FContacterTreeViews.AddObject(GroupName, RealICQFriendTreeView);
  4821. RealICQFriendTreeView.AdjustPosition := False;
  4822. RealICQFriendTreeView.HideSystemScrollBar;
  4823. RealICQFriendTreeView.BeginUpdate;
  4824. try
  4825. Group := TRealICQBranch.Create(LVFriends);
  4826. Group.BranchID := LvFriends;
  4827. Group.ParentID := '0';
  4828. Group.BranchName := LvFriends;
  4829. RealICQFriendTreeView.AddBranch(Group);
  4830. finally
  4831. RealICQFriendTreeView.EndUpdate;
  4832. end;
  4833. end;
  4834. function TMainForm.AddContacterTreeView(AOwner: TWinControl; GroupName: string): Integer;
  4835. var
  4836. RealICQContacterTreeView: TRealICQContacterTreeView;
  4837. begin
  4838. //log(AOwner.Name,'TMainForm.AddContacterTreeView');
  4839. RealICQContacterTreeView := TRealICQContacterTreeView.Create(AOwner);
  4840. RealICQContacterTreeView.Parent := AOwner;
  4841. RealICQContacterTreeView.Align := alClient;
  4842. RealICQContacterTreeView.Caption := '';
  4843. RealICQContacterTreeView.Color := clWhite;
  4844. RealICQContacterTreeView.ShowHint := True;
  4845. RealICQContacterTreeView.ParentFont := True;
  4846. RealICQContacterTreeView.AutoCalculate := True;
  4847. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  4848. RealICQContacterTreeView.ShowOnlineNumber := True;
  4849. RealICQContacterTreeView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4850. RealICQContacterTreeView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4851. RealICQContacterTreeView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4852. RealICQContacterTreeView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4853. RealICQContacterTreeView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4854. RealICQContacterTreeView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4855. RealICQContacterTreeView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4856. RealICQContacterTreeView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4857. RealICQContacterTreeView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4858. RealICQContacterTreeView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4859. RealICQContacterTreeView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4860. RealICQContacterTreeView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4861. RealICQContacterTreeView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4862. RealICQContacterTreeView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4863. RealICQContacterTreeView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4864. RealICQContacterTreeView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4865. RealICQContacterTreeView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4866. RealICQContacterTreeView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4867. RealICQContacterTreeView.ScrollBarButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarButtonPicture);
  4868. RealICQContacterTreeView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4869. RealICQContacterTreeView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4870. RealICQContacterTreeView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4871. RealICQContacterTreeView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4872. RealICQContacterTreeView.HeadImageBackColor := FLVHeadImageBackColor;
  4873. RealICQContacterTreeView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4874. RealICQContacterTreeView.DefaultPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4875. RealICQContacterTreeView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig44);
  4876. RealICQContacterTreeView.BranchExpandedPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchExpandedPicture);
  4877. RealICQContacterTreeView.BranchCollapsedPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedPicture);
  4878. RealICQContacterTreeView.BranchClosedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchClosedButtonPicture);
  4879. RealICQContacterTreeView.BranchOpenedButtonPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchOpenedButtonPicture);
  4880. RealICQContacterTreeView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4881. RealICQContacterTreeView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4882. RealICQContacterTreeView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4883. RealICQContacterTreeView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4884. RealICQContacterTreeView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4885. RealICQContacterTreeView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4886. RealICQContacterTreeView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4887. RealICQContacterTreeView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4888. RealICQContacterTreeView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4889. RealICQContacterTreeView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4890. RealICQContacterTreeView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4891. RealICQContacterTreeView.AddFriendIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + AddFriendIcon);
  4892. RealICQContacterTreeView.NewSNSUpdateIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SNSIcon);
  4893. RealICQContacterTreeView.CheckFalsePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CheckFalse.bmp');
  4894. RealICQContacterTreeView.CheckTruePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\CheckTrue.bmp');
  4895. RealICQContacterTreeView.ShowMobileButton := False;
  4896. RealICQContacterTreeView.ShowTelButton := True;
  4897. RealICQContacterTreeView.ShowCameraButton := True;
  4898. RealICQContacterTreeView.ShowHeadImageButton := True;
  4899. RealICQContacterTreeView.ShowEmailButton := True;
  4900. RealICQContacterTreeView.ShowSMSButton := True;
  4901. RealICQContacterTreeView.ShowNewSNSButton := False;
  4902. RealICQContacterTreeView.ShowAddFriendButton := True;
  4903. // if RealICQClient.EnableSecretLevel AND (FProductType <> ptBGZS) AND ((FUserType = utUnknown) OR (FUserType = utCompany)) then
  4904. // RealICQContacterTreeView.ShowAddFriendButton := True
  4905. // else
  4906. // RealICQContacterTreeView.ShowAddFriendButton := False;
  4907. RealICQContacterTreeView.Style := FLVStyle;
  4908. RealICQContacterTreeView.CaptionStyle := FLVCaptionStyle;
  4909. RealICQContacterTreeView.ChangeUIColor(FUIMainColor);
  4910. RealICQContacterTreeView.PopupMenu := ppUserItemRightMenu;
  4911. if GroupName = LVMoreUsers then
  4912. begin
  4913. RealICQContacterTreeView.OnBranchClick := NodeBranchClick;
  4914. end;
  4915. if GroupName = LVAddrbook then
  4916. begin
  4917. RealICQContacterTreeView.OnBranchClick := NodeGroupClick;
  4918. end;
  4919. RealICQContacterTreeView.OnItemOnline := NodeOnline;
  4920. RealICQContacterTreeView.OnItemOffline := NodeOffline;
  4921. RealICQContacterTreeView.OnItemDoubleClick := NodeDoubleClick;
  4922. RealICQContacterTreeView.OnItemIconButtonClick := NodeIconButtonClick;
  4923. RealICQContacterTreeView.OnItemIconButtonDblClick := NodeIconButtonDblClick;
  4924. RealICQContacterTreeView.OnItemMouseEnter := NodeOnMouseEnter;
  4925. RealICQContacterTreeView.OnItemMouseLeave := NodeOnMouseLeave;
  4926. Result := FContacterTreeViews.AddObject(GroupName, RealICQContacterTreeView);
  4927. end;
  4928. procedure TMainForm.UpdateContacterListView(RealICQContacterListView: TRealICQContacterListView);
  4929. begin
  4930. RealICQContacterListView.Align := alClient;
  4931. RealICQContacterListView.Caption := '';
  4932. RealICQContacterListView.ShowHint := True;
  4933. RealICQContacterListView.Color := clWhite;
  4934. RealICQContacterListView.ParentFont := True;
  4935. RealICQContacterListView.ScrollTopButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonPicture);
  4936. RealICQContacterListView.ScrollTopButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonHoverPicture);
  4937. RealICQContacterListView.ScrollTopButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTopButtonDownPicture);
  4938. RealICQContacterListView.ScrollBottomButtonPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonPicture);
  4939. RealICQContacterListView.ScrollBottomButtonPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonHoverPicture);
  4940. RealICQContacterListView.ScrollBottomButtonPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarBottomButtonDownPicture);
  4941. RealICQContacterListView.ScrollBarButtonTopPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopPicture);
  4942. RealICQContacterListView.ScrollBarButtonTopPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopHoverPicture);
  4943. RealICQContacterListView.ScrollBarButtonTopPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonTopDownPicture);
  4944. RealICQContacterListView.ScrollBarButtonMiddlePictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddlePicture);
  4945. RealICQContacterListView.ScrollBarButtonMiddlePictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleHoverPicture);
  4946. RealICQContacterListView.ScrollBarButtonMiddlePictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonMiddleDownPicture);
  4947. RealICQContacterListView.ScrollBarButtonBottomPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomPicture);
  4948. RealICQContacterListView.ScrollBarButtonBottomPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomHoverPicture);
  4949. RealICQContacterListView.ScrollBarButtonBottomPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBarTrackButtonBottomDownPicture);
  4950. RealICQContacterListView.ScrollBackgroundPictureNormal.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4951. RealICQContacterListView.ScrollBackgroundPictureHover.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4952. RealICQContacterListView.ScrollBackgroundPictureDown.LoadFromFile(ExtractFilePath(Application.ExeName) + ScrollBackgroundPicture);
  4953. RealICQContacterListView.SelectedItemBorderColor := FLVSelectedItemBorderColor;
  4954. RealICQContacterListView.SelectedItemBorderInnerColor := FLVSelectedItemBorderInnerColor;
  4955. RealICQContacterListView.SelectedItemBackColor := FLVSelectedItemBackColor;
  4956. RealICQContacterListView.HeadImageBorderColor := FLVHeadImageBorderColor;
  4957. RealICQContacterListView.HeadImageBackColor := FLVHeadImageBackColor;
  4958. RealICQContacterListView.SelectedItemBackgroud.LoadFromFile(ExtractFilePath(Application.ExeName) + SelectedItemBackgroud);
  4959. RealICQContacterListView.DefaultPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  4960. RealICQContacterListView.DefaultPictureMiddle.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureMiddle);
  4961. RealICQContacterListView.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmall);
  4962. //RealICQContacterListView.DefaultPictureBigOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBigOffline);
  4963. //RealICQContacterListView.DefaultPictureMiddleOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureMiddleOffline);
  4964. //RealICQContacterListView.DefaultPictureSmallOffline.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureSmallOffline);
  4965. RealICQContacterListView.LeavePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\away.ico');
  4966. RealICQContacterListView.BusyPicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\busy.ico');
  4967. RealICQContacterListView.MutePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\small\mute.ico');
  4968. RealICQContacterListView.LeavePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  4969. RealICQContacterListView.BusyPictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\busy.ico');
  4970. RealICQContacterListView.MutePictureBig.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\mute.ico');
  4971. RealICQContacterListView.CameraIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CameraIcon);
  4972. RealICQContacterListView.TelephoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + TelephoneIcon);
  4973. RealICQContacterListView.MobilePhoneIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + MobilePhoneIcon);
  4974. RealICQContacterListView.EmailIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + EmailIcon);
  4975. RealICQContacterListView.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSIcon);
  4976. RealICQContacterListView.AddFriendIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + AddFriendIcon);
  4977. RealICQContacterListView.ShowHeadImageButton := False;
  4978. RealICQContacterListView.ShowAddFriendButton := False;
  4979. RealICQContacterListView.ShowMobileButton := True;
  4980. RealICQContacterListView.ShowTelButton := True;
  4981. RealICQContacterListView.ShowCameraButton := True;
  4982. RealICQContacterListView.ShowEmailButton := True;
  4983. RealICQContacterListView.ShowSMSButton := True;
  4984. RealICQContacterListView.Style := FLVStyle;
  4985. RealICQContacterListView.CaptionStyle := FLVCaptionStyle;
  4986. RealICQContacterListView.ChangeUIColor(FUIMainColor);
  4987. RealICQContacterListView.PopupMenu := ppUserItemRightMenu;
  4988. RealICQContacterListView.OnItemDoubleClick := ItemDoubleClick;
  4989. RealICQContacterListView.OnItemIconButtonClick := ItemIconButtonClick;
  4990. RealICQContacterListView.OnItemIconButtonDblClick := ItemIconButtonDblClick;
  4991. RealICQContacterListView.OnItemMouseEnter := nil; // ItemOnMouseEnter;
  4992. RealICQContacterListView.OnItemMouseLeave := nil; // ItemOnMouseLeave;
  4993. end;
  4994. //------------------------------------------------------------------------------
  4995. function TMainForm.AddContacterListView(AOwner: TWinControl; GroupName: string): Integer;
  4996. var
  4997. RealICQContacterListView: TRealICQContacterListView;
  4998. begin
  4999. //log(AOwner.Name,'TMainForm.AddContacterListView');
  5000. RealICQContacterListView := TRealICQContacterListView.Create(AOwner);
  5001. RealICQContacterListView.Parent := AOwner;
  5002. UpdateContacterListView(RealICQContacterListView);
  5003. RealICQContacterListView.ShowMobileButton := not (GroupName = LVMoreUsers);
  5004. RealICQContacterListView.ShowTelButton := not (GroupName = LVMoreUsers);
  5005. RealICQContacterListView.ShowCameraButton := not (GroupName = LVMoreUsers);
  5006. RealICQContacterListView.ShowHeadImageButton := False; //not (GroupName=LVMoreUsers);
  5007. RealICQContacterListView.ShowEmailButton := False; // not (GroupName=LVMoreUsers);
  5008. RealICQContacterListView.ShowSMSButton := not (GroupName = LVMoreUsers);
  5009. // if RealICQClient.EnableSecretLevel AND (FProductType <> ptBGZS) AND ((FUserType = utUnknown) OR (FUserType = utCompany)) then
  5010. // RealICQContacterListView.ShowAddFriendButton := True
  5011. // else
  5012. RealICQContacterListView.ShowAddFriendButton := False;
  5013. if GroupName = LVMoreUsers then
  5014. begin
  5015. RealICQContacterListView.OnItemOnline := nil;
  5016. RealICQContacterListView.OnItemOffline := nil;
  5017. end
  5018. else
  5019. begin
  5020. RealICQContacterListView.OnItemOnline := ItemOnline;
  5021. RealICQContacterListView.OnItemOffline := ItemOffline;
  5022. end;
  5023. Result := FContacterListViews.AddObject(GroupName, RealICQContacterListView);
  5024. end;
  5025. //------------------------------------------------------------------------------
  5026. procedure TMainForm.ApplicationEventsDeactivate(Sender: TObject);
  5027. begin
  5028. if edWatchword.Visible then
  5029. edWatchwordExit(edWatchword);
  5030. //FDblClickedTrayIcon := False;
  5031. end;
  5032. //------------------------------------------------------------------------------
  5033. procedure TMainForm.ApplicationEventsException(Sender: TObject; E: Exception);
  5034. var
  5035. LogFile: TextFile;
  5036. Log: string;
  5037. begin
  5038. Exit;
  5039. try
  5040. Log := DateTimeToStr(Now) + ':' + E.Message;
  5041. AssignFile(LogFile, ExtractFilePath(Application.ExeName) + 'Logs.txt');
  5042. try
  5043. try
  5044. Append(LogFile);
  5045. except
  5046. ReWrite(LogFile);
  5047. end;
  5048. Writeln(LogFile, Log);
  5049. finally
  5050. CloseFile(LogFile);
  5051. end;
  5052. except
  5053. end;
  5054. end;
  5055. procedure TMainForm.ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean);
  5056. var
  5057. classname: array[0..254] of char;
  5058. begin
  5059. if (Msg.message = WM_CLOSE) then
  5060. begin
  5061. getclassname(msg.hwnd, @classname, sizeof(classname)); //取类名
  5062. if classname = 'Shell Embedding' then
  5063. begin
  5064. PeekMessage(Msg, Msg.Hwnd, 0, 0, PM_REMOVE);
  5065. Handled := True; //该消息已处理,不再需要后续处理
  5066. end;
  5067. end;
  5068. if (Msg.message = WM_LBUTTONDOWN) or (Msg.message = WM_NCLBUTTONDOWN) then
  5069. begin
  5070. if IsChild(Handle, Msg.hwnd) then
  5071. begin
  5072. HideUserCardForm;
  5073. end;
  5074. end;
  5075. end;
  5076. procedure TMainForm.ppAddrBookListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5077. begin
  5078. ChangePPMenuColorMap(ppAddrBookList.PopupMenu);
  5079. end;
  5080. procedure TMainForm.ppAddrBookListPopup(Sender: TObject);
  5081. var
  5082. ItemIndex: Integer;
  5083. RealICQContacterTreeView: TRealICQContacterTreeView;
  5084. begin
  5085. ItemIndex := FContacterTreeViews.IndexOf(LVAddrBook);
  5086. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5087. miUpdateGroup.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5088. miDelGroup.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5089. miImportGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil);
  5090. miDelGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5091. miUpdateGroupUser.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5092. miCut.Enabled := (RealICQContacterTreeView.GetSelectedBranch <> nil) or (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5093. miPaste.Enabled := (FCutNode <> nil);
  5094. miSetRemark.Enabled := (RealICQContacterTreeView.GetSelectedEmployee <> nil);
  5095. end;
  5096. procedure TMainForm.ppChangeCustomerStateGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5097. begin
  5098. ChangePPMenuColorMap(ppChangeCustomerState.PopupMenu);
  5099. end;
  5100. procedure TMainForm.ppChangeStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5101. begin
  5102. ChangePPMenuColorMap(ppChangeStates.PopupMenu);
  5103. end;
  5104. //------------------------------------------------------------------------------
  5105. procedure TMainForm.ppChangeStatesPopup(Sender: TObject);
  5106. begin
  5107. end;
  5108. //------------------------------------------------------------------------------
  5109. procedure TMainForm.ppColorsGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5110. begin
  5111. ChangePPMenuColorMap(ppColors.PopupMenu);
  5112. end;
  5113. //------------------------------------------------------------------------------
  5114. procedure TMainForm.ppColorsPopup(Sender: TObject);
  5115. var
  5116. iLoop: Integer;
  5117. ColorStr: string;
  5118. MenuItem: TMenuItem;
  5119. Bitmap: TBitmap;
  5120. procedure FindSkins(APath: string);
  5121. var
  5122. DSearchRec: TSearchRec;
  5123. FindResult: Integer;
  5124. begin
  5125. FindResult := FindFirst(APath + '*.*', faDirectory, DSearchRec);
  5126. while FindResult = 0 do
  5127. begin
  5128. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  5129. if (DSearchRec.Attr and faDirectory) = faDirectory then
  5130. begin
  5131. MenuItem := TMenuItem.Create(miSkins);
  5132. MenuItem.Caption := DSearchRec.Name;
  5133. MenuItem.OnClick := miSkinClick;
  5134. MenuItem.Enabled := SkinName <> DSearchRec.Name;
  5135. MenuItem.Checked := SkinName = DSearchRec.Name;
  5136. miSkins.Insert(0, MenuItem);
  5137. end;
  5138. FindResult := FindNext(DSearchRec);
  5139. end;
  5140. end;
  5141. begin
  5142. ImgLstColors.Clear;
  5143. while ppColors.Items.Count > 4 do
  5144. ppColors.Items.Delete(0);
  5145. Bitmap := TBitmap.Create;
  5146. Bitmap.SetSize(16, 16);
  5147. try
  5148. for iLoop := ColorDialog.CustomColors.Count - 1 downto 0 do
  5149. begin
  5150. ColorStr := Copy(ColorDialog.CustomColors[iLoop], 8, 6);
  5151. if ColorStr = 'FFFFFF' then
  5152. continue;
  5153. ColorStr := '$00' + ColorStr;
  5154. Bitmap.Canvas.Pen.Color := clGray;
  5155. Bitmap.Canvas.Pen.Style := psSolid;
  5156. Bitmap.Canvas.Brush.Color := StrToInt(ColorStr);
  5157. Bitmap.Canvas.Brush.Style := bsSolid;
  5158. Bitmap.Canvas.Rectangle(0, 0, Width, Height);
  5159. ImgLstColors.Add(Bitmap, nil);
  5160. MenuItem := TMenuItem.Create(ppColors);
  5161. MenuItem.Caption := '颜色' + IntToStr(iLoop);
  5162. MenuItem.Tag := StrToInt(ColorStr);
  5163. MenuItem.ImageIndex := ImgLstColors.Count - 1;
  5164. MenuItem.OnClick := miColorClick;
  5165. MenuItem.Enabled := MenuItem.Tag <> UIMainColor;
  5166. MenuItem.Checked := MenuItem.Tag = UIMainColor;
  5167. if MenuItem.Checked then
  5168. MenuItem.ImageIndex := -1;
  5169. ppColors.Items.Insert(0, MenuItem);
  5170. end;
  5171. finally
  5172. Bitmap.Free;
  5173. end;
  5174. miSkins.Clear;
  5175. //FindSkins(ExtractFilePath(Application.ExeName) + 'Skins\');
  5176. FindSkins(ExtractFilePath(Application.ExeName) + SkinPath);
  5177. end;
  5178. //------------------------------------------------------------------------------
  5179. procedure TMainForm.ChangePPMenuColorMap(PopupMenuEx: TCustomActionPopupMenuEx);
  5180. begin
  5181. HideUserCardForm;
  5182. PopupMenuEx.ColorMap.Color := FormColor;
  5183. PopupMenuEx.ColorMap.SelectedColor := ConvertColorToColor(PopupMenuEx.ColorMap.SelectedColor, UIMainColor);
  5184. PopupMenuEx.ColorMap.BtnFrameColor := ConvertColorToColor(PopupMenuEx.ColorMap.BtnFrameColor, UIMainColor);
  5185. PopupMenuEx.Font.Name := '宋体';
  5186. PopupMenuEx.Font.Size := 9;
  5187. end;
  5188. //------------------------------------------------------------------------------
  5189. procedure TMainForm.ppContacterViewStyleGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5190. begin
  5191. ChangePPMenuColorMap(ppContacterViewStyle.PopupMenu);
  5192. end;
  5193. //------------------------------------------------------------------------------
  5194. procedure TMainForm.ppLoginedUsersGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5195. begin
  5196. ChangePPMenuColorMap(ppLoginedUsers.PopupMenu);
  5197. end;
  5198. //------------------------------------------------------------------------------
  5199. procedure TMainForm.ppLoginedUsersPopup(Sender: TObject);
  5200. var
  5201. iLoop: Integer;
  5202. MenuItem: TMenuItem;
  5203. begin
  5204. while ppLoginedUsers.Items.Count > 2 do
  5205. ppLoginedUsers.Items.Delete(0);
  5206. for iLoop := 0 to RealICQClient.LoginedUsers.Count - 1 do
  5207. begin
  5208. if iLoop >= 20 then
  5209. Break;
  5210. MenuItem := TMenuItem.Create(ppLoginedUsers);
  5211. MenuItem.AutoHotkeys := maManual;
  5212. MenuItem.AutoLineReduction := maManual;
  5213. MenuItem.Caption := RealICQClient.LoginedUsers[iLoop];
  5214. MenuItem.OnClick := miChangeLoginNameClick;
  5215. MenuItem.Tag := iLoop;
  5216. ppLoginedUsers.Items.Insert(0, MenuItem);
  5217. end;
  5218. end;
  5219. procedure TMainForm.ppLoginStatesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5220. begin
  5221. ChangePPMenuColorMap(ppLoginStates.PopupMenu);
  5222. end;
  5223. procedure TMainForm.ppMainMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5224. begin
  5225. ChangePPMenuColorMap(ppMainMenu.PopupMenu);
  5226. end;
  5227. //------------------------------------------------------------------------------
  5228. procedure TMainForm.ppNetWorkFileGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5229. begin
  5230. ChangePPMenuColorMap(ppNetWorkFile.PopupMenu);
  5231. end;
  5232. //------------------------------------------------------------------------------
  5233. procedure TMainForm.ppNetWorkFilePopup(Sender: TObject);
  5234. begin
  5235. NDSelectItemChanged(nil);
  5236. miNDNewDir.Enabled := spbNDNewDir.Enabled;
  5237. miNDDelete.Enabled := spbNDDelete.Enabled;
  5238. miNDDownload.Enabled := spbNDDownload.Enabled;
  5239. miNDRename.Enabled := (FLVNetWorkDisk.SelCount = 1) and (not pnlNDMissions.Visible);
  5240. end;
  5241. //------------------------------------------------------------------------------
  5242. procedure TMainForm.ppNetWorkMissonGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5243. begin
  5244. ChangePPMenuColorMap(ppNetWorkMisson.PopupMenu);
  5245. end;
  5246. //------------------------------------------------------------------------------
  5247. procedure TMainForm.ppNetWorkMissonPopup(Sender: TObject);
  5248. begin
  5249. if PageControlNDMission.ActivePageIndex = 0 then
  5250. miNDCancel.Enabled := FLVNetWorkDiskUploadingFiles.SelCount > 0
  5251. else
  5252. miNDCancel.Enabled := FLVNetWorkDiskDownloadingFiles.SelCount > 0;
  5253. end;
  5254. procedure TMainForm.ppSelCallTelGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5255. begin
  5256. ChangePPMenuColorMap(ppSelCallTel.PopupMenu);
  5257. end;
  5258. procedure TMainForm.ppServerListGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5259. begin
  5260. ChangePPMenuColorMap(ppServerList.PopupMenu);
  5261. end;
  5262. procedure TMainForm.MeasureItem(Sender: TObject; ACanvas: TCanvas; var Width, Height: Integer);
  5263. begin
  5264. //在OnMeasureItem事件中改变菜单的宽度和高度
  5265. //改变菜单的宽度和高度以容纳文本
  5266. Width := edServerList.Width;
  5267. end;
  5268. procedure TMainForm.miChangeServerClick(Sender: TObject);
  5269. var
  5270. ServerInfo: TServerInfo;
  5271. ItemIndex: Integer;
  5272. RealICQContacterTreeView: TRealICQContacterTreeView;
  5273. begin
  5274. try
  5275. SetGetMoreUserEvent;
  5276. if Sender = nil then
  5277. begin
  5278. //RealICQClient.SendGetMoreBranch(FCurrentServerID);
  5279. RealICQClient.SendGetBranchs(FCurrentServerID, 0);
  5280. end
  5281. else
  5282. begin
  5283. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf((Sender as TMenuItem).Hint)] as TServerInfo;
  5284. if ServerInfo.ServerName = edServerList.Text then
  5285. Exit;
  5286. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  5287. if ItemIndex >= 0 then
  5288. begin
  5289. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5290. try
  5291. RealICQContacterTreeView.Clear;
  5292. FreeAndNil(RealICQContacterTreeView);
  5293. FContacterTreeViews.Delete(ItemIndex);
  5294. except
  5295. //Exit;
  5296. end;
  5297. end;
  5298. ImgLoadingMoreBranchs.Visible := True;
  5299. ScrollBoxMoreUser.Visible := False;
  5300. edServerList.Text := ServerInfo.ServerName;
  5301. //RealICQClient.SendGetMoreBranch(ServerInfo.ServerId);
  5302. RealICQClient.SendGetBranchs(ServerInfo.ServerId, 0);
  5303. FCurrentServerID := ServerInfo.ServerId;
  5304. end;
  5305. except
  5306. edServerList.Text := '';
  5307. end;
  5308. end;
  5309. //------------------------------------------------------------------------------
  5310. procedure TMainForm.ppTeamListViewGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5311. begin
  5312. ChangePPMenuColorMap(ppTeamListView.PopupMenu);
  5313. end;
  5314. //------------------------------------------------------------------------------
  5315. procedure TMainForm.ppTeamListViewPopup(Sender: TObject);
  5316. var
  5317. iLoop: Integer;
  5318. RealICQTeam: TRealICQTeam;
  5319. ListItem: TRealICQContacterListItem;
  5320. begin
  5321. actSendTeamMessage.Visible := FLVTeams.SelCount = 1;
  5322. actSeeTeamInformation.Visible := FLVTeams.SelCount = 1;
  5323. actShowTeamHistory.Visible := FLVTeams.SelCount = 1;
  5324. actQuitTeam.Visible := FLVTeams.SelCount = 1;
  5325. actDisbandTeam.Visible := FLVTeams.SelCount = 1;
  5326. actQuitOrDisbandTeams.Visible := FLVTeams.SelCount > 1;
  5327. self.miSendTeamSMS.Visible := FLVTeams.SelCount = 1;
  5328. if FLVTeams.SelCount = 1 then
  5329. begin
  5330. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  5331. begin
  5332. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  5333. if ListItem.Selected then
  5334. begin
  5335. RealICQTeam := ListItem.Data;
  5336. actDisbandTeam.Visible := AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName);
  5337. actQuitTeam.Visible := not actDisbandTeam.Visible;
  5338. if actDisbandTeam.Visible then
  5339. actSeeTeamInformation.Caption := '修改群组详细资料(&D)...'
  5340. else
  5341. actSeeTeamInformation.Caption := '查看群组详细资料(&D)...';
  5342. Break;
  5343. end;
  5344. end;
  5345. end;
  5346. end;
  5347. //------------------------------------------------------------------------------
  5348. procedure TMainForm.ppTrayIconGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5349. begin
  5350. ChangePPMenuColorMap(ppTrayIcon.PopupMenu);
  5351. end;
  5352. //------------------------------------------------------------------------------
  5353. procedure TMainForm.ppUserItemRightMenuGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  5354. begin
  5355. ChangePPMenuColorMap(ppUserItemRightMenu.PopupMenu);
  5356. end;
  5357. //------------------
  5358. function TMainForm.GetActiveTabSheetName: string;
  5359. //var ImageButton:TRealICQHoverImage;
  5360. begin
  5361. if ActiveButtonTag < 1 then
  5362. ActiveButtonTag := 1;
  5363. // ImageButton:=FToolBarButtonIconList.Objects[ActiveButtonTag-1] as TRealICQHoverImage;
  5364. Result := FToolBarButtonIconList[ActiveButtonTag - 1];
  5365. end;
  5366. //------------------------------------------------------------------------------
  5367. procedure TMainForm.ppUserItemRightMenuPopup(Sender: TObject);
  5368. var
  5369. iLoop, ItemIndex: Integer;
  5370. GroupName, TabSheetName: string;
  5371. Friend: TRealICQEmployee;
  5372. MenuItem: TMenuItem;
  5373. RealICQContacterTreeView: TRealICQContacterTreeView;
  5374. RealICQFriendTreeView: TRealICQContacterTreeView;
  5375. procedure SetMenuItemVisible;
  5376. begin
  5377. actSendMessage.Visible := actSendMessage.Enabled;
  5378. actSeeInformation.Visible := actSeeInformation.Enabled;
  5379. actShowHistory.Visible := actShowHistory.Enabled;
  5380. actChangeRemark.Visible := actChangeRemark.Enabled;
  5381. actDelFriend.Visible := actDelFriend.Enabled;
  5382. actRemoveUser.Visible := actRemoveUser.Enabled;
  5383. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5384. // miGroup.Visible := miGroup.Enabled;
  5385. end;
  5386. begin
  5387. miGoSpace.Visible := ShowSNS;
  5388. RealICQContacterTreeView := nil;
  5389. RealICQFriendTreeView := nil;
  5390. TabSheetName := GetActiveTabSheetName;
  5391. //如果是在“最近联系人”中弹出右键菜单
  5392. if TabSheetName = LVLatests then
  5393. begin
  5394. actSendMessage.Enabled := FLVLatests.SelCount = 1;
  5395. actSeeInformation.Enabled := FLVLatests.SelCount = 1;
  5396. actShowHistory.Enabled := FLVLatests.SelCount = 1;
  5397. actChangeRemark.Enabled := False;
  5398. actDelFriend.Enabled := False;
  5399. actRemoveUser.Enabled := False;
  5400. // miGroup.Enabled := False;
  5401. // miManageGroup.Enabled := False;
  5402. // miManageGroup.Visible := False;
  5403. // menuItemShowGroup.Visible := False;
  5404. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5405. SetMenuItemVisible;
  5406. Exit;
  5407. end;
  5408. actSendMessage.Enabled := False;
  5409. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5410. actSeeInformation.Enabled := False;
  5411. ;
  5412. actShowHistory.Enabled := False;
  5413. actChangeRemark.Enabled := False;
  5414. actRemoveUser.Enabled := False;
  5415. actDelFriend.Enabled := False;
  5416. // miGroup.Enabled := False;
  5417. // miManageGroup.Enabled := False;
  5418. // miManageGroup.Visible := False;
  5419. // menuItemShowGroup.Visible := False;
  5420. if TabSheetName = LVMyContacters then
  5421. begin
  5422. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  5423. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5424. if (RealICQContacterTreeView.GetSelectedEmployee <> nil) then
  5425. begin
  5426. actSendMessage.Enabled := True;
  5427. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5428. actSeeInformation.Enabled := True;
  5429. actShowHistory.Enabled := True;
  5430. actChangeRemark.Enabled := True;
  5431. // miGroup.Enabled := False;
  5432. actRemoveUser.Enabled := False;
  5433. actDelFriend.Enabled := False;
  5434. end;
  5435. SetMenuItemVisible;
  5436. Exit;
  5437. end;
  5438. if TabSheetName = LVMoreUsers then
  5439. begin
  5440. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  5441. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5442. if (RealICQContacterTreeView.GetSelectedEmployee <> nil) then
  5443. begin
  5444. actSendMessage.Enabled := True;
  5445. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5446. actSeeInformation.Enabled := True;
  5447. actShowHistory.Enabled := True;
  5448. actChangeRemark.Enabled := True;
  5449. // miGroup.Enabled := False;
  5450. actRemoveUser.Enabled := False;
  5451. actDelFriend.Enabled := False;
  5452. end;
  5453. SetMenuItemVisible;
  5454. Exit;
  5455. end;
  5456. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  5457. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5458. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  5459. // miManageGroup.Enabled := True;
  5460. // miManageGroup.Visible := True;
  5461. // menuItemShowGroup.Visible := True;
  5462. if Friend <> nil then
  5463. begin
  5464. GroupName := Friend.BranchID;
  5465. if GroupName = LvFriends then
  5466. actDelFriend.Enabled := True;
  5467. actSendMessage.Enabled := True;
  5468. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5469. actSeeInformation.Enabled := True;
  5470. actShowHistory.Enabled := True;
  5471. actChangeRemark.Enabled := True;
  5472. // miGroup.Enabled := True and (not FSearchListViewInVisible);
  5473. actRemoveUser.Enabled := True;
  5474. SetMenuItemVisible;
  5475. end
  5476. else
  5477. begin
  5478. SetMenuItemVisible;
  5479. Exit;
  5480. end;
  5481. if AnsiSameStr(GroupName, LVFriends) then
  5482. begin
  5483. // miGroup.Caption := '移动至组(&M)...';
  5484. actRemoveUser.Enabled := False;
  5485. end
  5486. else
  5487. begin
  5488. //在自定义组的用户列表控件上弹出右键菜单
  5489. actSendMessage.Enabled := True;
  5490. miGoSpace.Enabled := ShowSNS and actSendMessage.Enabled;
  5491. actSeeInformation.Enabled := True;
  5492. actShowHistory.Enabled := True;
  5493. actChangeRemark.Enabled := True;
  5494. // miGroup.Enabled := True and (not FSearchListViewInVisible);
  5495. // miGroup.Caption := '移动至组(&M)...';
  5496. end;
  5497. // miGroup.Clear;
  5498. if FShowGroup then
  5499. begin
  5500. for iLoop := 0 to FGroups.Count - 1 do
  5501. begin
  5502. if GroupName = FGroups[iLoop] then
  5503. continue;
  5504. // MenuItem := TMenuItem.Create(miGroup);
  5505. // MenuItem.Caption := FGroups[iLoop];
  5506. // MenuItem.OnClick := miMoveGroupClick;
  5507. // MenuItem.Enabled := miGroup.Enabled;
  5508. // miGroup.Add(MenuItem);
  5509. end;
  5510. // MenuItem := TMenuItem.Create(miGroup);
  5511. // MenuItem.Caption := '-';
  5512. // miGroup.Add(MenuItem);
  5513. end;
  5514. // miGroup.Enabled := miGroup.Count > 0;
  5515. end;
  5516. //------------------------------------------------------------------------------
  5517. procedure TMainForm.WMQueryEndSession(var message: TWMQUERYENDSESSION);
  5518. begin
  5519. try
  5520. try
  5521. //Dialogs.ShowMessage('关机');
  5522. FreeAndNil(NotReadMessageBoxForm);
  5523. Application.Terminate;
  5524. if RealICQClient.Logined then
  5525. RealICQClient.Logout;
  5526. except
  5527. end;
  5528. finally
  5529. message.Result := 1; //允许
  5530. end;
  5531. end;
  5532. //------------------------------------------------------------------------------
  5533. procedure TMainForm.WMPowerBroadcast(var message: TMessage);
  5534. begin
  5535. try
  5536. try
  5537. if message.wparam = 4 then //..休眠
  5538. begin
  5539. if RealICQClient.Logined then
  5540. RealICQClient.Logout;
  5541. end;
  5542. if message.wparam = 18 then // 休眠重起
  5543. begin
  5544. if RealICQClient.SavedPassword then
  5545. RealICQClient.LoginAsSaved;
  5546. end;
  5547. except
  5548. end;
  5549. finally
  5550. message.Result := 1; //允许
  5551. end;
  5552. end;
  5553. //------------------------------------------------------------------------------
  5554. procedure TMainForm.CMWininichange(var Message: TWMWinIniChange);
  5555. begin
  5556. ChangeUIColor(FUIMainColor);
  5557. //TMainFormController.GetController.ChangeUIColor(UIMainColor);
  5558. DisableAlign;
  5559. try
  5560. PostMessage(Handle, WM_SIZE, 0, 0);
  5561. finally
  5562. EnableAlign;
  5563. end;
  5564. end;
  5565. //------------------------------------------------------------------------------
  5566. procedure TMainForm.SetSearchListViewVisible(AShow: Boolean);
  5567. begin
  5568. FSearchListViewInVisible := AShow;
  5569. if AShow then
  5570. begin
  5571. pnlSearch.Left := shpFilterBorder.Left + 9;
  5572. pnlSearch.Top := shpFilterBorder.Top + shpFilterBorder.Height + 28;
  5573. pnlSearch.Width := shpFilterBorder.Width;
  5574. pnlSearch.Visible := True;
  5575. end
  5576. else
  5577. begin
  5578. pnlSearch.Visible := False;
  5579. end;
  5580. end;
  5581. //------------------------------------------------------------------------------
  5582. procedure TMainForm.edFilterKeywordChange(Sender: TObject);
  5583. var
  5584. iLoop: Integer;
  5585. RealICQUser: TRealICQUser;
  5586. KeyWord, UserCaption: string;
  5587. ItemIndex: Integer;
  5588. ListItem: TRealICQContacterListItem;
  5589. AUsers: TStringList;
  5590. begin
  5591. KeyWord := Trim(edFilterKeyword.Text);
  5592. if (KeyWord = '查找联系人...') or (KeyWord = '') then
  5593. begin
  5594. if FSearchListViewInVisible then
  5595. SetSearchListViewVisible(False);
  5596. end
  5597. else
  5598. begin
  5599. if not FSearchListViewInVisible then
  5600. SetSearchListViewVisible(True);
  5601. if AnsiSameText(KeyWord, FLastSearchKeyWord) then
  5602. Exit;
  5603. //删除当前结果中不符合新的查询条件的记录
  5604. FLastSearchKeyWord := KeyWord;
  5605. for iLoop := FSearchListView.Items.Count - 1 downto 0 do
  5606. begin
  5607. if not AnsiSameText(Trim(edFilterKeyword.Text), KeyWord) then
  5608. Exit;
  5609. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  5610. RealICQUser := ListItem.Data;
  5611. UserCaption := RealICQUser.DisplayName + '' + RealICQUser.LoginName + '' + RealICQUser.Watchword;
  5612. 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
  5613. FSearchListView.Items.Delete(iLoop);
  5614. Application.ProcessMessages;
  5615. end;
  5616. FSearchListView.FlashCaptionOnOnline := False;
  5617. //在好友列表中查找
  5618. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  5619. try
  5620. for iLoop := 0 to AUsers.Count - 1 do
  5621. begin
  5622. if not AnsiSameText(FLastSearchKeyWord, KeyWord) then
  5623. begin
  5624. Exit;
  5625. end;
  5626. RealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  5627. if (RealICQUser = RealICQClient.Me) then
  5628. continue;
  5629. UserCaption := RealICQUser.DisplayName + ' ' + RealICQUser.LoginName + ' ' + RealICQUser.Watchword;
  5630. 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
  5631. begin
  5632. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  5633. if ItemIndex = -1 then
  5634. begin
  5635. ItemIndex := FSearchListView.Items.Add(RealICQUser.LoginName);
  5636. ListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  5637. //BindUserDataToItem(ListItem, RealICQUser);
  5638. TUsersService.GetUsersService.UpdateListItem(FSearchListView, ListItem, RealICQUser);
  5639. Application.ProcessMessages;
  5640. end;
  5641. end;
  5642. end;
  5643. finally
  5644. FreeAndNil(AUsers);
  5645. end;
  5646. FSearchListView.FlashCaptionOnOnline := FFlashCaptionOnOnline;
  5647. if FSearchListView.Items.Count <= 0 then
  5648. begin
  5649. ScrollBoxSearchUser.Visible := False;
  5650. lblSearchResult.Caption := #10 + #13 + ' 无搜索结果';
  5651. lblSearchResult.Visible := True;
  5652. end
  5653. else
  5654. begin
  5655. ScrollBoxSearchUser.Visible := True;
  5656. lblSearchResult.Visible := False;
  5657. end;
  5658. end;
  5659. end;
  5660. procedure TMainForm.edFilterKeywordClick(Sender: TObject);
  5661. var
  5662. KeyWord: string;
  5663. begin
  5664. KeyWord := Trim(edFilterKeyword.Text);
  5665. if KeyWord = '查找联系人...' then
  5666. edFilterKeyword.Text := '';
  5667. edFilterKeyword.Font.Color := clWindowText;
  5668. end;
  5669. //------------------------------------------------------------------------------
  5670. procedure TMainForm.edFilterKeywordExit(Sender: TObject);
  5671. var
  5672. KeyWord: string;
  5673. begin
  5674. KeyWord := Trim(edFilterKeyword.Text);
  5675. if KeyWord = '' then
  5676. edFilterKeyword.Text := '查找联系人...';
  5677. edFilterKeyword.Font.Color := clGray;
  5678. end;
  5679. //------------------------------------------------------------------------------
  5680. procedure TMainForm.SetLoginStateControlState;
  5681. const
  5682. CA_TEXT: string = '您选择了使用CA登录';
  5683. begin
  5684. try
  5685. if (FLoginState = stLeave) or (FLoginState = stBusy) then
  5686. spbLoginState.Caption := FLeaveMessage
  5687. else
  5688. spbLoginState.Caption := StateValues[Integer(FLoginState)];
  5689. RealICQClient.LoginState := FLoginState;
  5690. RealICQClient.LeaveMessage := FLeaveMessage;
  5691. // RealICQClient.Me.LoginState := FLoginState;
  5692. // RealICQClient.Me.LeaveMessage := FLeaveMessage;
  5693. if FSavePassword then
  5694. ImgLstCheckStates.GetIcon(1, spbSavePassword.Icon)
  5695. else
  5696. ImgLstCheckStates.GetIcon(0, spbSavePassword.Icon);
  5697. if RealICQClient.CaEnable then
  5698. begin
  5699. if RealICQClient.CALogin then
  5700. begin
  5701. ImgLstCheckStates.GetIcon(1, btnCaLogin.Icon);
  5702. edLoginName.Text := CA_TEXT;
  5703. edLoginName.Enabled := False;
  5704. edPassword.Enabled := False;
  5705. spbChangeLoginName.Enabled := False;
  5706. end
  5707. else
  5708. begin
  5709. ImgLstCheckStates.GetIcon(0, btnCaLogin.Icon);
  5710. if SameText(CA_TEXT, edLoginName.Text) then
  5711. edLoginName.Text := '';
  5712. edLoginName.Enabled := True;
  5713. edPassword.Enabled := True;
  5714. spbChangeLoginName.Enabled := True;
  5715. end;
  5716. end;
  5717. FAutoLogin := FAutoLogin and FSavePassword;
  5718. spbAutoLogin.Enabled := FSavePassword;
  5719. if FAutoLogin then
  5720. ImgLstCheckStates.GetIcon(1, spbAutoLogin.Icon)
  5721. else
  5722. ImgLstCheckStates.GetIcon(0, spbAutoLogin.Icon);
  5723. except
  5724. on E: Exception do
  5725. begin
  5726. Error(E.Message, 'TMainForm.SetLoginStateControlState');
  5727. end;
  5728. end;
  5729. //ShowMeInformation;
  5730. end;
  5731. //------------------------------------------------------------------------------
  5732. procedure TMainForm.edLoginNameChange(Sender: TObject);
  5733. begin
  5734. if AnsiSameText(edLoginName.Text, RealICQClient.LoginName) and RealICQClient.SavedPassword then
  5735. begin
  5736. edPassword.Text := '保存的密码';
  5737. lblPasswordTitle.Enabled := False;
  5738. edPassword.Enabled := False;
  5739. spbSavePassword.Enabled := False;
  5740. FLoginAsSavePassword := True;
  5741. FLoginState := RealICQClient.LoginState;
  5742. FLeaveMessage := RealICQClient.LeaveMessage;
  5743. FSavePassword := RealICQClient.SavedPassword;
  5744. FAutoLogin := RealICQClient.AutoLogin;
  5745. SetLoginStateControlState;
  5746. end
  5747. else if FLoginAsSavePassword then
  5748. begin
  5749. edPassword.Text := '';
  5750. edPassword.Enabled := True;
  5751. lblPasswordTitle.Enabled := True;
  5752. spbSavePassword.Enabled := True;
  5753. FLoginAsSavePassword := False;
  5754. FLoginState := stOnline;
  5755. FLeaveMessage := '';
  5756. FSavePassword := False;
  5757. FAutoLogin := False;
  5758. SetLoginStateControlState;
  5759. end;
  5760. end;
  5761. //------------------------------------------------------------------------------
  5762. procedure TMainForm.edPasswordEnter(Sender: TObject);
  5763. begin
  5764. if not RealICQClient.CALogin then
  5765. begin
  5766. Self.FSavePassword := True;
  5767. // FAutoLogin := True;
  5768. RealICQClient.AutoLogin := FAutoLogin;
  5769. SetLoginStateControlState;
  5770. end;
  5771. end;
  5772. //------全市查找-----------------------------
  5773. procedure TMainForm.edtSearchMoreUserChange(Sender: TObject);
  5774. var
  5775. KeyWord: string;
  5776. iIndex, iLoop: Integer;
  5777. //FSearchMoreUserListView:TRealICQContacterListView;
  5778. begin
  5779. KeyWord := Trim((Sender as TEdit).Text);
  5780. iIndex := FContacterListViews.IndexOf(LVMoreUsers);
  5781. FSearchMoreUserListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  5782. FSearchMoreUserListView.Items.Clear;
  5783. if (KeyWord = '查找联系人...') or (KeyWord = '') then
  5784. begin
  5785. pnlSearchMoreUser.Visible := False;
  5786. Exit;
  5787. end
  5788. else
  5789. begin
  5790. RealICQClient.OnSearchUserResult := RealICQClientSearchUserResult;
  5791. RealICQClient.SendSearchMoreUser(KeyWord, FCurrentServerID);
  5792. pnlSearchMoreUser.Left := shpSearchMoreUser.Left;
  5793. pnlSearchMoreUser.Width := pnlSelectServer.Width - 22;
  5794. pnlSearchMoreUser.Top := shpSearchMoreUser.Top + shpSearchMoreUser.Height;
  5795. LblSearchHint.Caption := #10 + #10 + #10 + #10 + #10'正在查询,请稍侯。';
  5796. LblSearchHint.Visible := True;
  5797. ScrollBoxSearchMoreUser.Visible := False;
  5798. ImgLogining.Visible := True;
  5799. pnlSearchMoreUser.Visible := True;
  5800. pnlSearchMoreUser.BringToFront;
  5801. end;
  5802. end;
  5803. //--------------------------------------------------------
  5804. procedure TMainForm.edtSearchMoreUserClick(Sender: TObject);
  5805. var
  5806. KeyWord: string;
  5807. begin
  5808. KeyWord := Trim(edtSearchMoreUser.Text);
  5809. if KeyWord = '查找联系人...' then
  5810. edtSearchMoreUser.Text := '';
  5811. edtSearchMoreUser.Font.Color := clWindowText;
  5812. end;
  5813. procedure TMainForm.edtSearchMoreUserExit(Sender: TObject);
  5814. var
  5815. KeyWord: string;
  5816. begin
  5817. KeyWord := Trim(edtSearchMoreUser.Text);
  5818. if KeyWord = '' then
  5819. edtSearchMoreUser.Text := '查找联系人...';
  5820. edtSearchMoreUser.Font.Color := clGray;
  5821. end;
  5822. //------------------------------------------------------------------------------
  5823. procedure TMainForm.edWatchwordExit(Sender: TObject);
  5824. var
  5825. AWatchword: WideString;
  5826. begin
  5827. spbWatchword.Visible := True;
  5828. shpWatchwordBorder.Visible := False;
  5829. edWatchword.Visible := False;
  5830. if RealICQClient.Logined then
  5831. begin
  5832. if (not AnsiSameStr(Trim(edWatchword.Text), RealICQClient.Me.Watchword)) and (not AnsiSameStr(Trim(edWatchword.Text), '在此键入您的个性签名')) then
  5833. begin
  5834. AWatchword := Trim(edWatchword.Text);
  5835. spbWatchword.Hint := AWatchword;
  5836. spbWatchword.ShowHint := False;
  5837. //字符串长度过长时,截短字符串并在后面显示“...”
  5838. while spbWatchword.Canvas.TextWidth(AWatchword) > pnlTop.Width - 86 do
  5839. begin
  5840. if Length(AWatchword) > 3 then
  5841. begin
  5842. if Copy(AWatchword, Length(AWatchword) - 2, Length(AWatchword)) = '...' then
  5843. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 3);
  5844. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 1) + '...';
  5845. end
  5846. else
  5847. break;
  5848. spbWatchword.ShowHint := True;
  5849. end;
  5850. spbWatchword.Caption := edWatchword.Text;
  5851. RealICQClient.ChangeBaseInformation(RealICQClient.Me.DisplayName, Trim(edWatchword.Text));
  5852. end;
  5853. end;
  5854. end;
  5855. //------------------------------------------------------------------------------
  5856. procedure TMainForm.edWatchwordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  5857. begin
  5858. if Key = 13 then
  5859. edWatchwordExit(edWatchword);
  5860. end;
  5861. //------------------------------------------------------------------------------
  5862. procedure TMainForm.edWebSearchKeyWordEnter(Sender: TObject);
  5863. begin
  5864. //
  5865. end;
  5866. //------------------------------------------------------------------------------
  5867. procedure TMainForm.edWebSearchKeyWordExit(Sender: TObject);
  5868. begin
  5869. end;
  5870. //------------------------------------------------------------------------------
  5871. procedure TMainForm.edWebSearchKeyWordKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  5872. begin
  5873. if Key = 13 then
  5874. spbWebSearchClick(nil);
  5875. end;
  5876. //------------------------------------------------------------------------------
  5877. procedure TMainForm.spbWatchwordClick(Sender: TObject);
  5878. begin
  5879. if not RealICQClient.Logined then
  5880. Exit;
  5881. spbWatchword.Visible := False;
  5882. shpWatchwordBorder.Left := spbWatchword.Left;
  5883. shpWatchwordBorder.Top := spbWatchword.Top;
  5884. shpWatchwordBorder.Width := pnlTop.Width - 66;
  5885. shpWatchwordBorder.Height := spbWatchword.Height;
  5886. edWatchword.Left := shpWatchwordBorder.Left + 2;
  5887. edWatchword.Top := shpWatchwordBorder.Top + (shpWatchwordBorder.Height - edWatchword.Height) div 2 + 1;
  5888. edWatchword.Width := shpWatchwordBorder.Width - 6;
  5889. edWatchword.Text := RealICQClient.Me.Watchword;
  5890. shpWatchwordBorder.Visible := True;
  5891. edWatchword.Visible := True;
  5892. edWatchword.SetFocus;
  5893. edWatchword.SelStart := 0;
  5894. edWatchword.SelLength := Length(edWatchword.Text);
  5895. shpWatchwordBorder.BringToFront;
  5896. edWatchword.BringToFront;
  5897. end;
  5898. //------------------------------------------------------------------------------
  5899. procedure TMainForm.spbWebSearchClick(Sender: TObject);
  5900. begin
  5901. end;
  5902. //------------------------------------------------------------------------------
  5903. procedure TMainForm.spbWinMeetClick(Sender: TObject);
  5904. var
  5905. WinMeetPath, Parameter: string;
  5906. Branch: TRealICQBranch;
  5907. ItemIndex: Integer;
  5908. RealICQContacterTreeView: TRealICQContacterTreeView;
  5909. begin
  5910. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  5911. if (ItemIndex < 0) then
  5912. Exit;
  5913. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  5914. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(MainForm.RealICQClient.Me.BranchID);
  5915. if (ItemIndex < 0) then
  5916. Exit;
  5917. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  5918. while Branch.Node.Parent <> nil do
  5919. begin
  5920. Branch := TRealICQBranch(Branch.Node.Parent.Data);
  5921. end;
  5922. WinMeetPath := GetFilePahtFromRegedit('\Software\WinSoft\WinMeet', 'AppPath');
  5923. if Trim(WinMeetPath) = '' then
  5924. begin
  5925. ShowMessage('您还没有安装视频会议客户端!');
  5926. Exit;
  5927. end;
  5928. Parameter := ' ' + MainForm.RealICQClient.LoginName + ' ' + MD5En(RealICQClient.Password) + ' ' + Branch.BranchID;
  5929. ShellExecute(handle, 'open', PChar(WinMeetPath), PChar(Parameter), '', SW_SHOWNORMAL);
  5930. end;
  5931. //------------------------------------------------------------------------------
  5932. procedure TMainForm.CreateParams(var Params: TCreateParams);
  5933. begin
  5934. inherited;
  5935. //Inherited CreateParams(Params);
  5936. with Params do
  5937. begin
  5938. Params.WndParent := 0;
  5939. //Params.WndParent := GetDesktopWindow();
  5940. end;
  5941. end;
  5942. //------------------------------------------------------------------------------
  5943. procedure TMainForm.WndProc(var Message: TMessage);
  5944. begin
  5945. inherited wndproc(message);
  5946. if message.msg = WM_DEVICECHANGE then
  5947. RealICQClient.CheckAVDevice;
  5948. if message.msg = CLOSEWINDOWS then
  5949. QuitWindows;
  5950. // if (message.msg = WM_WINDOWPOSCHANGING) then
  5951. // pnlGroups.Refresh;
  5952. // Debug('WM_WINDOWPOSCHANGING','WM_WINDOWPOSCHANGING');
  5953. // if (message.msg = WM_WINDOWPOSCHANGED) then
  5954. // pnlGroups.Refresh;
  5955. // Debug('WM_WINDOWPOSCHANGED','WM_WINDOWPOSCHANGED');
  5956. //(Handle, WM_PRINTCLIENT, 0, 0);
  5957. {if (message.msg = WM_PAINT) or (message.msg = WM_NCPAINT) then
  5958. begin
  5959. ActionMainMenuBar.Refresh;
  5960. end;}
  5961. end;
  5962. procedure TMainForm.spbAddToNAClick(Sender: TObject);
  5963. var
  5964. TabSheet: TTabSheet;
  5965. WebBrowser: TWebBrowser;
  5966. begin
  5967. MainForm.FormStyle := fsNormal;
  5968. try
  5969. try
  5970. TabSheet := pgcMultiWeb.ActivePage;
  5971. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  5972. AddToFavorite(WebBrowser);
  5973. except
  5974. end;
  5975. finally
  5976. // if MainForm.AlwaysOnTop then
  5977. // MainForm.FormStyle := fsStayOnTop
  5978. // else
  5979. // MainForm.FormStyle := fsNormal;
  5980. end;
  5981. end;
  5982. //------------------------------------------------------------------------------
  5983. procedure TMainForm.spbWebCloseClick(Sender: TObject);
  5984. var
  5985. TabSheet: TTabSheet;
  5986. WebBrowser: TWebBrowser;
  5987. begin
  5988. TabSheet := pgcMultiWeb.ActivePage;
  5989. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  5990. if pgcMultiWeb.PageCount > 1 then
  5991. begin
  5992. try
  5993. if WebBrowser.Busy then
  5994. WebBrowser.Stop;
  5995. except
  5996. end;
  5997. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  5998. TabSheet.PageControl := nil;
  5999. FreeAndNil(TabSheet);
  6000. end
  6001. else
  6002. begin
  6003. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  6004. WebBrowser.Navigate('about:blank');
  6005. end;
  6006. end;
  6007. procedure TMainForm.spbAutoLoginClick(Sender: TObject);
  6008. begin
  6009. FAutoLogin := not FAutoLogin;
  6010. RealICQClient.AutoLogin := FAutoLogin;
  6011. SetLoginStateControlState;
  6012. end;
  6013. procedure TMainForm.HideMainForm;
  6014. begin
  6015. if FMovingMainForm then
  6016. Exit;
  6017. if RealICQClient.Logining then
  6018. Exit;
  6019. PostMessage(Handle, WM_KILLFOCUS, 0, 0);
  6020. self.SendToBack;
  6021. FMainFormHidden := True;
  6022. end;
  6023. procedure TMainForm.ShowMainForm;
  6024. begin
  6025. if FMovingMainForm then
  6026. Exit;
  6027. self.BringToFront;
  6028. PostMessage(Handle, WM_SETFOCUS, 0, 0);
  6029. FMainFormHidden := False;
  6030. end;
  6031. procedure TMainForm.WMSizing(var Msg: TMessage);
  6032. begin
  6033. inherited;
  6034. HideUserCardForm;
  6035. FMovingMainForm := True;
  6036. end;
  6037. procedure TMainForm.WMSize(var Msg: TMessage);
  6038. begin
  6039. inherited;
  6040. HideUserCardForm;
  6041. FMovingMainForm := False;
  6042. //CheckWindowPositon;
  6043. end;
  6044. procedure TMainForm.WMMoving(var Msg: TWMMoving);
  6045. var
  6046. BaseTop, BaseLeft: Integer;
  6047. rect:TRect;
  6048. begin
  6049. inherited;
  6050. HideUserCardForm;
  6051. FMovingMainForm := True;
  6052. rect.Left := 1;
  6053. rect.Top := 1;
  6054. rect.Bottom := Screen.Height - 1;
  6055. rect.Right := Screen.Width - 1;
  6056. Windows.ClipCursor(@rect);
  6057. BaseTop := (Height - ClientHeight) div 4;
  6058. BaseLeft := (Width - ClientWidth) div 4;
  6059. if (Msg.DragRect^.Top < -BaseTop) then
  6060. FHidePosition := hpTop
  6061. else if (Msg.DragRect^.Left < -BaseLeft) then
  6062. FHidePosition := hpLeft
  6063. else if (Msg.DragRect^.Left > (Screen.WorkAreaWidth - Width + BaseLeft)) then
  6064. FHidePosition := hpRight
  6065. else
  6066. FHidePosition := hpNone;
  6067. end;
  6068. procedure TMainForm.WMMove(var Msg: TMessage);
  6069. begin
  6070. HideUserCardForm;
  6071. FMovingMainForm := False;
  6072. Windows.ClipCursor(0);
  6073. if not FAutoHide then
  6074. exit;
  6075. if FWindowMoveing then
  6076. exit;
  6077. case FHidePosition of
  6078. hpTop:
  6079. WindowMove(False, -ClientHeight);
  6080. hpLeft:
  6081. WindowMove(False, -ClientWidth);
  6082. hpRight:
  6083. WindowMove(False, (Screen.WorkAreaWidth - Width + ClientWidth));
  6084. end;
  6085. if FHidePosition <> hpNone then
  6086. SetOnTop(Handle, True)
  6087. else
  6088. if not FAlwaysOnTop then
  6089. SetOnTop(Handle, False);
  6090. end;
  6091. procedure TMainForm.WMNCMouseMove(var msg: TWMNCMousemove);
  6092. var
  6093. BaseTop, BaseLeft, BaseRight: Integer;
  6094. begin
  6095. inherited;
  6096. if not FAutoHide then
  6097. exit;
  6098. if FWindowMoveing then
  6099. exit;
  6100. case FHidePosition of
  6101. hpTop:
  6102. case msg.HitTest of
  6103. HTBOTTOMLEFT, HTBOTTOM, HTBOTTOMRIGHT:
  6104. begin
  6105. BaseTop := (Height - ClientHeight) div 2;
  6106. if Top < -BaseTop then
  6107. begin
  6108. WindowMove(True, -BaseTop);
  6109. TimerForHideMainForm.Enabled := True;
  6110. end;
  6111. end;
  6112. end;
  6113. hpLeft:
  6114. case msg.HitTest of
  6115. HTTOPRIGHT, HTRIGHT, HTBOTTOMRIGHT:
  6116. begin
  6117. BaseLeft := (Width - ClientWidth) div 2;
  6118. if Left < -BaseLeft then
  6119. begin
  6120. WindowMove(True, -BaseLeft);
  6121. TimerForHideMainForm.Enabled := True;
  6122. end;
  6123. end;
  6124. end;
  6125. hpRight:
  6126. case msg.HitTest of
  6127. HTTOPLEFT, HTLEFT, HTBOTTOMLEFT:
  6128. begin
  6129. BaseLeft := (Width - ClientWidth) div 2;
  6130. BaseRight := Screen.WorkAreaWidth - ClientWidth - BaseLeft;
  6131. if Left > BaseRight then
  6132. begin
  6133. WindowMove(True, BaseRight);
  6134. TimerForHideMainForm.Enabled := True;
  6135. end;
  6136. end;
  6137. end;
  6138. end;
  6139. end;
  6140. procedure TMainForm.WindowMove(blnShow: Boolean; iBase: Integer);
  6141. begin
  6142. FWindowMoveing := true;
  6143. DisableAlign;
  6144. if not pnlLogout.Visible then
  6145. pnlWorkArea.Visible := False;
  6146. if blnShow then
  6147. begin
  6148. case FHidePosition of
  6149. hpTop:
  6150. begin
  6151. ANimateWindow(Handle, 20, AW_HIDE or AW_VER_POSITIVE);
  6152. sleep(10);
  6153. Top := iBase;
  6154. ANimateWindow(Handle, 300, AW_SLIDE or AW_VER_POSITIVE);
  6155. end;
  6156. hpLeft:
  6157. begin
  6158. ANimateWindow(Handle, 20, AW_HIDE or AW_HOR_POSITIVE);
  6159. sleep(10);
  6160. left := iBase;
  6161. ANimateWindow(Handle, 300, AW_SLIDE or AW_HOR_POSITIVE);
  6162. end;
  6163. hpRight:
  6164. begin
  6165. ANimateWindow(Handle, 20, AW_HIDE or AW_HOR_NEGATIVE);
  6166. sleep(10);
  6167. left := iBase;
  6168. ANimateWindow(Handle, 300, AW_SLIDE or AW_HOR_NEGATIVE);
  6169. end;
  6170. end;
  6171. end
  6172. else
  6173. begin
  6174. case FHidePosition of
  6175. hpTop:
  6176. begin
  6177. ANimateWindow(Handle, 300, AW_HIDE or AW_VER_NEGATIVE);
  6178. sleep(10);
  6179. Top := iBase;
  6180. ANimateWindow(Handle, 20, AW_VER_NEGATIVE);
  6181. end;
  6182. hpLeft:
  6183. begin
  6184. ANimateWindow(Handle, 300, AW_HIDE or AW_HOR_NEGATIVE);
  6185. sleep(10);
  6186. Left := iBase;
  6187. ANimateWindow(Handle, 20, AW_HOR_NEGATIVE);
  6188. end;
  6189. hpRight:
  6190. begin
  6191. ANimateWindow(Handle, 300, AW_HIDE or AW_HOR_POSITIVE);
  6192. sleep(10);
  6193. Left := iBase;
  6194. ANimateWindow(Handle, 20, AW_HOR_POSITIVE);
  6195. end;
  6196. end;
  6197. end;
  6198. if not pnlLogout.Visible then
  6199. pnlWorkArea.Visible := true;
  6200. EnableAlign;
  6201. FWindowMoveing := false;
  6202. end;
  6203. procedure TMainForm.TimerForHideMainFormTimer(Sender: TObject);
  6204. var
  6205. Rect: TRect;
  6206. begin
  6207. if FMovingMainForm then
  6208. Exit;
  6209. if FWindowMoveing then
  6210. exit;
  6211. if not FAutoHide then
  6212. begin
  6213. if FMainFormHidden then
  6214. ShowMainForm;
  6215. FHidePosition := hpNone;
  6216. TimerForHideMainForm.Enabled := False;
  6217. Exit;
  6218. end;
  6219. //搜狗输入法冲突
  6220. // if FHidePosition <> hpNone then
  6221. // SetOnTop(Handle,True);
  6222. TimerForHideMainForm.Enabled := false;
  6223. Rect.Top := self.Top;
  6224. Rect.Left := self.Left;
  6225. Rect.Right := self.Left + self.Width;
  6226. Rect.Bottom := self.Top + self.Height;
  6227. if not PtInRect(Rect, Mouse.CursorPos) then
  6228. begin
  6229. case FHidePosition of
  6230. hpTop:
  6231. if Top <> -ClientHeight then
  6232. WindowMove(False, -ClientHeight);
  6233. hpLeft:
  6234. if Left <> -ClientWidth then
  6235. WindowMove(False, -ClientWidth);
  6236. hpRight:
  6237. if Left <> Screen.WorkAreaWidth - Width + ClientWidth then
  6238. WindowMove(False, (Screen.WorkAreaWidth - Width + ClientWidth));
  6239. end;
  6240. end;
  6241. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  6242. end;
  6243. procedure TMainForm.CheckWindowPositon;
  6244. var
  6245. BaseTop, BaseLeft: Integer;
  6246. begin
  6247. BaseTop := (Height - ClientHeight) div 4;
  6248. BaseLeft := (Width - ClientWidth) div 4;
  6249. if (Top < -BaseTop) then
  6250. FHidePosition := hpTop
  6251. else if (Left < -BaseLeft) then
  6252. FHidePosition := hpLeft
  6253. else if (Left > (Screen.WorkAreaWidth - Width + BaseLeft)) then
  6254. FHidePosition := hpRight
  6255. else
  6256. FHidePosition := hpNone;
  6257. if TimerForHideMainForm <> nil then
  6258. TimerForHideMainForm.Enabled := FHidePosition <> hpNone;
  6259. end;
  6260. //------------------------------------------------------------------------------
  6261. procedure TMainForm.spbCancelFilterClick(Sender: TObject);
  6262. begin
  6263. edFilterKeyword.Text := '查找联系人...';
  6264. edFilterKeyword.Font.Color := clGray;
  6265. end;
  6266. procedure TMainForm.spbChangeLoginNameClick(Sender: TObject);
  6267. var
  6268. Point: TPoint;
  6269. begin
  6270. Point.X := 0;
  6271. Point.Y := spLoginNameBorder.Height + 1;
  6272. Point := spLoginNameBorder.ClientToScreen(Point);
  6273. ppLoginedUsers.Popup(Point.X, Point.Y);
  6274. end;
  6275. procedure TMainForm.spbContacterViewStyleClick(Sender: TObject);
  6276. var
  6277. Point: TPoint;
  6278. begin
  6279. Point.X := 0;
  6280. Point.Y := spbContacterViewStyle.Height + 1;
  6281. Point := spbContacterViewStyle.ClientToScreen(Point);
  6282. ppContacterViewStyle.Popup(Point.X, Point.Y);
  6283. end;
  6284. //------------------------------------------------------------------------------
  6285. procedure TMainForm.spbDisplayNameClick(Sender: TObject);
  6286. var
  6287. Point: TPoint;
  6288. begin
  6289. Point.X := 0;
  6290. Point.Y := spbDisplayName.Height + 1;
  6291. Point := spbDisplayName.ClientToScreen(Point);
  6292. ppChangeStates.Popup(Point.X, Point.Y);
  6293. end;
  6294. //------------------------------------------------------------------------------
  6295. procedure TMainForm.spbEmailClick(Sender: TObject);
  6296. begin
  6297. //AddWebBrowserToPageControl('http://www.lxtalk.com/rd/', 999);
  6298. end;
  6299. procedure TMainForm.spbFindTeamClick(Sender: TObject);
  6300. begin
  6301. //非办公助手企业用户无查找群组权限
  6302. if (FProductType <> ptBGZS) AND ((FUserType = utUnknown) OR (FUserType = utCompany)) then
  6303. begin
  6304. ShowMessage('您没有查找群组权限! ');
  6305. Exit;
  6306. end;
  6307. if SearchTeamForm <> nil then
  6308. begin
  6309. SearchTeamForm.BringToFront;
  6310. Exit;
  6311. end;
  6312. SearchTeamForm := TSearchTeamForm.Create(Application);
  6313. SearchTeamForm.Show;
  6314. end;
  6315. procedure TMainForm.spbGoClick(Sender: TObject);
  6316. var
  6317. TabSheet: TTabSheet;
  6318. WebBrowser: TWebBrowser;
  6319. begin
  6320. TabSheet := pgcMultiWeb.ActivePage;
  6321. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6322. WebBrowser.Tag := -1;
  6323. try
  6324. if (WebBrowser.Busy) then
  6325. WebBrowser.Stop;
  6326. except
  6327. end;
  6328. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  6329. WebBrowser.Navigate(cbxURLInputer.Text);
  6330. end;
  6331. //------------------------------------------------------------------------------
  6332. procedure TMainForm.spbLoginStateClick(Sender: TObject);
  6333. var
  6334. Point: TPoint;
  6335. begin
  6336. Point.X := 0;
  6337. Point.Y := spbLoginState.Height + 1;
  6338. Point := spbLoginState.ClientToScreen(Point);
  6339. ppLoginStates.Popup(Point.X, Point.Y);
  6340. end;
  6341. procedure TMainForm.spbNDCancelAllClick(Sender: TObject);
  6342. var
  6343. AMissionID: string;
  6344. UploadMission: TUploadMission;
  6345. ListItem: TRealICQContacterListItem;
  6346. begin
  6347. try
  6348. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count > 0) then
  6349. begin
  6350. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  6351. if Assigned(ListItem) then
  6352. begin
  6353. UploadMission := TUploadMission(ListItem.Data);
  6354. if Assigned(UploadMission) then
  6355. begin
  6356. AMissionID := UploadMission.FID;
  6357. try
  6358. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  6359. FreeAndNil(UploadMission);
  6360. except
  6361. end;
  6362. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  6363. end;
  6364. end;
  6365. end;
  6366. except
  6367. end;
  6368. try
  6369. if FLVNetWorkDiskUploadingFiles <> nil then
  6370. begin
  6371. FLVNetWorkDiskUploadingFiles.Items.Clear;
  6372. FLVNetWorkDiskUploadingFiles.ReDrawAll;
  6373. end;
  6374. except
  6375. end;
  6376. try
  6377. if FLVNetWorkDiskDownloadingFiles <> nil then
  6378. begin
  6379. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  6380. FLVNetWorkDiskDownloadingFiles.ReDrawAll;
  6381. end;
  6382. except
  6383. end;
  6384. ClearFileMissions;
  6385. pnlNDMissions.Visible := False;
  6386. SplitterNDMissions.Visible := False;
  6387. spbNDCancelAll.Enabled := False;
  6388. FConfirmReplaceResult := -1;
  6389. FLastDownloadDirectory := '';
  6390. CheckNDControlState;
  6391. end;
  6392. //------------------------------------------------------------------------------
  6393. procedure TMainForm.spbNDConnectClick(Sender: TObject);
  6394. var
  6395. LoginName: string;
  6396. begin
  6397. RealICQNetWorkDiskClient.TCPClient.RemoteAddress := RealICQClient.NetWorkDiskServerAddress;
  6398. RealICQNetWorkDiskClient.TCPClient.RemotePort := RealICQClient.NetWorkDiskServerPort;
  6399. RealICQNetWorkDiskClient.TCPClient.Proxy.Assign(RealICQClient.TCPClient.Proxy);
  6400. LoginName := RealICQClient.LoginName;
  6401. if Pos('+', RealICQClient.LoginName) > 0 then
  6402. LoginName := Copy(RealICQClient.LoginName, Pos('+', RealICQClient.LoginName) + 1, Length(RealICQClient.LoginName));
  6403. RealICQNetWorkDiskClient.Login(LoginName, RealICQClient.Password);
  6404. end;
  6405. procedure TMainForm.spbSavePasswordClick(Sender: TObject);
  6406. begin
  6407. FSavePassword := not FSavePassword;
  6408. SetLoginStateControlState;
  6409. end;
  6410. procedure TMainForm.spbSelectServerClick(Sender: TObject);
  6411. var
  6412. Point: TPoint;
  6413. begin
  6414. Point.X := 0;
  6415. Point.Y := spServerListBorder.Height;
  6416. Point := spServerListBorder.ClientToScreen(Point);
  6417. ppServerList.Popup(Point.X, Point.Y);
  6418. end;
  6419. procedure TMainForm.spbSelLanguageClick(Sender: TObject);
  6420. var
  6421. Point: TPoint;
  6422. begin
  6423. Point.X := 0;
  6424. Point.Y := (Sender as TRealICQSpeedButton).Height + 1;
  6425. Point := (Sender as TRealICQSpeedButton).ClientToScreen(Point);
  6426. ppLanguages.Popup(Point.X, Point.Y);
  6427. end;
  6428. procedure TMainForm.spbSelUIColorClick(Sender: TObject);
  6429. var
  6430. Point: TPoint;
  6431. begin
  6432. Point.X := 0;
  6433. Point.Y := (Sender as TRealICQSpeedButton).Height + 1;
  6434. Point := (Sender as TRealICQSpeedButton).ClientToScreen(Point);
  6435. ppColors.Popup(Point.X, Point.Y);
  6436. end;
  6437. procedure TMainForm.spbShowHideRightClick(Sender: TObject);
  6438. begin
  6439. //ShowOrHideMuiltiWeb;
  6440. end;
  6441. procedure TMainForm.spbStopClick(Sender: TObject);
  6442. var
  6443. TabSheet: TTabSheet;
  6444. WebBrowser: TWebBrowser;
  6445. begin
  6446. try
  6447. TabSheet := pgcMultiWeb.ActivePage;
  6448. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6449. if WebBrowser.Busy then
  6450. WebBrowser.Stop;
  6451. except
  6452. end;
  6453. end;
  6454. procedure TMainForm.TabSetMuiltWebClick(Sender: TObject);
  6455. var
  6456. TabSheet: TTabSheet;
  6457. WebBrowser: TWebBrowser;
  6458. begin
  6459. pgcMultiWeb.ActivePageIndex := TabSetMuiltWeb.TabIndex;
  6460. try
  6461. TabSheet := pgcMultiWeb.ActivePage;
  6462. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6463. if not AnsiSameText(WebBrowser.LocationURL, 'about:blank') then
  6464. begin
  6465. with cbxURLInputer.ItemsEx.Add do
  6466. begin
  6467. Caption := WebBrowser.LocationURL;
  6468. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  6469. ImageIndex := 2
  6470. else if Copy(Caption, 1, 4) = 'ftp:' then
  6471. ImageIndex := 1
  6472. else
  6473. ImageIndex := 0;
  6474. end;
  6475. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  6476. end;
  6477. except
  6478. end;
  6479. end;
  6480. procedure TMainForm.TabSetMuiltWebGetImageIndex(Sender: TObject; TabIndex: Integer; var ImageIndex: Integer);
  6481. var
  6482. TabSheet: TTabSheet;
  6483. WebBrowser: TWebBrowser;
  6484. AImageIndex: Integer;
  6485. begin
  6486. AImageIndex := 0;
  6487. try
  6488. TabSheet := pgcMultiWeb.Pages[TabIndex];
  6489. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  6490. if not AnsiSameText(WebBrowser.LocationURL, 'about:blank') then
  6491. begin
  6492. with cbxURLInputer.ItemsEx.Add do
  6493. begin
  6494. Caption := WebBrowser.LocationURL;
  6495. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  6496. ImageIndex := 2
  6497. else if Copy(Caption, 1, 4) = 'ftp:' then
  6498. ImageIndex := 1
  6499. else
  6500. ImageIndex := 0;
  6501. AImageIndex := ImageIndex;
  6502. end;
  6503. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  6504. end;
  6505. except
  6506. end;
  6507. ImageIndex := AImageIndex;
  6508. end;
  6509. procedure TMainForm.TabSetNDMissionsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
  6510. begin
  6511. PageControlNDMission.ActivePageIndex := TabSetNDMissions.TabIndex;
  6512. end;
  6513. procedure TMainForm.TabSetNDMissionsClick(Sender: TObject);
  6514. begin
  6515. PageControlNDMission.ActivePageIndex := TabSetNDMissions.TabIndex;
  6516. end;
  6517. procedure TMainForm.TimerForCheckDblClickTimer(Sender: TObject);
  6518. begin
  6519. TimerForCheckDblClick.Enabled := False;
  6520. SetForegroundWindow(TrueHiddenMainForm.Handle);
  6521. if RealICQClient.Logined and RealICQClient.Connected then
  6522. ppChangeStates.Popup(FCursorPosX, Screen.WorkAreaHeight)
  6523. else
  6524. ppTrayIcon.Popup(FCursorPosX, Screen.WorkAreaHeight);
  6525. end;
  6526. procedure TMainForm.TimerForCheckLogoutTimeoutTimer(Sender: TObject);
  6527. begin
  6528. TimerForCheckLogoutTimeout.Enabled := False;
  6529. RealICQClient.Logout;
  6530. SetUIState;
  6531. end;
  6532. procedure TMainForm.TrayIconClick(Sender: TObject);
  6533. begin
  6534. FCursorPosX := Mouse.CursorPos.X;
  6535. TimerForCheckDblClick.Interval := GetDoubleClickTime();
  6536. if not TimerForCheckDblClick.Enabled then
  6537. TimerForCheckDblClick.Enabled := True;
  6538. end;
  6539. procedure TMainForm.OpenNotReadMessage(iIndex: Integer);
  6540. var
  6541. nTeamID: string;
  6542. MessageID, SMSReceiver: string;
  6543. SystemMessage: TRealICQSystemMessage;
  6544. SMSForm: TSMSForm;
  6545. MessageList: TList;
  6546. NotReadMessage: TNotReadMessage;
  6547. begin
  6548. if (iIndex < 0) and (iIndex >= FNotReadMessages.Count) then
  6549. Exit;
  6550. if FNotReadMessages.Count = 0 then
  6551. actOpenMainForm.Execute
  6552. else
  6553. begin
  6554. MessageID := FNotReadMessages.Strings[iIndex];
  6555. if AnsiSameStr(Copy(MessageID, 1, Length(SMSMessageID)), SMSMessageID) then
  6556. begin
  6557. SMSReceiver := Copy(MessageID, Length(SMSMessageID) + 1, Length(MessageID) - Length(SMSMessageID));
  6558. // if SMSReceiver <> '' then
  6559. SMSForm := OpenSMSForm(SMSReceiver)
  6560. // else
  6561. // SMSForm := OpenSMSForm()
  6562. end
  6563. else if AnsiSameStr(Copy(MessageID, 1, Length(TeamMessageID)), TeamMessageID) then
  6564. begin
  6565. nTeamID := Copy(MessageID, Length(TeamMessageID) + 1, Length(MessageID) - Length(TeamMessageID));
  6566. OpenTeamTalkingForm(nTeamID);
  6567. end
  6568. else if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  6569. begin
  6570. try
  6571. SystemMessage := FNotReadMessages.Objects[iIndex] as TRealICQSystemMessage;
  6572. ShowSystemMessage(SystemMessage);
  6573. finally
  6574. FNotReadMessages.Delete(iIndex);
  6575. try
  6576. NotReadMessageBoxForm.ShowNotReadMessage;
  6577. NotReadMessageBoxForm.Height := 0;
  6578. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  6579. except
  6580. end;
  6581. end;
  6582. end
  6583. else
  6584. begin
  6585. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  6586. NotReadMessage := MessageList[0];
  6587. OpenTalkingForm(MessageID, True, NotReadMessage.FRealICQClient);
  6588. end;
  6589. end;
  6590. end;
  6591. procedure TMainForm.TrayIconDblClick(Sender: TObject);
  6592. var
  6593. BaseTop, BaseLeft: Integer;
  6594. begin
  6595. TimerForCheckDblClick.Enabled := False;
  6596. OpenNotReadMessage(FNotReadMessages.Count - 1);
  6597. if FHidePosition <> hpNone then
  6598. begin
  6599. TimerForHideMainForm.Enabled := False;
  6600. FHidePosition := hpNone;
  6601. BaseTop := (Height - ClientHeight) div 4;
  6602. BaseLeft := (Width - ClientWidth) div 4;
  6603. Self.Top := 0;
  6604. Self.left := Screen.WorkAreaWidth - Width;
  6605. if not FAlwaysOnTop then
  6606. SetOnTop(Handle, False);
  6607. end;
  6608. end;
  6609. procedure TMainForm.TrayIconMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  6610. var
  6611. iTimes: Integer;
  6612. ANeedShow: Boolean;
  6613. rcTray: TRect;
  6614. hwndTray: hWnd;
  6615. hwndChild: hWnd;
  6616. begin
  6617. try
  6618. if not Assigned(NotReadMessageBoxForm) then
  6619. Exit;
  6620. ANeedShow := (FNotReadMessages <> nil) and (FNotReadMessages.Count > 0) and (MainForm.RealICQClient.Connected) and (TimerForFlashTrayIcon.Enabled);
  6621. if not ANeedShow then
  6622. begin
  6623. if NotReadMessageBoxForm.Visible then
  6624. begin
  6625. NotReadMessageBoxForm.Visible := False;
  6626. NotReadMessageBoxForm.Timer1.Enabled := False;
  6627. end;
  6628. Exit;
  6629. end;
  6630. if (not NotReadMessageBoxForm.Visible) and (NotReadMessageBoxForm.Tag = 1) then
  6631. begin
  6632. //TrayIcon.Hint := '';
  6633. NotReadMessageBoxForm.Tag := 0;
  6634. hwndTray := FindWindow('Shell_TrayWnd', nil);
  6635. hwndChild := FindWindowEx(hwndTray, 0, 'TrayNotifyWnd', nil);
  6636. GetWindowRect(hwndChild, rcTray);
  6637. FTrayIconRect.Left := X - 20;
  6638. FTrayIconRect.Top := rcTray.Top;
  6639. FTrayIconRect.Right := FTrayIconRect.Left + 40;
  6640. FTrayIconRect.Bottom := rcTray.Bottom;
  6641. NotReadMessageBoxForm.ShowNotReadMessage;
  6642. NotReadMessageBoxForm.Height := 0;
  6643. NotReadMessageBoxForm.FRect := FTrayIconRect;
  6644. //NotReadMessageBoxForm.Left := X - NotReadMessageBoxForm.Width div 2;
  6645. NotReadMessageBoxForm.Left := Screen.WorkAreaWidth - NotReadMessageBoxForm.Width;
  6646. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  6647. NotReadMessageBoxForm.FRect.Left := NotReadMessageBoxForm.FRect.Left;
  6648. NotReadMessageBoxForm.FRect.Top := NotReadMessageBoxForm.Top;
  6649. NotReadMessageBoxForm.FRect.Right := NotReadMessageBoxForm.FRect.Right;
  6650. NotReadMessageBoxForm.FRect.Bottom := NotReadMessageBoxForm.FRect.Bottom;
  6651. NotReadMessageBoxForm.Visible := True;
  6652. NotReadMessageBoxForm.Timer1.Enabled := True;
  6653. end;
  6654. //MessageBoxForm.Visible := FNotReadMessages.Count > 0;
  6655. except
  6656. end;
  6657. end;
  6658. procedure TMainForm.TrayIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  6659. begin
  6660. //if AutoUpdateForm <> nil then Exit;
  6661. if Button = mbRight then
  6662. begin
  6663. SetForegroundWindow(TrueHiddenMainForm.Handle);
  6664. self.BringToFront;
  6665. ppTrayIcon.Popup(Mouse.CursorPos.X, Screen.WorkAreaHeight);
  6666. end;
  6667. end;
  6668. //------------------------------------------------------------------------------
  6669. {通讯录}
  6670. //------------------------------------------------------------------------------
  6671. procedure TMainForm.tsAddrBookShow(Sender: TObject);
  6672. begin
  6673. //
  6674. end;
  6675. //----保存联系人----------------------------------------------------- ---------
  6676. procedure TMainForm.SaveContacter(Name, Mobile, Tel, Email, Remark, BranchId: string);
  6677. var
  6678. MessageId, ParamValue: string;
  6679. begin
  6680. MessageId := IntToStr(GetTickCount);
  6681. CreateManageGroupMemberMessage('', Name, '', Mobile, Tel, Email, Remark, BranchId, MessageId);
  6682. //发送新增联系人消息
  6683. ParamValue := MessageId + #10 + '' + #10 + Name + #10 + Mobile + #10 + Tel + #10 + Email + #10 + Remark + #10 + '' + #10 + BranchId;
  6684. RealICQClient.SendAddrBookCommand(1, 1, ParamValue);
  6685. end;
  6686. //----修改备注名称--------------------------------------------------------------
  6687. procedure TMainForm.miSendTeamSMSClick(Sender: TObject);
  6688. var
  6689. iLoop: Integer;
  6690. ListItem: TRealICQContacterListItem;
  6691. RealICQTeam: TRealICQTeam;
  6692. begin
  6693. if not MainForm.RealICQClient.UserPermission.EnableMultiSendSms then
  6694. begin
  6695. ShowMessage('您没有短信群发权限!');
  6696. Exit;
  6697. end;
  6698. if FLVTeams.SelCount = 1 then
  6699. begin
  6700. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  6701. begin
  6702. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  6703. if ListItem.Selected then
  6704. begin
  6705. RealICQTeam := ListItem.Data;
  6706. OpenTeamSMSForm(RealICQTeam.TeamID);
  6707. Break;
  6708. end;
  6709. end;
  6710. end;
  6711. end;
  6712. procedure TMainForm.miSetRemarkClick(Sender: TObject);
  6713. var
  6714. LoginName: string;
  6715. Remark, MessageId, ParamValue: string;
  6716. RealICQUser: TRealICQUser;
  6717. Employee: TRealICQEmployee;
  6718. RealICQContacterTreeView: TRealICQContacterTreeView;
  6719. ItemIndex: Integer;
  6720. begin
  6721. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6722. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6723. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6724. LoginName := Employee.LoginName;
  6725. if LoginName <> '' then
  6726. begin
  6727. RealICQUser := GetAddrBookUser(Employee.BranchID, LoginName);
  6728. if RealICQUser = nil then
  6729. Exit;
  6730. Remark := RealICQUser.Remark;
  6731. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  6732. if not AnsiSameStr(Remark, RealICQUser.Remark) then//发送修改备注
  6733. begin
  6734. MessageId := IntToStr(GetTickCount);
  6735. CreateManageGroupMemberMessage(RealICQUser.LoginName, RealICQUser.DisplayName, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, Remark, Employee.BranchID, MessageId);
  6736. //发送修改联系人消息
  6737. RealICQUser.Remark := Remark;
  6738. LoginName := Employee.LoginName;
  6739. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6740. ParamValue := MessageId + #10 + LoginName + #10 + RealICQUser.DisplayName + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Watchword + #10 + Remark + #10 + Employee.BranchId;
  6741. MainForm.RealICQClient.SendAddrBookCommand(6, 1, ParamValue);
  6742. end;
  6743. end;
  6744. end;
  6745. procedure TMainForm.miAddGroupClick(Sender: TObject);
  6746. var
  6747. ItemIndex, iLoop: Integer;
  6748. RealICQContacterTreeView: TRealICQContacterTreeView;
  6749. TmpBranch: TRealICQBranchInfo;
  6750. Branch: TRealICQBranch;
  6751. GroupName, ResultStr, SelBranchName: string;
  6752. ParamValue: string;
  6753. MessageId: string;
  6754. BranchNames, TmpList: TStringList;
  6755. Employee: TRealICQEmployee;
  6756. begin
  6757. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6758. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6759. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6760. if Branch = nil then
  6761. begin
  6762. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6763. if Employee <> nil then
  6764. Branch := Employee.Node.Parent.Data;
  6765. end;
  6766. if Branch <> nil then
  6767. SelBranchName := Branch.BranchName
  6768. else
  6769. SelBranchName := '我的通讯录';
  6770. BranchNames := TStringList.Create;
  6771. try
  6772. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6773. begin
  6774. TmpBranch := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6775. GroupName := '';
  6776. GetParentGroupNameList(TmpBranch, GroupName);
  6777. BranchNames.AddObject(GroupName, TmpBranch);
  6778. if TmpBranch.ID = Branch.BranchID then
  6779. SelBranchName := GroupName;
  6780. end;
  6781. ResultStr := ShowAddrGroupInputBox('新建组', SelBranchName, BranchNames);
  6782. if ResultStr = '' then
  6783. exit;
  6784. TmpList := SplitString(ResultStr, #10);
  6785. GroupName := TmpList[1];
  6786. if BranchNames.IndexOf(TmpList[0] + GroupName + '\') >= 0 then
  6787. begin
  6788. ShowMessage('已存在相同名称的组!');
  6789. Exit;
  6790. end;
  6791. TmpBranch := BranchNames.Objects[BranchNames.IndexOf(TmpList[0])] as TRealICQBranchInfo;
  6792. //发送添加通讯录组消息
  6793. MessageId := IntToStr(GetTickCount);
  6794. CreateManageGroupMessage(TmpBranch.ID, GroupName, TmpBranch.ParentID, MessageId);
  6795. ParamValue := MessageId + #10 + GroupName + #10 + '0' + #10 + TmpBranch.ID + #10 + MainForm.RealICQClient.Me.LoginName;
  6796. MainForm.RealICQClient.SendAddrBookCommand(1, 0, ParamValue);
  6797. finally
  6798. BranchNames.Free;
  6799. end;
  6800. end;
  6801. procedure TMainForm.miUpdateGroupClick(Sender: TObject);
  6802. var
  6803. ItemIndex: Integer;
  6804. RealICQContacterTreeView: TRealICQContacterTreeView;
  6805. Branch: TRealICQBranch;
  6806. GroupName, MessageId, ParamValue: string;
  6807. begin
  6808. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6809. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6810. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6811. if Branch <> nil then
  6812. begin
  6813. GroupName := Branch.BranchName;
  6814. if GroupName = '我的通讯录' then
  6815. begin
  6816. ShowMessage('默认组不允许修改!');
  6817. Exit;
  6818. end;
  6819. end
  6820. else
  6821. begin
  6822. ShowMessage('请选择要修改的组!');
  6823. Exit;
  6824. end;
  6825. GroupName := ShowMyInputBox('修改组', '组名称', GroupName, 500);
  6826. if (GroupName <> Branch.BranchName) and (GroupName <> '') then
  6827. begin
  6828. //发送修改通讯录组名消息
  6829. MessageId := IntToStr(GetTickCount);
  6830. CreateManageGroupMessage(Branch.BranchID, GroupName, Branch.ParentID, MessageId);
  6831. ParamValue := MessageId + #10 + GroupName + #10 + Branch.BranchID + #10 + Branch.ParentID + #10 + MainForm.RealICQClient.Me.LoginName;
  6832. MainForm.RealICQClient.SendAddrBookCommand(2, 0, ParamValue);
  6833. end;
  6834. end;
  6835. //-----删除通讯录组----------------------------------------------------
  6836. procedure TMainForm.miDelGroupClick(Sender: TObject);
  6837. var
  6838. ItemIndex: Integer;
  6839. RealICQContacterTreeView: TRealICQContacterTreeView;
  6840. Branch: TRealICQBranch;
  6841. GroupId: string;
  6842. ParamValue: string;
  6843. MessageId: string;
  6844. begin
  6845. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6846. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6847. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6848. GroupId := '';
  6849. if Branch <> nil then
  6850. begin
  6851. if Branch.ParentID = '0' then
  6852. begin
  6853. ShowMessage('默认组不可以删除');
  6854. Exit;
  6855. end;
  6856. if MessageBox(Handle, '确定要将选中的组删除吗?', '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  6857. Exit;
  6858. //发送删除通讯录组消息
  6859. MessageId := IntToStr(GetTickCount);
  6860. GetChildsGroupId(Branch.BranchID, GroupId);
  6861. CreateManageGroupMessage(GroupId, Branch.BranchName, Branch.ParentID, MessageId);
  6862. ParamValue := MessageId + #10 + GroupId + #10 + Branch.BranchID + #10 + Branch.ParentID + #10 + MainForm.RealICQClient.Me.LoginName;
  6863. MainForm.RealICQClient.SendAddrBookCommand(3, 0, ParamValue);
  6864. end
  6865. else
  6866. ShowMessage('请选择要删除的组!');
  6867. end;
  6868. //-----新增用户到通讯录---------------------------------------
  6869. procedure TMainForm.miAddGroupUserClick(Sender: TObject);
  6870. var
  6871. MessageId, ParamValue, BranchID: string;
  6872. Branch: TRealICQBranch;
  6873. TmpBranch: TRealICQBranchInfo;
  6874. Employee: TRealICQEmployee;
  6875. RealICQUser: TRealICQUser;
  6876. Node: TTreeNode;
  6877. ItemIndex, iLoop: Integer;
  6878. BranchNames: TStringList;
  6879. BranchName, GroupName: string;
  6880. RealICQContacterTreeView: TRealICQContacterTreeView;
  6881. begin
  6882. BranchName := '我的通讯录\';
  6883. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6884. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6885. Branch := RealICQContacterTreeView.GetSelectedBranch;
  6886. if Branch = nil then
  6887. begin
  6888. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6889. if Employee <> nil then
  6890. begin
  6891. Node := Employee.Node.Parent;
  6892. Branch := Node.Data;
  6893. end;
  6894. end;
  6895. if Branch <> nil then
  6896. begin
  6897. if Branch.BranchName = '我的通讯录' then
  6898. begin
  6899. ShowMessage('默认组下面不允许添加联系人!');
  6900. Exit;
  6901. end;
  6902. BranchID := Branch.BranchID;
  6903. end;
  6904. if (GetGroupUserCount + 1) > MainForm.RealICQClient.UserPermission.AddrBookSize then
  6905. begin
  6906. ShowMessage('您的通讯录已满或者没有添加联系人的权限!' + #13 + '请联系系统管理员。');
  6907. Exit;
  6908. end;
  6909. BranchNames := TStringList.Create;
  6910. try
  6911. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  6912. begin
  6913. TmpBranch := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  6914. GroupName := '';
  6915. GetParentGroupNameList(TmpBranch, GroupName);
  6916. if TmpBranch.ID = BranchID then
  6917. BranchNames.InsertObject(0, GroupName, TmpBranch)
  6918. else
  6919. BranchNames.AddObject(GroupName, TmpBranch);
  6920. end;
  6921. //弹出新增联系人窗体
  6922. RealICQUser := TRealICQUser.Create('', RealICQClient);
  6923. if not ShowAddrUserInputBox('新增联系人', RealICQUser, BranchNames) then
  6924. Exit;
  6925. if Trim(RealICQUser.Nickname) = '' then
  6926. Exit;
  6927. MessageId := IntToStr(GetTickCount);
  6928. CreateManageGroupMemberMessage('', RealICQUser.Nickname, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, RealICQUser.Remark1, BranchID, MessageId);
  6929. //发送新增联系人消息
  6930. ParamValue := MessageId + #10 + '' + #10 + RealICQUser.Nickname + #10 + RealICQUser.Mobile + #10 + RealICQUser.Tel + #10 + RealIcqUser.Email + #10 + RealICQUser.Remark1 + #10 + RealICQUser.Remark + #10 + BranchID;
  6931. RealICQClient.SendAddrBookCommand(1, 1, ParamValue);
  6932. finally
  6933. BranchNames.Free;
  6934. end;
  6935. end;
  6936. procedure TMainForm.miBusyClick(Sender: TObject);
  6937. begin
  6938. FLoginState := stBusy;
  6939. FLeaveMessage := '忙碌';
  6940. SetLoginStateControlState;
  6941. end;
  6942. procedure TMainForm.miUpdateGroupUserClick(Sender: TObject);
  6943. var
  6944. ItemIndex, iLoop: Integer;
  6945. RealICQContacterTreeView: TRealICQContacterTreeView;
  6946. Employee: TRealICQEmployee;
  6947. BranchNames: TStringList;
  6948. Branch: TRealICQBranch;
  6949. RealICQUser: TRealICQUser;
  6950. LoginName: string;
  6951. ParamValue: string;
  6952. MessageId: string;
  6953. ParentNode: TTreeNode;
  6954. begin
  6955. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  6956. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  6957. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  6958. if Employee <> nil then
  6959. begin
  6960. //弹出修改窗体
  6961. BranchNames := TStringList.Create;
  6962. try
  6963. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  6964. begin
  6965. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  6966. if Branch.BranchID = Employee.BranchID then
  6967. BranchNames.Insert(0, Branch.BranchName)
  6968. else
  6969. BranchNames.Add(Branch.BranchName);
  6970. end;
  6971. ParentNode := Employee.Node.Parent;
  6972. Branch := ParentNode.Data;
  6973. RealICQUser := GetAddrBookUser(Employee.BranchID, Employee.LoginName);
  6974. if not ShowAddrUserInputBox('查看/编辑联系人', RealICQUser, BranchNames) then
  6975. Exit;
  6976. MessageId := IntToStr(GetTickCount);
  6977. CreateManageGroupMemberMessage(RealICQUser.LoginName, RealICQUser.DisplayName, RealICQUser.Remark, RealICQUser.Mobile, RealICQUser.Tel, RealICQUser.Email, RealICQUser.Remark1, Employee.BranchID, MessageId);
  6978. //发送修改联系人消息
  6979. LoginName := Employee.LoginName;
  6980. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  6981. 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;
  6982. MainForm.RealICQClient.SendAddrBookCommand(2, 1, ParamValue);
  6983. finally
  6984. BranchNames.Free;
  6985. end;
  6986. end
  6987. else
  6988. ShowMessage('请选择要修改的联系人!');
  6989. end;
  6990. //----删除联系人-------------------------------------------------------------
  6991. procedure TMainForm.miDelGroupUserClick(Sender: TObject);
  6992. var
  6993. ItemIndex: Integer;
  6994. RealICQContacterTreeView: TRealICQContacterTreeView;
  6995. Employee: TRealICQEmployee;
  6996. ParamValue: string;
  6997. MessageId, LoginName: string;
  6998. begin
  6999. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7000. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7001. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7002. if Employee = nil then
  7003. begin
  7004. ShowMessage('请选择要删除的联系人');
  7005. Exit
  7006. end;
  7007. //发送删除通讯录组联系人消息
  7008. MessageId := IntToStr(GetTickCount);
  7009. CreateManageGroupMemberMessage(Employee.LoginName, Employee.DisplayName, '', Employee.Mobile, '', '', '', Employee.BranchID, MessageId);
  7010. LoginName := Employee.LoginName;
  7011. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  7012. ParamValue := MessageId + #10 + LoginName + #10 + Employee.DisplayName + #10 + Employee.Mobile + #10 + '' + #10 + '' + #10 + '' + #10 + '' + #10 + Employee.BranchId;
  7013. MainForm.RealICQClient.SendAddrBookCommand(3, 1, ParamValue);
  7014. end;
  7015. procedure TMainForm.spbExportGroupUserClick(Sender: TObject);
  7016. var
  7017. ItemIndex, iLoop, jLoop, IIndex: Integer;
  7018. RealICQContacterTreeView: TRealICQContacterTreeView;
  7019. Branch: TRealICQBranch;
  7020. RealICQUser: TRealICQUser;
  7021. BranchInfo: TRealICQBranchInfo;
  7022. GroupId: string;
  7023. begin
  7024. SD.Title := '导出通讯录另存为';
  7025. SD.Filter := 'CSV(*.csv)|*.csv';
  7026. CsvLines := TStringList.Create;
  7027. CommaStr := TStringList.Create;
  7028. CommaStr.CommaText := '姓名 手机 电话 电子邮箱 备注';
  7029. CsvLines.Add(CommaStr.CommaText);
  7030. MainForm.RealICQClient.OnGettedAddrBookUsers := GettedAddrBookUsers1;
  7031. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7032. if (ItemIndex < 0) then
  7033. Exit;
  7034. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7035. Branch := RealICQContacterTreeView.GetSelectedBranch;
  7036. if Branch = nil then
  7037. begin
  7038. ShowMessage('请在通讯录中选择组!');
  7039. Exit;
  7040. end;
  7041. if Branch.BranchName = '我的通讯录' then
  7042. begin
  7043. ShowMessage('默认组下面不允许导出联系人!');
  7044. Exit;
  7045. end;
  7046. SD.FileName := Branch.BranchName + '.csv';
  7047. GetChildsGroupId(Branch.BranchID, GroupId);
  7048. MainForm.RealICQClient.ExAddrBookUsers.Clear;
  7049. while Pos(',', GroupId) > 0 do
  7050. begin
  7051. IIndex := Pos(',', GroupId);
  7052. MainForm.RealICQClient.SendGetAddrbookUser(Copy(GroupId, 1, IIndex - 1));
  7053. sleep(200);
  7054. Delete(GroupId, 1, IIndex);
  7055. end;
  7056. MainForm.RealICQClient.SendGetAddrbookUser(GroupId);
  7057. if SD.Execute then
  7058. begin
  7059. CsvLines.SaveToFile(SD.FileName);
  7060. end;
  7061. CsvLines.Free;
  7062. CommaStr.Free;
  7063. end;
  7064. procedure TMainForm.GettedAddrBookUsers1(Sender: TObject);
  7065. var
  7066. iLoop: integer;
  7067. RealICQUser: TRealICQUser;
  7068. BranchInfo: TRealICQBranchInfo;
  7069. begin
  7070. for iLoop := MainForm.RealICQClient.ExAddrBookUsers.Count - 1 downto 0 do
  7071. begin
  7072. RealICQUser := MainForm.RealICQClient.ExAddrBookUsers.Objects[iLoop] as TRealICQUser;
  7073. CommaStr.CommaText := AnsiRePlaceStr(RealICQUser.DisplayName, ' ', '') + ',' + RealICQUser.Mobile + ',' + RealICQUser.Tel + ',' + RealICQUser.Email + ',' + RealICQUser.Remark1;
  7074. CsvLines.Add(CommaStr.CommaText);
  7075. end;
  7076. MainForm.RealICQClient.ExAddrBookUsers.Clear;
  7077. end;
  7078. //-----导入联系人---------------------------------
  7079. procedure TMainForm.spbImportGroupUserClick(Sender: TObject);
  7080. var
  7081. ItemIndex: Integer;
  7082. RealICQContacterTreeView: TRealICQContacterTreeView;
  7083. Branch: TRealICQBranch;
  7084. begin
  7085. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7086. if (ItemIndex < 0) then
  7087. Exit;
  7088. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7089. Branch := RealICQContacterTreeView.GetSelectedBranch;
  7090. if Branch = nil then
  7091. begin
  7092. ShowMessage('请在通讯录中选择组!');
  7093. Exit;
  7094. end;
  7095. if ImportGuideFrom = nil then
  7096. ImportGuideFrom := TImportGuideFrom.Create(self);
  7097. ImportGuideFrom.SelBranch := Branch;
  7098. ImportGuideFrom.Show;
  7099. ForceForeGroundWindow(ImportGuideFrom.Handle);
  7100. end;
  7101. //-------------得到指定通讯录组的所有子节点ID-----------------------------------
  7102. procedure TMainForm.GetChildsGroupId(GroupId: string; var Groups: string);
  7103. var
  7104. iLoop: Integer;
  7105. BranchInfo: TRealICQBranchInfo;
  7106. begin
  7107. if Groups <> '' then
  7108. Groups := Groups + ',';
  7109. Groups := Groups + GroupId;
  7110. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7111. begin
  7112. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7113. if BranchInfo.ParentID = GroupId then
  7114. GetChildsGroupId(BranchInfo.ID, Groups);
  7115. end;
  7116. end;
  7117. procedure TMainForm.miCutClick(Sender: TObject);
  7118. var
  7119. ItemIndex: Integer;
  7120. Employee: TRealICQEmployee;
  7121. Branch: TRealICQBranch;
  7122. RealICQContacterTreeView: TRealICQContacterTreeView;
  7123. begin
  7124. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7125. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7126. if FCutNode <> nil then
  7127. begin
  7128. if FCutNode.StateIndex = 0 then
  7129. begin
  7130. Branch := FCutNode.Data;
  7131. Branch.IsCutState := False;
  7132. Branch.Update;
  7133. end
  7134. else
  7135. begin
  7136. Employee := FCutNode.Data;
  7137. Employee.IsCutState := False;
  7138. Employee.Update;
  7139. end;
  7140. end;
  7141. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7142. if Employee <> nil then
  7143. begin
  7144. Employee.IsCutState := True;
  7145. Employee.Update;
  7146. FCutNode := Employee.Node;
  7147. Exit;
  7148. end;
  7149. Branch := RealICQContacterTreeView.GetSelectedBranch;
  7150. if Branch <> nil then
  7151. begin
  7152. if Branch.BranchName = '我的通讯录' then
  7153. begin
  7154. ShowMessage('默认组不允许剪切!');
  7155. Exit;
  7156. end;
  7157. Branch.IsCutState := True;
  7158. Branch.Update;
  7159. FCutNode := Branch.Node;
  7160. end;
  7161. end;
  7162. //---粘贴-----------------------------------------------------------------------
  7163. procedure TMainForm.miPasteClick(Sender: TObject);
  7164. var
  7165. ItemIndex, EmployeeCount, iLoop: Integer;
  7166. MessageId, ParamValue, LoginName: string;
  7167. Employee, TmpEmployee: TRealICQEmployee;
  7168. SelBranch, TmpBranch, Branch: TRealICQBranch;
  7169. RealICQContacterTreeView: TRealICQContacterTreeView;
  7170. ParentNode: TTreeNode;
  7171. RealICQUser: TRealICQUser;
  7172. begin
  7173. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7174. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7175. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  7176. if Employee <> nil then
  7177. begin
  7178. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(Employee.BranchID);
  7179. SelBranch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7180. end
  7181. else
  7182. SelBranch := RealICQContacterTreeView.GetSelectedBranch;
  7183. if SelBranch = nil then
  7184. Exit;
  7185. if FCutNode.StateIndex = 0 then
  7186. begin
  7187. TmpBranch := FCutNode.Data;
  7188. //判断同一级别是否存在相同的部门
  7189. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  7190. begin
  7191. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  7192. if (Branch.ParentID = SelBranch.BranchID) and (Branch.BranchName = TmpBranch.BranchName) then
  7193. begin
  7194. ShowMessage('已存在名称相同的组!');
  7195. TmpBranch.IsCutState := False;
  7196. TmpBranch.Update;
  7197. FCutNode := nil;
  7198. Exit;
  7199. end;
  7200. end;
  7201. ParentNode := TmpBranch.Node.Parent;
  7202. TmpBranch.Node.MoveTo(SelBranch.Node, naAddChild);
  7203. TmpBranch.ParentID := SelBranch.BranchID;
  7204. TmpBranch.Node.Selected := True;
  7205. TmpBranch.IsCutState := False;
  7206. TmpBranch.Update;
  7207. MessageId := IntToStr(GetTickCount);
  7208. CreateManageGroupMessage(TmpBranch.BranchID, TmpBranch.BranchName, SelBranch.BranchID, MessageId);
  7209. //发送修改组的父级ID
  7210. ParamValue := MessageId + #10 + TmpBranch.BranchName + #10 + TmpBranch.BranchID + #10 + SelBranch.BranchID + #10 + MainForm.RealICQClient.Me.LoginName;
  7211. MainForm.RealICQClient.SendAddrBookCommand(4, 0, ParamValue);
  7212. EmployeeCount := TmpBranch.EmployeeCount;
  7213. while ParentNode <> nil do
  7214. begin
  7215. TmpBranch := ParentNode.Data;
  7216. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount - EmployeeCount;
  7217. TmpBranch.Update;
  7218. ParentNode := TmpBranch.Node.Parent;
  7219. end;
  7220. ParentNode := SelBranch.Node;
  7221. while ParentNode <> nil do
  7222. begin
  7223. TmpBranch := ParentNode.Data;
  7224. TmpBranch.EmployeeCount := TmpBranch.EmployeeCount + EmployeeCount;
  7225. TmpBranch.Update;
  7226. ParentNode := TmpBranch.Node.Parent;
  7227. end;
  7228. end
  7229. else
  7230. begin
  7231. TmpEmployee := FCutNode.Data;
  7232. if GetAddrBookUserIndex(SelBranch.BranchID, TmpEmployee.LoginName) >= 0 then
  7233. begin
  7234. ShowMessage('已存在名称相同的联系人!');
  7235. TmpEmployee.IsCutState := False;
  7236. TmpEmployee.Update;
  7237. FCutNode := nil;
  7238. Exit;
  7239. end;
  7240. MessageId := IntToStr(GetTickCount);
  7241. CreateManageGroupMemberMessage(TmpEmployee.LoginName, TmpEmployee.DisplayName, '', TmpEmployee.Mobile, TmpEmployee.Tel, TmpEmployee.EmailHint, '', SelBranch.BranchID, MessageId);
  7242. //发送修改联系人所属组消息
  7243. LoginName := TmpEmployee.LoginName;
  7244. LoginName := Copy(LoginName, Pos('-', LoginName) + 1, Length(LoginName) - Pos('-', LoginName));
  7245. ParamValue := MessageId + #10 + LoginName + #10 + TmpEmployee.DisplayName + #10 + TmpEmployee.Mobile + #10 + '' + #10 + '' + #10 + TmpEmployee.BranchID + #10 + '' + #10 + SelBranch.BranchId;
  7246. MainForm.RealICQClient.SendAddrBookCommand(5, 1, ParamValue);
  7247. end;
  7248. end;
  7249. //----得到父级的所有组名称---------------------------------------------
  7250. procedure TMainForm.GetParentGroupNameList(BranchInfo: TRealICQBranchInfo; var Groups: string);
  7251. var
  7252. iLoop: Integer;
  7253. TmpBranchInfo: TRealICQBranchInfo;
  7254. begin
  7255. Groups := BranchInfo.BranchName + '\' + Groups;
  7256. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7257. begin
  7258. TmpBranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7259. if BranchInfo.ParentID = TmpBranchInfo.ID then
  7260. GetParentGroupNameList(TmpBranchInfo, Groups);
  7261. end;
  7262. end;
  7263. //----创建管理组消息
  7264. procedure TMainForm.CreateManageGroupMessage(GroupId, GroupName, ParentId, MessageId: string);
  7265. var
  7266. ManageGroupMessage: TManageGroupMessage;
  7267. begin
  7268. ManageGroupMessage := TManageGroupMessage.Create;
  7269. ManageGroupMessage.MessageId := MessageId;
  7270. ManageGroupMessage.FGroupID := GroupId;
  7271. ManageGroupMessage.FGroupName := GroupName;
  7272. ManageGroupMessage.FParentID := ParentId;
  7273. FManageGroupMsgList.AddObject(ManageGroupMessage.MessageId, ManageGroupMessage);
  7274. end;
  7275. //----创建管理联系人消息
  7276. procedure TMainForm.CreateManageGroupMemberMessage(ID, DisplayName, NickName, Mobile, Tel, Email, Remark, GroupId, MessageId: string);
  7277. var
  7278. ManageGroupMemberMessage: TManageGroupMemberMessage;
  7279. begin
  7280. ManageGroupMemberMessage := TManageGroupMemberMessage.Create;
  7281. ManageGroupMemberMessage.MessageId := MessageId;
  7282. ManageGroupMemberMessage.FID := Id;
  7283. ManageGroupMemberMessage.FDisplayName := DisplayName;
  7284. ManageGroupMemberMessage.FNickName := NickName;
  7285. ManageGroupMemberMessage.FMobile := Mobile;
  7286. ManageGroupMemberMessage.FTel := Tel;
  7287. ManageGroupMemberMessage.FEmail := Email;
  7288. ManageGroupMemberMessage.FRemark := Remark;
  7289. ManageGroupMemberMessage.FGroupId := GroupId;
  7290. FManageGroupMemberMsgList.AddObject(ManageGroupMemberMessage.MessageId, ManageGroupMemberMessage);
  7291. end;
  7292. //----------------------------------------------------------
  7293. procedure TMainForm.GettedManageAddrBookResult(Sender: TObject; OperatModal: Integer; OperatCommand: Integer; RetValue, MessageId: Cardinal);
  7294. var
  7295. Branch: TRealICQBranch;
  7296. RealICQBranch: TRealICQBranchInfo;
  7297. RealICQUser, TmpRealICQUser: TRealICQUser;
  7298. TreeViewIndex, ItemIndex, iLoop, i, jLoop: Integer;
  7299. RealICQContacterTreeView: TRealICQContacterTreeView;
  7300. ManageGroupMessage: TManageGroupMessage;
  7301. ManageGroupMemberMsg: TManageGroupMemberMessage;
  7302. TmpList, TmpDelUsers: TStringList;
  7303. Employee, TmpEmployee: TRealICQEmployee;
  7304. ErrMsg, TmpUsers: string;
  7305. begin
  7306. try
  7307. TreeViewIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7308. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[TreeViewIndex] as TRealICQContacterTreeView;
  7309. if RetValue = -1 then
  7310. begin
  7311. case OperatCommand of
  7312. 1:
  7313. ErrMsg := '新建';
  7314. 2:
  7315. ErrMsg := '修改';
  7316. 3:
  7317. ErrMsg := '删除';
  7318. 4:
  7319. ErrMsg := '批量添加';
  7320. end;
  7321. if OperatModal = 0 then
  7322. begin
  7323. if OperatCommand = 4 then
  7324. ErrMsg := '粘贴';
  7325. ErrMsg := ErrMsg + '组失败';
  7326. end
  7327. else
  7328. begin
  7329. ErrMsg := ErrMsg + '联系人失败';
  7330. if OperatCommand = 5 then
  7331. ErrMsg := '粘贴联系人失败';
  7332. if OperatCommand = 6 then
  7333. ErrMsg := '修改联系人备注失败';
  7334. end;
  7335. ShowMessage(ErrMsg);
  7336. Exit;
  7337. end;
  7338. if OperatModal = 0 then //对组操作
  7339. begin
  7340. i := FManageGroupMsgList.IndexOf(IntToStr(MessageId));
  7341. ManageGroupMessage := FManageGroupMsgList.Objects[i] as TManageGroupMessage;
  7342. case OperatCommand of
  7343. 1:
  7344. begin //增加组
  7345. Branch := TRealICQBranch.Create(ManageGroupMessage.FGroupName);
  7346. Branch.BranchID := IntToStr(RetValue);
  7347. Branch.ParentID := ManageGroupMessage.FGroupID;
  7348. RealICQBranch := TRealICQBranchInfo.Create;
  7349. RealICQBranch.ID := IntToStr(RetValue);
  7350. RealICQBranch.ParentID := ManageGroupMessage.FGroupID;
  7351. RealICQBranch.BranchName := ManageGroupMessage.FGroupName;
  7352. RealICQContacterTreeView.AddBranch(Branch);
  7353. MainForm.RealICQClient.AddrBookGroups.AddObject(RealICQBranch.ID, RealICQBranch);
  7354. Branch.Node.Selected := True;
  7355. end;
  7356. 2:
  7357. begin //修改组
  7358. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(ManageGroupMessage.FGroupID);
  7359. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7360. Branch.BranchName := ManageGroupMessage.FGroupName;
  7361. Branch.Update;
  7362. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(ManageGroupMessage.FGroupID);
  7363. RealICQBranch := MainForm.RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7364. RealICQBranch.BranchName := ManageGroupMessage.FGroupName;
  7365. end;
  7366. 3:
  7367. begin //删除组
  7368. try
  7369. TmpList := SplitString(ManageGroupMessage.FGroupID, ',');
  7370. for iLoop := 0 to TmpList.Count - 1 do
  7371. begin
  7372. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(TmpList[iLoop]);
  7373. if ItemIndex >= 0 then
  7374. begin
  7375. MainForm.RealICQClient.AddrBookGroups.Delete(ItemIndex);
  7376. ItemIndex := GetGroupUsers(TmpList[iLoop]);
  7377. while ItemIndex >= 0 do
  7378. begin
  7379. MainForm.RealICQClient.AddrBookUsers.Delete(ItemIndex);
  7380. ItemIndex := GetGroupUsers(TmpList[iLoop]);
  7381. end;
  7382. end;
  7383. end;
  7384. RealICQContacterTreeView.Clear;
  7385. FreeAndNil(RealICQContacterTreeView);
  7386. MainForm.ContacterTreeViews.Delete(TreeViewIndex);
  7387. MainForm.AddContacterTreeView(ScrollBoxAddrBook, LVAddrBook);
  7388. LoadAddrBook(ManageGroupMessage.FParentId);
  7389. TreeViewIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7390. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[TreeViewIndex] as TRealICQContacterTreeView;
  7391. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(ManageGroupMessage.FParentID);
  7392. Branch := RealICQContacterTreeView.BranchItems.Objects[ItemIndex] as TRealICQBranch;
  7393. while Branch.ParentID <> '0' do
  7394. begin
  7395. NodeGroupClick(nil, Branch);
  7396. Branch := Branch.Node.Parent.Data;
  7397. end;
  7398. finally
  7399. if TmpList <> nil then
  7400. TmpList.Free;
  7401. if TmpDelUsers <> nil then
  7402. TmpDelUsers.Free;
  7403. end;
  7404. end;
  7405. 4:
  7406. begin //剪切粘贴
  7407. ItemIndex := MainForm.RealICQClient.AddrBookGroups.IndexOf(ManageGroupMessage.FGroupID);
  7408. RealICQBranch := MainForm.RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7409. RealICQBranch.ParentID := ManageGroupMessage.FParentID;
  7410. end;
  7411. end;
  7412. FManageGroupMsgList.Delete(i);
  7413. end
  7414. else //对联系人操作
  7415. begin
  7416. i := FManageGroupMemberMsgList.IndexOf(IntToStr(MessageId));
  7417. ManageGroupMemberMsg := FManageGroupMemberMsgList.Objects[i] as TManageGroupMemberMessage;
  7418. case OperatCommand of
  7419. 1:
  7420. begin //新增联系人
  7421. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7422. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7423. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + 1;
  7424. //---------------------------------------------
  7425. RealICQUser := TRealICQUser.Create(IntToStr(RetValue), MainForm.RealICQClient);
  7426. RealICQUser.LoginName := IntToStr(RetValue);
  7427. RealICQUser.DisplayName := ManageGroupMemberMsg.FDisplayName;
  7428. RealICQUser.Remark := ManageGroupMemberMsg.FNickName;
  7429. RealICQUser.Mobile := ManageGroupMemberMsg.FMobile;
  7430. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7431. RealICQUser.Tel := ManageGroupMemberMsg.FTel;
  7432. RealICQUser.Email := ManageGroupMemberMsg.FEmail;
  7433. RealICQUser.Remark1 := ManageGroupMemberMsg.FRemark;
  7434. MainForm.RealICQClient.AddrBookUsers.AddObject(RealICQUser.LoginName, RealICQUser);
  7435. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7436. Employee.BranchID := RealICQUser.BranchID;
  7437. Employee.DisplayName := RealICQUser.DisplayName;
  7438. Employee.Mobile := RealICQUser.Mobile;
  7439. Employee.HasSMS := (Length(RealICQUser.Mobile) > 0);
  7440. Employee.SMSHint := RealICQUser.Mobile;
  7441. Employee.HasEmail := False;
  7442. Employee.HasAddFriend := False;
  7443. RealICQContacterTreeView.AddEmployee(Employee);
  7444. Employee.Node.Selected := True;
  7445. end;
  7446. 2:
  7447. begin //修改联系人
  7448. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7449. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7450. Employee.DisplayName := ManageGroupMemberMsg.FDisplayName;
  7451. Employee.Mobile := ManageGroupMemberMsg.FMobile;
  7452. Employee.SMSHint := ManageGroupMemberMsg.FMobile;
  7453. Employee.HasSMS := (Length(ManageGroupMemberMsg.FMobile) > 0);
  7454. Employee.Update;
  7455. end;
  7456. 3:
  7457. begin //删除联系人
  7458. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7459. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7460. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount - 1;
  7461. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7462. if ItemIndex >= 0 then
  7463. begin
  7464. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7465. RealICQUser := GetAddrBookUser(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7466. RealICQClient.AddrBookUsers.Delete(RealICQClient.AddrBookUsers.IndexOfObject(RealICQUser));
  7467. end;
  7468. end;
  7469. 4:
  7470. begin //批量添加联系人
  7471. TmpList := SplitString(ManageGroupMemberMsg.FId, ',');
  7472. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7473. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7474. RealICQBranch.IsGetUserList := True;
  7475. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + TmpList.Count;
  7476. for iLoop := 0 to TmpList.Count - 1 do
  7477. begin
  7478. if GetAddrBookUser(ManageGroupMemberMsg.FGroupId, TmpList[iLoop]) = nil then
  7479. begin
  7480. ItemIndex := MainForm.RealICQClient.MoreUsers.IndexOf(TmpList[iLoop]);
  7481. if ItemIndex >= 0 then
  7482. RealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser
  7483. else
  7484. begin
  7485. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(TmpList[iLoop]);
  7486. end;
  7487. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7488. Employee.BranchID := ManageGroupMemberMsg.FGroupId;
  7489. Employee.DisplayName := RealICQUser.DisplayName;
  7490. Employee.Mobile := RealICQUser.Mobile;
  7491. Employee.HasSMS := (Length(RealICQUser.Mobile) > 0);
  7492. Employee.EmailHint := RealICQUser.Email;
  7493. Employee.SMSHint := RealICQUser.Mobile;
  7494. Employee.HasEmail := False;
  7495. Employee.HasAddFriend := False;
  7496. RealICQContacterTreeView.AddEmployee(Employee);
  7497. Employee.Node.Selected := True;
  7498. end;
  7499. end;
  7500. for iLoop := TmpList.Count - 1 downto 0 do
  7501. begin
  7502. ItemIndex := MainForm.RealICQClient.MoreUsers.IndexOf(TmpList[iLoop]);
  7503. if ItemIndex >= 0 then
  7504. RealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser
  7505. else
  7506. begin
  7507. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(TmpList[iLoop]);
  7508. end;
  7509. TmpRealICQUser := MainForm.RealICQClient.MoreUsers.Objects[ItemIndex] as TRealICQUser;
  7510. RealICQUser := TRealICQUser.Create(TmpList[iLoop], RealICQClient);
  7511. RealICQUser.LoginName := TmpRealICQUser.LoginName;
  7512. RealICQUser.DisplayName := TmpRealICQUser.DisplayName;
  7513. RealICQUser.Mobile := TmpRealICQUser.Mobile;
  7514. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7515. RealICQUser.Tel := TmpRealICQUser.Tel;
  7516. //RealICQUser.Email:=RealICQUser.EmailHint;
  7517. MainForm.RealICQClient.AddrBookUsers.AddObject(RealICQUser.LoginName, RealICQUser);
  7518. end;
  7519. end;
  7520. 5:
  7521. begin
  7522. TmpEmployee := FCutNode.Data;
  7523. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(ManageGroupMemberMsg.FGroupId);
  7524. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7525. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount + 1;
  7526. ItemIndex := RealICQClient.AddrBookGroups.IndexOf(TmpEmployee.BranchID);
  7527. RealICQBranch := RealICQClient.AddrBookGroups.Objects[ItemIndex] as TRealICQBranchInfo;
  7528. RealICQBranch.EmployeeCount := RealICQBranch.EmployeeCount - 1;
  7529. ItemIndex := GetAddrBookUserIndex(TmpEmployee.BranchID, TmpEmployee.LoginName);
  7530. Employee := TRealICQEmployee.Create(TmpEmployee.LoginName);
  7531. Employee.BranchID := ManageGroupMemberMsg.FGroupId;
  7532. Employee.DisplayName := TmpEmployee.DisplayName;
  7533. Employee.Tel := TmpEmployee.Tel;
  7534. Employee.Mobile := TmpEmployee.Mobile;
  7535. RealICQContacterTreeView.AddEmployee(Employee);
  7536. RealICQUser := GetAddrBookUser(TmpEmployee.BranchID, TmpEmployee.LoginName);
  7537. RealICQUser.BranchID := ManageGroupMemberMsg.FGroupId;
  7538. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7539. Employee.Node.Selected := True;
  7540. end;
  7541. 6:
  7542. begin
  7543. ItemIndex := GetAddrBookUserIndex(ManageGroupMemberMsg.FGroupId, ManageGroupMemberMsg.FId);
  7544. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7545. if Employee <> nil then
  7546. begin
  7547. Employee.DisplayName := ManageGroupMemberMsg.FRemark;
  7548. Employee.Update;
  7549. end;
  7550. end;
  7551. end;
  7552. FManageGroupMemberMsgList.Delete(i);
  7553. end;
  7554. finally
  7555. if FCutNode <> nil then
  7556. FCutNode := nil;
  7557. end;
  7558. end;
  7559. //------得到联系人-----------------------------
  7560. function TMainForm.GetAddrBookUser(GroupId, LoginName: string): TRealICQUser;
  7561. var
  7562. iLoop: Integer;
  7563. RealICQUser: TRealICQUser;
  7564. begin
  7565. Result := nil;
  7566. for iLoop := 0 to MainForm.RealICQClient.AddrBookUsers.Count - 1 do
  7567. begin
  7568. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7569. if (RealICQUser.BranchID = GroupId) and (RealICQUser.LoginName = LoginName) then
  7570. begin
  7571. Result := RealICQUser;
  7572. Break;
  7573. end;
  7574. end;
  7575. end;
  7576. //------得到联系人的下标------------------------------
  7577. function TMainForm.GetAddrBookUserIndex(GroupId, LoginName: string): Integer;
  7578. var
  7579. iLoop: Integer;
  7580. Employee: TRealICQEmployee;
  7581. RealICQContacterTreeView: TRealICQContacterTreeView;
  7582. begin
  7583. Result := -1;
  7584. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[MainForm.ContacterTreeViews.IndexOf(LVAddrBook)] as TRealICQContacterTreeView;
  7585. for iLoop := 0 to RealICQContacterTreeView.EmployeeItems.Count - 1 do
  7586. begin
  7587. Employee := RealICQContacterTreeView.EmployeeItems.Objects[iLoop] as TRealICQEmployee;
  7588. if (Employee.BranchID = GroupId) and (Employee.LoginName = LoginName) then
  7589. begin
  7590. Result := iLoop;
  7591. break;
  7592. end;
  7593. end;
  7594. end;
  7595. //-----得到联系人总的人数------------------
  7596. function TMainForm.GetGroupUserCount: Integer;
  7597. var
  7598. iLoop, ItemIndex: Integer;
  7599. TmpBranch: TRealICQBranch;
  7600. RealICQContacterTreeView: TRealICQContacterTreeView;
  7601. begin
  7602. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7603. if ItemIndex < 0 then
  7604. Exit;
  7605. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7606. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  7607. begin
  7608. TmpBranch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  7609. if TmpBranch.ParentID = '0' then
  7610. begin
  7611. Result := TmpBranch.EmployeeCount;
  7612. break;
  7613. end;
  7614. end;
  7615. end;
  7616. //---------------------------显示联系人------------------------------
  7617. procedure TMainForm.GettedAddrBookUsers(Sender: TObject);
  7618. var
  7619. iLoop, ItemIndex: Integer;
  7620. RealICQContacterTreeView: TRealICQContacterTreeView;
  7621. RealICQUser: TRealICQUser;
  7622. TmpBranch: TRealICQBranch;
  7623. Employee: TRealICQEmployee;
  7624. ParentNode: TTreeNode;
  7625. BranchInfo: TRealICQBranchInfo;
  7626. begin
  7627. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7628. if ItemIndex < 0 then
  7629. Exit;
  7630. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7631. RealICQContacterTreeView.AdjustPosition := False;
  7632. RealICQContacterTreeView.HideSystemScrollBar;
  7633. RealICQContacterTreeView.BeginUpdate;
  7634. TmpBranch := nil;
  7635. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载联系人');
  7636. if ItemIndex >= 0 then
  7637. begin
  7638. Employee := RealICQContacterTreeView.EmployeeItems.Objects[ItemIndex] as TRealICQEmployee;
  7639. TmpBranch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(Employee.BranchID)] as TRealICQBranch;
  7640. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  7641. BranchInfo := RealICQClient.AddrBookGroups.Objects[RealICQClient.AddrBookGroups.IndexOf(TmpBranch.BranchID)] as TRealICQBranchInfo;
  7642. BranchInfo.IsGetUserList := True;
  7643. end;
  7644. {$region '添加联系人'}
  7645. for iLoop := MainForm.RealICQClient.AddrBookUsers.Count - 1 downto 0 do
  7646. begin
  7647. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7648. if GetAddrBookUserIndex(RealICQUser.BranchID, RealICQUser.LoginName) >= 0 then
  7649. Continue;
  7650. if RealICQUser.BranchID <> TmpBranch.BranchID then
  7651. Continue;
  7652. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  7653. Employee.BranchID := RealICQUser.BranchID;
  7654. Employee.Mobile := RealICQUser.Mobile;
  7655. Employee.HasSMS := Length(RealICQUser.Mobile) > 0;
  7656. Employee.SMSHint := RealICQUser.Mobile;
  7657. Employee.HasEmail := False;
  7658. if Trim(RealICQUser.Remark) <> '' then
  7659. Employee.DisplayName := RealICQUser.Remark
  7660. else
  7661. Employee.DisplayName := RealICQUser.DisplayName;
  7662. Employee.HasAddFriend := False;
  7663. RealICQContacterTreeView.AddEmployee(Employee);
  7664. end;
  7665. {$endregion}
  7666. if TmpBranch <> nil then
  7667. begin
  7668. ParentNode := TmpBranch.Node;
  7669. while ParentNode <> nil do
  7670. begin
  7671. ParentNode.Expanded := True;
  7672. ParentNode := ParentNode.Parent;
  7673. end;
  7674. TmpBranch.Node.Selected := True;
  7675. TmpBranch.IsGetUserList := True;
  7676. end;
  7677. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  7678. RealICQContacterTreeView.MoveScrollBarToTop;
  7679. RealICQContacterTreeView.EndUpdate;
  7680. end;
  7681. //----------显示组-------------------------
  7682. procedure TMainForm.GettedAddrBookGroups(Sender: TObject);
  7683. begin
  7684. LoadAddrBook('0');
  7685. end;
  7686. //-------------------------------------------------------------------------
  7687. procedure TMainForm.LoadAddrBook(ExpandGroupId: string);
  7688. var
  7689. iLoop, ItemIndex: Integer;
  7690. RealICQContacterTreeView: TRealICQContacterTreeView;
  7691. RealICQUser: TRealICQUser;
  7692. BranchInfo: TRealICQBranchInfo;
  7693. Branch, TmpBranch: TRealICQBranch;
  7694. Employee: TRealICQEmployee;
  7695. ParentNode: TTreeNode;
  7696. BranchId: string;
  7697. OnlineEmployee, EmployeeCount: Integer;
  7698. begin
  7699. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  7700. if ItemIndex < 0 then
  7701. Exit;
  7702. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7703. RealICQContacterTreeView.OnItemOnline := nil;
  7704. RealICQContacterTreeView.OnItemOffline := nil;
  7705. RealICQContacterTreeView.OnItemIconButtonClick := nil;
  7706. RealICQContacterTreeView.OnItemMouseEnter := nil;
  7707. RealICQContacterTreeView.OnItemMouseLeave := nil;
  7708. RealICQContacterTreeView.ShowOnlineNumber := False;
  7709. RealICQContacterTreeView.ShowLoginState := False;
  7710. RealICQContacterTreeView.PopupMenu := ppAddrbookList;
  7711. RealICQContacterTreeView.AdjustPosition := False;
  7712. RealICQContacterTreeView.HideSystemScrollBar;
  7713. RealICQContacterTreeView.BeginUpdate;
  7714. TmpBranch := nil;
  7715. {$region '添加组'}
  7716. for iLoop := 0 to MainForm.RealICQClient.AddrBookGroups.Count - 1 do
  7717. begin
  7718. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[iLoop] as TRealICQBranchInfo;
  7719. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  7720. Continue;
  7721. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  7722. Branch.BranchID := BranchInfo.ID;
  7723. Branch.ParentID := BranchInfo.ParentID;
  7724. Branch.IsGetUserList := False;
  7725. OnlineEmployee := 0;
  7726. EmployeeCount := 0;
  7727. GetBranchEmpOnlineAndSum(RealICQClient.AddrBookGroups, BranchInfo, OnlineEmployee, EmployeeCount);
  7728. Branch.EmployeeCount := EmployeeCount;
  7729. Branch.OnlineEmployee := 0;
  7730. RealICQContacterTreeView.AddBranch(Branch);
  7731. if ExpandGroupId = '0' then
  7732. begin
  7733. BranchId := Branch.ParentID;
  7734. end
  7735. else
  7736. BranchId := Branch.BranchID;
  7737. if BranchId = ExpandGroupId then
  7738. begin
  7739. TmpBranch := Branch;
  7740. end;
  7741. end;
  7742. RealICQContacterTreeView.ReAlignBranchs;
  7743. {$endregion}
  7744. if TmpBranch <> nil then
  7745. begin
  7746. ParentNode := TmpBranch.Node;
  7747. while ParentNode <> nil do
  7748. begin
  7749. ParentNode.Expanded := True;
  7750. ParentNode := ParentNode.Parent;
  7751. end;
  7752. TmpBranch.Node.Selected := True;
  7753. end;
  7754. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  7755. RealICQContacterTreeView.MoveScrollBarToTop;
  7756. RealICQContacterTreeView.EndUpdate;
  7757. ScrollBoxAddrBook.Visible := True;
  7758. end;
  7759. //----------------------------------------------
  7760. procedure TMainForm.NodeGroupClick(Sender: TObject; Group: TRealICQBranch);
  7761. var
  7762. RealICQContacterTreeView: TRealICQContacterTreeView;
  7763. ItemIndex: Integer;
  7764. Employee: TRealICQEmployee;
  7765. BranchInfo: TRealICQBranchInfo;
  7766. begin
  7767. //-------获取指定部门下的用户------------------------------------------------
  7768. if (not Group.IsGetUserList) and (Group.Node.Parent <> nil) then
  7769. begin
  7770. MainForm.RealICQClient.OnGettedAddrBookUsers := GettedAddrBookUsers;
  7771. ItemIndex := FContacterTreeViews.IndexOf(LVAddrBook);
  7772. if ItemIndex < 0 then
  7773. exit;
  7774. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  7775. if RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载联系人') < 0 then
  7776. begin
  7777. RealICQContacterTreeView.ReCalculateEmployeeCount(Group);
  7778. BranchInfo := MainForm.RealICQClient.AddrBookGroups.Objects[MainForm.RealICQClient.AddrBookGroups.IndexOf(Group.BranchID)] as TRealICQBranchInfo;
  7779. Employee := TRealICQEmployee.Create('正在下载联系人');
  7780. Employee.BranchID := Group.BranchID;
  7781. RealICQContacterTreeView.AddEmployee(Employee);
  7782. if (BranchInfo.IsGetUserList) then
  7783. begin
  7784. GettedAddrBookUsers(nil);
  7785. end
  7786. else
  7787. begin
  7788. MainForm.RealICQClient.SendGetAddrbookUser(Group.BranchID);
  7789. end;
  7790. end;
  7791. Group.Node.Expanded := True;
  7792. end;
  7793. end;
  7794. //---------------------------------------------------------------------------
  7795. function TMainForm.GetGroupUsers(GroupId: string): Integer;
  7796. var
  7797. iLoop: Integer;
  7798. RealICQUser: TRealICQUser;
  7799. begin
  7800. Result := -1;
  7801. for iLoop := 0 to MainForm.RealICQClient.AddrBookUsers.Count - 1 do
  7802. begin
  7803. RealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[iLoop] as TRealICQUser;
  7804. if RealICQUser.BranchID = GroupId then
  7805. begin
  7806. Result := iLoop;
  7807. end;
  7808. end;
  7809. end;
  7810. {通讯录}
  7811. procedure TMainForm.tsCustomerServiceContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
  7812. begin
  7813. end;
  7814. //------------
  7815. procedure TMainForm.tsNetWorkDiskShow(Sender: TObject);
  7816. begin
  7817. if RealICQClient.NetWorkDiskServerPort <= 0 then
  7818. begin
  7819. lblNDState.Caption := '没有服务器';
  7820. end
  7821. else
  7822. begin
  7823. if (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) then
  7824. begin
  7825. spbNDConnectClick(spbNDConnect);
  7826. end
  7827. else if not AnsiSameText(RealICQNetWorkDiskClient.LoginName, RealICQClient.LoginName) then
  7828. begin
  7829. RealICQNetWorkDiskClient.Logout;
  7830. spbNDConnectClick(spbNDConnect);
  7831. end;
  7832. end;
  7833. end;
  7834. //------------------------------------------------------------------------------
  7835. procedure TMainForm.WebBrowserAddrBookBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7836. begin
  7837. //
  7838. end;
  7839. procedure TMainForm.WebBrowserAddrBookDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  7840. begin
  7841. //
  7842. end;
  7843. procedure TMainForm.WebBrowserForAdvertisementBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7844. begin
  7845. if not AnsiSameText(URL, MainForm.RealICQClient.MainFormAdversement.URL) then
  7846. begin
  7847. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar('"' + string(URL) + '"'), '', SW_SHOWNORMAL);
  7848. Cancel := True;
  7849. end;
  7850. end;
  7851. //------------------------------------------------------------------------------
  7852. procedure TMainForm.WebBrowserForAdvertisementDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  7853. begin
  7854. try
  7855. WebBrowserForAdvertisement.OnDocumentComplete := nil;
  7856. WebBrowserForAdvertisement.OnBeforeNavigate2 := WebBrowserForAdvertisementBeforeNavigate2;
  7857. SetDomStyle(WebBrowserForAdvertisement.Document as IHtmlDocument2);
  7858. except
  7859. end;
  7860. pnlForHideWebBrowser.Visible := False;
  7861. pnlAdvertisement.Top := pnlWebSearch.Top - 1;
  7862. pnlAdvertisement.Height := RealICQClient.MainFormAdversement.Height + 2;
  7863. pnlWebSearch.Top := pnlAdvertisement.Top + pnlAdvertisement.Height + 1;
  7864. ClearMemory;
  7865. end;
  7866. //------------------------------------------------------------------------------
  7867. procedure TMainForm.WebBrowserForContactersBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
  7868. var
  7869. NewUrl: string;
  7870. Args: string;
  7871. ArgList: TStringList;
  7872. AForm: TForm;
  7873. index: Integer;
  7874. begin
  7875. NewUrl := URL;
  7876. if AnsiSameText(Copy(NewUrl, 1, 18), 'OpenTalkingForm://') then
  7877. begin
  7878. Cancel := True;
  7879. Args := Copy(NewUrl, 19, Length(NewUrl) - 19);
  7880. if AnsiSameText(Args, RealICQClient.Me.LoginName) then
  7881. begin
  7882. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  7883. Exit;
  7884. end;
  7885. OpenTalkingForm(Args, True);
  7886. Exit;
  7887. end;
  7888. if AnsiSameText(Copy(NewUrl, 1, 12), 'AddFriend://') then
  7889. begin
  7890. Cancel := True;
  7891. Args := Copy(NewUrl, 13, Length(NewUrl) - 13);
  7892. if AnsiSameText(Args, RealICQClient.Me.LoginName) then
  7893. begin
  7894. MessageBox(Handle, '对不起,不可以加自己为好友!', '提示', MB_ICONINFORMATION);
  7895. Exit;
  7896. end;
  7897. if TUsersService.GetUsersService.IsWorkmateOrFriend(Args) then
  7898. begin
  7899. MessageBox(Handle, PChar('用户 ' + Args + ' 已在您的好友列表中!'), '提示', MB_ICONINFORMATION);
  7900. Exit;
  7901. end;
  7902. ShowAddFriendWindow(Self, Args, '');
  7903. Exit;
  7904. end;
  7905. end;
  7906. //------------------------------------------------------------------------------
  7907. procedure TMainForm.ppLanguagesGetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
  7908. begin
  7909. ChangePPMenuColorMap(ppLanguages.PopupMenu);
  7910. end;
  7911. //------------------------------------------------------------------------------
  7912. procedure TMainForm.miLanguageClick(Sender: TObject);
  7913. var
  7914. MenuItem: TMenuItem;
  7915. begin
  7916. MenuItem := Sender as TMenuItem;
  7917. ChangeLanguage(ExtractFilePath(Application.ExeName) + 'Languages\' + AnsiReplaceStr(MenuItem.Caption, '&', '') + '.ini');
  7918. end;
  7919. procedure TMainForm.miLeaveClick(Sender: TObject);
  7920. begin
  7921. FLoginState := stLeave;
  7922. FLeaveMessage := '离开';
  7923. SetLoginStateControlState;
  7924. end;
  7925. procedure TMainForm.ppLanguagesPopup(Sender: TObject);
  7926. var
  7927. MenuItem: TMenuItem;
  7928. procedure FindLanguages(APath: string);
  7929. var
  7930. DSearchRec: TSearchRec;
  7931. FindResult: Integer;
  7932. begin
  7933. ppLanguages.Items.Clear;
  7934. FindResult := FindFirst(APath + '*.ini', faAnyFile, DSearchRec);
  7935. while FindResult = 0 do
  7936. begin
  7937. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  7938. if (DSearchRec.Attr and faDirectory) <> faDirectory then
  7939. begin
  7940. MenuItem := TMenuItem.Create(ppLanguages);
  7941. MenuItem.AutoHotkeys := maManual;
  7942. MenuItem.AutoLineReduction := maManual;
  7943. MenuItem.Caption := AnsiReplaceText(DSearchRec.Name, '.ini', '') + '&';
  7944. MenuItem.OnClick := miLanguageClick;
  7945. MenuItem.RadioItem := True;
  7946. MenuItem.AutoCheck := True;
  7947. MenuItem.Enabled := Language <> AnsiReplaceText(DSearchRec.Name, '.ini', '');
  7948. MenuItem.Checked := Language = AnsiReplaceText(DSearchRec.Name, '.ini', '');
  7949. ppLanguages.Items.Insert(0, MenuItem);
  7950. end;
  7951. FindResult := FindNext(DSearchRec);
  7952. end;
  7953. end;
  7954. begin
  7955. FindLanguages(ExtractFilePath(Application.ExeName) + 'Languages\');
  7956. end;
  7957. //------------------------------------------------------------------------------
  7958. procedure TMainForm.Post(stURL, stPostData: string; var wbWebBrowser: TWebBrowser);
  7959. var
  7960. vWebAddr, vPostData, vFlags, vFrame, vHeaders: OleVariant;
  7961. iLoop: Integer;
  7962. begin
  7963. {Are we posting data to this Url?}
  7964. if Length(stPostData) > 0 then
  7965. begin
  7966. {头信息当PostData使.}
  7967. vHeaders := 'Content-Type: application/x-www-form-urlencoded' + #10#13#0;
  7968. vPostData := VarArrayCreate([0, Length(stPostData)], varByte);
  7969. for iLoop := 0 to Length(stPostData) - 1 do
  7970. begin
  7971. vPostData[iLoop] := Ord(stPostData[iLoop + 1]);
  7972. end;
  7973. {结束字符}
  7974. vPostData[Length(stPostData)] := 0;
  7975. {Set the type of Variant, cast}
  7976. TVarData(vPostData).vType := varArray;
  7977. end;
  7978. vWebAddr := stURL;
  7979. wbWebBrowser.Navigate2(vWebAddr, vFlags, vFrame, vPostData, vHeaders);
  7980. end;
  7981. //------------------------------------------------------------------------------
  7982. procedure TMainForm.ChangeLanguage(ALanguageIniFile: string);
  7983. var
  7984. IniFile: TIniFile;
  7985. iLoop: Integer;
  7986. OldLVAddrbook, OldLVSystemMessage, OldLVMyContacters, OldLVMoreUsers, OldLVFriends, OldLVStrangers, OldLVBlacklists, OldLVLatests, OldLVTeams, OldLVSearch: string;
  7987. begin
  7988. inherited ChangeLanguage(ALanguageIniFile);
  7989. RealICQClient.ChangeLanguage(ALanguageIniFile);
  7990. IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Languages\' + Language + '.ini');
  7991. try
  7992. {$region}
  7993. with IniFile do
  7994. begin
  7995. OldLVSystemMessage := LVSystemMessage;
  7996. OldLVMyContacters := LVMyContacters;
  7997. OldLVFriends := LVFriends;
  7998. OldLVStrangers := LVStrangers;
  7999. OldLVBlacklists := LVBlacklists;
  8000. OldLVLatests := LVLatests;
  8001. OldLVTeams := LVTeams;
  8002. OldLVSearch := LVSearch;
  8003. OldLVMoreUsers := LVMoreUsers;
  8004. OldLVAddrbook := LvAddrbook;
  8005. LVSystemMessage := FilterStr(ReadString(string(Self.ClassName), 'LVSystemMessage', ''));
  8006. LVMyContacters := FilterStr(ReadString(string(Self.ClassName), 'LVMyContacters', ''));
  8007. LVMoreUsers := FilterStr(ReadString(string(Self.ClassName), 'LVMoreUser', ''));
  8008. LVFriends := FilterStr(ReadString(string(Self.ClassName), 'LVFriends', ''));
  8009. LVStrangers := FilterStr(ReadString(string(Self.ClassName), 'LVStrangers', ''));
  8010. LVBlacklists := FilterStr(ReadString(string(Self.ClassName), 'LVBlacklists', ''));
  8011. LVLatests := FilterStr(ReadString(string(Self.ClassName), 'LVLatests', ''));
  8012. LVTeams := FilterStr(ReadString(string(Self.ClassName), 'LVTeams', ''));
  8013. LVSearch := FilterStr(ReadString(string(Self.ClassName), 'LVSearch', ''));
  8014. LVAddrbook := FilterStr(ReadString(string(Self.ClassName), 'LVAddrbook', ''));
  8015. end;
  8016. {$endregion}
  8017. finally
  8018. FreeAndNil(IniFile);
  8019. end;
  8020. edWebSearchKeyWordExit(nil);
  8021. for iLoop := 0 to FContacterListViews.Count - 1 do
  8022. begin
  8023. if AnsiSameStr(OldLVSystemMessage, FContacterListViews.Strings[iLoop]) then
  8024. FContacterListViews.Strings[iLoop] := LVSystemMessage;
  8025. if AnsiSameStr(OldLVMyContacters, FContacterListViews.Strings[iLoop]) then
  8026. FContacterListViews.Strings[iLoop] := LVMyContacters;
  8027. if AnsiSameStr(OldLVFriends, FContacterListViews.Strings[iLoop]) then
  8028. FContacterListViews.Strings[iLoop] := LVFriends;
  8029. if AnsiSameStr(OldLVStrangers, FContacterListViews.Strings[iLoop]) then
  8030. FContacterListViews.Strings[iLoop] := LVStrangers;
  8031. if AnsiSameStr(OldLVAddrbook, FContacterListViews.Strings[iLoop]) then
  8032. FContacterListViews.Strings[iLoop] := LVAddrbook;
  8033. //if AnsiSameStr(OldLVBlacklists, FContacterListViews.Strings[iLoop]) then
  8034. // FContacterListViews.Strings[iLoop] := LVBlacklists;
  8035. if AnsiSameStr(OldLVLatests, FContacterListViews.Strings[iLoop]) then
  8036. FContacterListViews.Strings[iLoop] := LVLatests;
  8037. if AnsiSameStr(OldLVTeams, FContacterListViews.Strings[iLoop]) then
  8038. FContacterListViews.Strings[iLoop] := LVTeams;
  8039. if AnsiSameStr(OldLVSearch, FContacterListViews.Strings[iLoop]) then
  8040. FContacterListViews.Strings[iLoop] := LVSearch;
  8041. end;
  8042. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  8043. begin
  8044. if AnsiSameStr(OldLVMyContacters, FContacterTreeViews.Strings[iLoop]) then
  8045. FContacterTreeViews.Strings[iLoop] := LVMyContacters;
  8046. if AnsiSameStr(OldLVFriends, FContacterTreeViews.Strings[iLoop]) then
  8047. FContacterTreeViews.Strings[iLoop] := LVFriends;
  8048. if AnsiSameStr(OldLVMoreUsers, FContacterTreeViews.Strings[iLoop]) then
  8049. FContacterTreeViews.Strings[iLoop] := LVMoreUsers;
  8050. if AnsiSameStr(OldLVAddrbook, FContacterTreeViews.Strings[iLoop]) then
  8051. FContacterTreeViews.Strings[iLoop] := LVAddrbook;
  8052. end;
  8053. if (RealICQClient.Logined and RealICQClient.Connected and pnlWorkArea.Visible) then
  8054. begin
  8055. ShowGroupInterface;
  8056. end;
  8057. edFilterKeyword.Text := '';
  8058. edFilterKeywordExit(edFilterKeyword);
  8059. SetUIState;
  8060. end;
  8061. //------------------------------------------------------------------------------
  8062. procedure TMainForm.SetLoginControlsVisible(Value: Boolean);
  8063. begin
  8064. lblLoginNameTitle.Visible := Value;
  8065. spLoginNameBorder.Visible := Value;
  8066. spbChangeLoginName.Visible := Value;
  8067. edLoginName.Visible := Value;
  8068. lblPasswordTitle.Visible := Value;
  8069. spPasswordBorder.Visible := Value;
  8070. edPassword.Visible := Value;
  8071. lblLoginStateTitle.Visible := Value;
  8072. spbLoginState.Visible := Value;
  8073. spbSavePassword.Visible := Value;
  8074. spbAutoLogin.Visible := Value;
  8075. //btnCALogin.Visible := RealICQClient.CaEnable and Value;
  8076. btLogin.Visible := Value;
  8077. lblRemoveMyLoginInfo.Visible := Value and RealICQClient.SavedPassword;
  8078. lblPasswordTitle.Enabled := not lblRemoveMyLoginInfo.Visible;
  8079. edPassword.Enabled := not lblRemoveMyLoginInfo.Visible;
  8080. //lblForgotPassword.Visible := Value;
  8081. lblNetworkConfig.Visible := Value;
  8082. //lblHelper.Visible := Value;
  8083. //lblNetworkConfig.Top:=Height-100;
  8084. //lblHelper.Top:=Height-80;
  8085. //lblRegister.Visible := Value;
  8086. end;
  8087. //------------------------------------------------------------------------------
  8088. procedure TMainForm.RealICQClientDisconnected(Sender: TObject);
  8089. begin
  8090. ScrollBoxMoreUser.Tag := 0;
  8091. try
  8092. if FSearchListViewInVisible then
  8093. spbCancelFilterClick(nil);
  8094. //ToDo
  8095. if pnlMiddleRight.Visible then
  8096. ShowOrHideMuiltiWeb;
  8097. if Assigned(AGuideViewForm) then
  8098. FreeAndNil(AGuideViewForm);
  8099. finally
  8100. lblLoginState.Caption := '正在注销...';
  8101. SetLoginControlsVisible(False);
  8102. pnlWorkArea.Visible := False;
  8103. pnlLogout.Visible := True;
  8104. //WebBrowserForEMail.Navigate('http://mail.lishui.gov.cn/web_email/modules/i_logout.phtml');
  8105. TimerForCheckLogoutTimeout.Enabled := True;
  8106. TimerForGetBranchOnlineStates.Enabled := False;
  8107. pnlForTopMessage.Visible := False;
  8108. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  8109. { TODO -olqq -c : 退出时,重置Log的登录名 2014/12/14 10:59:28 }
  8110. LoggerImport.LoginName := '';
  8111. TTeamsAdapter.Stop;
  8112. TMessagesHander.GetHander.Uninstall;
  8113. TMainFormController.GetController.LogoutFromAppCentre;
  8114. FDBHistory.DBFileName := '';
  8115. end;
  8116. end;
  8117. //------------------------------------------------------------------------------
  8118. procedure TMainForm.SetUIState;
  8119. var
  8120. iLoop: Integer;
  8121. RealICQContacterListView: TRealICQContacterListView;
  8122. RealICQContacterTreeView: TRealICQContacterTreeView;
  8123. RealICQFriendTreeView: TRealICQContacterTreeView;
  8124. GroupMembers: TStringList;
  8125. TabSheet: TTabSheet;
  8126. SystemMessage: TRealICQSystemMessage;
  8127. NotReadMessageObject: TObject;
  8128. MessageList: TList;
  8129. Employee: TRealICQEmployee;
  8130. RealICQUser: TRealICQUser;
  8131. VisibleValue: Boolean;
  8132. iIndex: Integer;
  8133. GroupName, MessageID: string;
  8134. SysMsgInterface: TSysMsgInterface;
  8135. begin
  8136. if OptionsForm <> nil then
  8137. OptionsForm.GetSets;
  8138. {$region '根据状态显示登录界面上的按钮等界面元素的内容和行为'}
  8139. TimerForLogining.Enabled := RealICQClient.Logining;
  8140. if True then
  8141. edLoginName.Text := RealICQClient.InputLoginName;
  8142. if RealICQClient.Logining then
  8143. begin
  8144. actLoginAs.Enabled := False;
  8145. lblLoginState.Caption := '正在登录...';
  8146. lblLoginState.Refresh;
  8147. SetLoginControlsVisible(False);
  8148. btLogin.Enabled := True;
  8149. btLogin.Visible := True;
  8150. btLogin.Caption := '取消(&C)';
  8151. btLogin.Refresh;
  8152. Application.ProcessMessages;
  8153. end
  8154. else if RealICQClient.SavedPassword and (not RealICQClient.Logined) then
  8155. begin
  8156. edPassword.Text := '保存的密码';
  8157. lblPasswordTitle.Enabled := False;
  8158. edPassword.Enabled := False;
  8159. FLoginAsSavePassword := True;
  8160. actLoginAs.Enabled := (not RealICQClient.Logined or not RealICQClient.Connected) and (not RealICQClient.Logining);
  8161. actLoginAs.Caption := '作为 ' + RealICQClient.LoginName + ' 登录(&S)';
  8162. btLogin.Enabled := True;
  8163. btLogin.Visible := True;
  8164. btLogin.Caption := '登录(&S)';
  8165. btLogin.Refresh;
  8166. lblLoginState.Caption := '';
  8167. SetLoginControlsVisible(True);
  8168. end
  8169. else if (not RealICQClient.Logined) then
  8170. begin
  8171. edPassword.Text := '';
  8172. lblPasswordTitle.Enabled := True;
  8173. edPassword.Enabled := True;
  8174. FLoginAsSavePassword := False;
  8175. actLoginAs.Enabled := False;
  8176. actLoginAs.Caption := '作为 ... 登录(&S)';
  8177. btLogin.Enabled := True;
  8178. btLogin.Visible := True;
  8179. btLogin.Caption := '登录(&S)';
  8180. btLogin.Refresh;
  8181. lblLoginState.Caption := '';
  8182. SetLoginControlsVisible(True);
  8183. end;
  8184. {$endregion}
  8185. {$region '设置控件的Enabled属性'}
  8186. actReg.Enabled := (not RealICQClient.Logining) and (not RealICQClient.Reging);
  8187. actOptions.Enabled := (not RealICQClient.Logining) and (not RealICQClient.Reging);
  8188. actConnectSet.Enabled := actOptions.Enabled;
  8189. actLogout.Enabled := (not (not RealICQClient.Logined or not RealICQClient.Connected) and (not RealICQClient.Logining) and (not RealICQClient.Reging)) and RealICQClient.Connected;
  8190. actOpenRecvFileDir.Enabled := actLogout.Enabled;
  8191. btLogin.Default := not actLogout.Enabled;
  8192. actOnline.Enabled := actLogout.Enabled;
  8193. actHidden.Enabled := actLogout.Enabled;
  8194. actOffline.Enabled := actLogout.Enabled;
  8195. actBusy.Enabled := actLogout.Enabled;
  8196. actMute.Enabled := actLogout.Enabled;
  8197. actLeave.Enabled := actLogout.Enabled;
  8198. actPhone.Enabled := actLogout.Enabled;
  8199. actRepast.Enabled := actLogout.Enabled;
  8200. actMeeting.Enabled := actLogout.Enabled;
  8201. actOtherState.Enabled := actLogout.Enabled;
  8202. actOfflieAutoResponse.Enabled := actLogout.Enabled;
  8203. actPersonalSet.Enabled := actLogout.Enabled;
  8204. actChangePass.Enabled := actLogout.Enabled;
  8205. actFindUsers.Enabled := actLogout.Enabled;
  8206. actShowLoginName.Enabled := actLogout.Enabled;
  8207. actShowDisplayName.Enabled := actLogout.Enabled;
  8208. actShowAllName.Enabled := actLogout.Enabled;
  8209. actShowRemark.Enabled := actLogout.Enabled;
  8210. actShowBigHeadImage.Enabled := actLogout.Enabled;
  8211. actShowMiddleHeadImage.Enabled := actLogout.Enabled;
  8212. actShowSmallHeadImage.Enabled := actLogout.Enabled;
  8213. actShowNormalHeadImage.Enabled := actLogout.Enabled;
  8214. actShowGroup.Enabled := actLogout.Enabled;
  8215. actGroupManager.Enabled := actLogout.Enabled;
  8216. actShowStrangers.Enabled := actLogout.Enabled;
  8217. actShowBlacklists.Enabled := actLogout.Enabled;
  8218. actShowTeams.Enabled := actLogout.Enabled;
  8219. actShowLatests.Enabled := actLogout.Enabled;
  8220. actShowGIFInMailForm.Enabled := actLogout.Enabled;
  8221. actShowGIFInTalkingForm.Enabled := actLogout.Enabled;
  8222. actCustomFacesManager.Enabled := actLogout.Enabled;
  8223. actMsgManager.Enabled := actLogout.Enabled;
  8224. actAVSet.Enabled := actLogout.Enabled;
  8225. RealICQNetWorkDiskClientConnectStateChanged(Self.RealICQNetWorkDiskClient);
  8226. SetLoginStateMenuChecked;
  8227. SetStyleMenuChecked;
  8228. {$endregion}
  8229. {$region '设置控件的Visible属性'}
  8230. lblReConnect.Visible := False;
  8231. actLoginAs.Visible := actLoginAs.Enabled;
  8232. if (RealICQClient.WorkingMode = wmCorporation) then
  8233. begin
  8234. actShowBigHeadImage.Visible := False;
  8235. actShowMiddleHeadImage.Visible := False;
  8236. actShowStrangers.Visible := False;
  8237. actShowBlacklists.Visible := False;
  8238. actReg.Visible := False;
  8239. //actFindUsers.Visible := False;
  8240. actShowTree.Visible := False;
  8241. end
  8242. else
  8243. begin
  8244. actShowBigHeadImage.Visible := not actShowTree.Checked;
  8245. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  8246. actShowStrangers.Visible := True;
  8247. actShowBlacklists.Visible := True;
  8248. actReg.Visible := True;
  8249. //actFindUsers.Visible := True;
  8250. actShowTree.Visible := True;
  8251. end;
  8252. VisibleValue := RealICQClient.Logined and RealICQClient.Connected;
  8253. ActionManager.ActionBars.ActionBars[1].Items[1].Visible := VisibleValue;
  8254. ActionManager.ActionBars.ActionBars[1].Items[2].Visible := VisibleValue;
  8255. //spbShowHideRight.Visible := VisibleValue;
  8256. {$endregion}
  8257. {$region '根据登录/连接状态,显示登录界面或联系人界面'}
  8258. if RealICQClient.Logined and RealICQClient.Connected then
  8259. begin
  8260. pnlWorkArea.Visible := True;
  8261. pnlLogout.Visible := False;
  8262. SetAllTakingFormEnabledState(True);
  8263. SetAllSMSFormEnabledState(True);
  8264. if not TLimitCondition.UserInfoCheck(MainForm.RealICQClient.Me) then
  8265. begin
  8266. MainForm.actPersonalSetExecute(nil)
  8267. end
  8268. else if TLimitCondition.FirstLoginComfirm then
  8269. begin
  8270. ShowMessage('请确认或修改您的个人信息!');
  8271. MainForm.actPersonalSetExecute(nil);
  8272. end;
  8273. end
  8274. else
  8275. begin
  8276. pnlWorkArea.Visible := False;
  8277. pnlLogout.Visible := True;
  8278. tsCustomerService.PageControl := nil;
  8279. tsCustomers.PageControl := pgcMainWorkArea;
  8280. RealICQNetWorkDiskClient.Logout;
  8281. if VideoForm <> nil then
  8282. FreeAndNil(VideoForm);
  8283. if CreateTeamForm <> nil then
  8284. FreeAndNil(CreateTeamForm);
  8285. if SearchForm <> nil then
  8286. FreeAndNil(SearchForm);
  8287. if VCardForm <> nil then
  8288. FreeAndNil(VCardForm);
  8289. if SearchTeamForm <> nil then
  8290. FreeAndNil(SearchTeamForm);
  8291. if SelFaceForm <> nil then
  8292. FreeAndNil(SelFaceForm);
  8293. if CustomFacesManagerForm <> nil then
  8294. FreeAndNil(CustomFacesManagerForm);
  8295. if MessagesManagerForm <> nil then
  8296. FreeAndNil(MessagesManagerForm);
  8297. if AddFaceForm <> nil then
  8298. FreeAndNil(AddFaceForm);
  8299. try
  8300. CloseAllTeamOptionsForms;
  8301. except
  8302. end;
  8303. try
  8304. WebBrowserForAdvertisement.OnDocumentComplete := nil;
  8305. WebBrowserForAdvertisement.OnBeforeNavigate2 := nil;
  8306. pnlAdvertisement.Height := 0;
  8307. if WebBrowserForAdvertisement.Busy then
  8308. WebBrowserForAdvertisement.Stop;
  8309. WebBrowserForAdvertisement.Navigate('about:blank');
  8310. except
  8311. end;
  8312. try
  8313. // CloseAllSeeUserInformationForms;
  8314. except
  8315. end;
  8316. try
  8317. CloseAllChangeSystemMessageForms;
  8318. except
  8319. end;
  8320. try
  8321. SetAllTakingFormEnabledState(False);
  8322. SetAllSMSFormEnabledState(False);
  8323. except
  8324. end;
  8325. TimerForFlashTrayIcon.Enabled := False;
  8326. if Assigned(NotReadMessageBoxForm) then
  8327. NotReadMessageBoxForm.Visible := False;
  8328. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  8329. TrayIcon.SetDefaultIcon;
  8330. TrayIcon.Hint := Application.Title + ' - 未登录';
  8331. {$region '删除WEB标签'}
  8332. try
  8333. for iLoop := 0 to FWebTabs.Count - 1 do
  8334. begin
  8335. TabSheet := FWebTabs[iLoop];
  8336. TabSheet.PageControl := nil;
  8337. FreeAndNil(TabSheet);
  8338. end;
  8339. except
  8340. end;
  8341. FWebTabs.Clear;
  8342. {$endregion}
  8343. {$region '删除未处理的系统消息'}
  8344. try
  8345. for iLoop := 0 to FSystemMessages.Count - 1 do
  8346. begin
  8347. SystemMessage := FSystemMessages[iLoop];
  8348. FreeAndNil(SystemMessage);
  8349. end;
  8350. except
  8351. end;
  8352. FSystemMessages.Clear;
  8353. {$endregion}
  8354. {$region '清除还未读的消息'}
  8355. for iLoop := 0 to FNotReadMessages.Count - 1 do
  8356. begin
  8357. MessageID := FNotReadMessages[iLoop];
  8358. if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  8359. begin
  8360. try
  8361. NotReadMessageObject := FNotReadMessages.Objects[iLoop];
  8362. FreeAndNil(NotReadMessageObject);
  8363. except
  8364. end;
  8365. end
  8366. else
  8367. begin
  8368. MessageList := FNotReadMessages.Objects[iLoop] as TList;
  8369. while MessageList.Count > 0 do
  8370. begin
  8371. try
  8372. NotReadMessageObject := TObject(MessageList[0]);
  8373. FreeAndNil(NotReadMessageObject);
  8374. except
  8375. end;
  8376. MessageList.Delete(0);
  8377. end;
  8378. FreeAndNil(MessageList);
  8379. end;
  8380. end;
  8381. FNotReadMessages.Clear;
  8382. {$endregion}
  8383. {try
  8384. for iLoop :=FNotAddedEmployeeList.Count-1 Downto 0 do
  8385. begin
  8386. try
  8387. RealICQUser:= FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  8388. if Assigned(RealICQUser) then FreeAndNil(RealICQUser);
  8389. except
  8390. end;
  8391. end;
  8392. finally
  8393. FNotAddedEmployeeList.Clear;
  8394. end; }
  8395. if FNotAddedEmployeeList.Count > 0 then
  8396. FNotAddedEmployeeList.Clear;
  8397. if Assigned(FLVSystemMessage) then
  8398. FLVSystemMessage.Items.Clear;
  8399. if Assigned(FLVTeams) then
  8400. FLVTeams.Items.Clear;
  8401. if Assigned(FLVCustomers) then
  8402. FLVCustomers.Items.Clear;
  8403. {$region '删除用于显示用户列表对象'}
  8404. for iLoop := FContacterListViews.Count - 1 downto 0 do
  8405. begin
  8406. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  8407. try
  8408. RealICQContacterListView.Items.Clear;
  8409. except
  8410. end;
  8411. GroupName := FContacterListViews[iLoop];
  8412. if AnsiSameText(GroupName, LVFriends) or AnsiSameText(GroupName, LVStrangers) or
  8413. {AnsiSameText(GroupName, LVBlacklists) or}
  8414. (FGroups.IndexOf(GroupName) >= 0) then
  8415. begin
  8416. try
  8417. FreeAndNil(RealICQContacterListView);
  8418. except
  8419. end;
  8420. FContacterListViews.Delete(iLoop);
  8421. end;
  8422. end;
  8423. for iLoop := FContacterTreeViews.Count - 1 downto 0 do
  8424. begin
  8425. try
  8426. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  8427. try
  8428. RealICQContacterTreeView.Clear;
  8429. except
  8430. end;
  8431. finally
  8432. try
  8433. FreeAndNil(RealICQContacterTreeView);
  8434. except
  8435. end;
  8436. FContacterTreeViews.Delete(iLoop);
  8437. end;
  8438. end;
  8439. for iLoop := FContacterTreeViews.Count - 1 downto 0 do
  8440. begin
  8441. try
  8442. RealICQFriendTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  8443. try
  8444. RealICQFriendTreeView.Clear;
  8445. except
  8446. end;
  8447. finally
  8448. try
  8449. FreeAndNil(RealICQFriendTreeView);
  8450. except
  8451. end;
  8452. FContacterTreeViews.Delete(iLoop);
  8453. end;
  8454. end;
  8455. {$endregion}
  8456. for iLoop := 0 to RealICQClient.SysMsgInterfaces.Count - 1 do
  8457. begin
  8458. SysMsgInterface := RealICQClient.SysMsgInterfaces.Objects[iLoop] as TSysMsgInterface;
  8459. FreeAndNil(SysMsgInterface);
  8460. end;
  8461. RealICQClient.SysMsgInterfaces.Clear;
  8462. for iLoop := 0 to FGroups.Count - 1 do
  8463. begin
  8464. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  8465. GroupMembers.Clear;
  8466. GroupMembers.Free;
  8467. end;
  8468. FGroups.Clear;
  8469. end;
  8470. {$endregion}
  8471. PostMessage(Handle, WM_SIZE, 0, 0);
  8472. Application.ProcessMessages;
  8473. if not TrayIcon.Visible then
  8474. begin
  8475. TrayIcon.Visible := True;
  8476. end;
  8477. end;
  8478. //------------------------------------------------------------------------------
  8479. procedure TMainForm.AddMessageHistory(ASystemMessageType: TSystemMessageType; ASimpleMessage: string; ASystemMessage: TRealICQSystemMessage);
  8480. var
  8481. ItemIndex: Integer;
  8482. ListItem: TRealICQContacterListItem;
  8483. ID: string;
  8484. begin
  8485. ID := '';
  8486. case ASystemMessageType of
  8487. smSimple:
  8488. begin
  8489. ID := IntToStr(GetTickCount);
  8490. while FLVSystemMessage.Items.IndexOf(ID) >= 0 do
  8491. begin
  8492. ID := IntToStr(GetTickCount);
  8493. Sleep(10);
  8494. Application.ProcessMessages;
  8495. end;
  8496. end;
  8497. smSystemMessage:
  8498. ID := IntToStr(ASystemMessage.MessageID);
  8499. end;
  8500. FLVSystemMessage.ShowHeadImageButton := False;
  8501. ItemIndex := FLVSystemMessage.Items.Add(ID);
  8502. ListItem := FLVSystemMessage.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  8503. with ListItem do
  8504. begin
  8505. DisplayName := TimeToStr(Now);
  8506. LoginState := stOnline;
  8507. case ASystemMessageType of
  8508. smSimple:
  8509. begin
  8510. Watchword := ASimpleMessage;
  8511. try
  8512. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + SimpleMessagePicture);
  8513. except
  8514. end;
  8515. end;
  8516. smSystemMessage:
  8517. begin
  8518. Watchword := ASystemMessage.Title;
  8519. try
  8520. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  8521. except
  8522. end;
  8523. end;
  8524. end;
  8525. ReDrawItem;
  8526. end;
  8527. FLVSystemMessage.TopIndex := ItemIndex;
  8528. end;
  8529. //------------------------------------------------------------------------------
  8530. constructor TMainForm.Create(AOwner: TComponent);
  8531. begin
  8532. MainForm := Self;
  8533. inherited Create(AOwner);
  8534. end;
  8535. //------------------------------------------------------------------------------
  8536. procedure TMainForm.FormCreate(Sender: TObject);
  8537. function URLDecode(const S: string): string;
  8538. var
  8539. Idx: Integer; // loops thru chars in string
  8540. Hex: string; // string of hex characters
  8541. Code: Integer; // hex character code (-1 on error)
  8542. begin
  8543. // Intialise result and string index
  8544. Result := '';
  8545. Idx := 1;
  8546. // Loop thru string decoding each character
  8547. while Idx <= Length(S) do
  8548. begin
  8549. case S[Idx] of
  8550. '%':
  8551. begin
  8552. // % should be followed by two hex digits - exception otherwise
  8553. if Idx <= Length(S) - 2 then
  8554. begin
  8555. // there are sufficient digits - try to decode hex digits
  8556. Hex := S[Idx + 1] + S[Idx + 2];
  8557. Code := SysUtils.StrToIntDef('$' + Hex, -1);
  8558. Inc(Idx, 2);
  8559. end
  8560. else
  8561. // insufficient digits - error
  8562. Code := -1;
  8563. // check for error and raise exception if found
  8564. if Code = -1 then
  8565. raise SysUtils.EConvertError.Create('Invalid hex digit in URL');
  8566. // decoded OK - add character to result
  8567. Result := Result + Chr(Code);
  8568. end;
  8569. '+':
  8570. // + is decoded as a space
  8571. Result := Result + ' ' else
  8572. // All other characters pass thru unchanged
  8573. Result := Result + S[Idx];
  8574. end;
  8575. Inc(Idx);
  8576. end;
  8577. end;
  8578. function UserIsLogined(user: string): Boolean;
  8579. var
  8580. hWndStart, hwndLike: HWND;
  8581. WndCaption: array[0..254] of char;
  8582. WndClassName: array[0..254] of char;
  8583. ActiveTimes: Integer;
  8584. begin
  8585. Result := False;
  8586. try
  8587. ActiveTimes := 0;
  8588. hWndStart := GetDesktopWindow;
  8589. hwndLike := GetWindow(hWndStart, GW_CHILD);
  8590. while hwndLike <> 0 do
  8591. begin
  8592. GetWindowText(hwndLike, @WndCaption, 254);
  8593. GetClassName(hwndLike, @WndClassName, 254);
  8594. if (pos(user, StrPas(WndCaption)) <> 0) and (pos('TrueHiddenMainForm', StrPas(WndClassName)) <> 0) then
  8595. begin
  8596. Result := True;
  8597. ShowWindow(hwndLike, SW_SHOW);
  8598. ForceForeGroundWindow(hwndLike);
  8599. Inc(ActiveTimes);
  8600. if ActiveTimes >= 2 then
  8601. Break;
  8602. end;
  8603. hwndLike := GetWindow(hwndLike, GW_HWNDNEXT);
  8604. end;
  8605. except
  8606. on E: Exception do
  8607. begin
  8608. Error(E.Message, 'TMainForm.UserIsLogined(' + user + ')');
  8609. end;
  8610. end;
  8611. end;
  8612. var
  8613. iIndex, i: Integer;
  8614. gif: TGIFImage;
  8615. ca: string;
  8616. IdHttp: TIdHTTP;
  8617. ResponeStr: string;
  8618. Sends: TStrings;
  8619. jo, ja: ISuperObject;
  8620. CALoginName, CAPassWord: string;
  8621. icon: TIcon; //cmg
  8622. begin
  8623. try
  8624. FServerInfoList := TStringList.Create;
  8625. TAuthority.SetDropFileAuthority;
  8626. TrayIcon.Visible := False;
  8627. if FileExists(ExtractFilePath(paramstr(0)) + LoginingGif) then
  8628. begin
  8629. gif := TGIFImage.Create;
  8630. try
  8631. gif.LoadFromFile(ExtractFilePath(paramstr(0)) + LoginingGif);
  8632. gif.Animate := True;
  8633. ImgLoadingMoreBranchs.Picture.Assign(gif);
  8634. finally
  8635. gif.Free;
  8636. end;
  8637. end;
  8638. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\0.ico', $ff00ff);
  8639. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\1.ico', $ff00ff);
  8640. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\2.ico', $ff00ff);
  8641. //ImgLstForLogining.FileLoad(rtIcon, ExtractFilePath(paramstr(0)) + 'Images\State\TrayIcon\3.ico', $ff00ff);
  8642. //cmg
  8643. begin
  8644. Icon := Ticon.create;
  8645. try
  8646. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\0.ico');
  8647. i := ImgLstForLogining.addicon(Icon);
  8648. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\1.ico');
  8649. i := ImgLstForLogining.addicon(Icon);
  8650. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\2.ico');
  8651. i := ImgLstForLogining.addicon(Icon);
  8652. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\3.ico');
  8653. i := ImgLstForLogining.addicon(Icon);
  8654. finally
  8655. Icon.Free;
  8656. end;
  8657. end;
  8658. //注册自定义消息
  8659. CLOSEWINDOWS := RegisterWindowMessage('关闭窗口');
  8660. if FileExists(ExtractFilePath(Application.ExeName) + 'Images\Logo.gif') then
  8661. ImgLogo.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\Logo.gif');
  8662. if FileExists(ExtractFilePath(Application.ExeName) + 'Images\AppCode.png') then
  8663. ImgApp.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\AppCode.png');
  8664. LoadMainTabImage;
  8665. //LoadGroupConfig;(群组配置信息转移到CEF)
  8666. //FDownFile := TDownFile.Create;
  8667. //FDownFile.OnComplete := DownFileComplete;
  8668. //调用自动更新程序
  8669. FCheckedUpdate := True;
  8670. try
  8671. RegisterOleFile(ExtractFilePath(Application.ExeName) + IEContext_DLL_PACH, 1);
  8672. except
  8673. on E: Exception do
  8674. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(IEContext.dll)');
  8675. end;
  8676. try
  8677. RegisterOleFile(ExtractFilePath(Application.ExeName) + ImageX2_DLL_PACH, 1);
  8678. except
  8679. on E: Exception do
  8680. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(ImageX2.dll)');
  8681. end;
  8682. try
  8683. RegisterOleFile(ExtractFilePath(Application.ExeName) + AppCentreCom_DLL_PACH, 1);
  8684. except
  8685. on E: Exception do
  8686. Error(E.Message, 'TMainForm.FormCreate-RegisterOleFile(AppCentreCom.dll)');
  8687. end;
  8688. if HookID <> 0 then
  8689. UnHookWindowsHookEx(HookID);
  8690. HookID := SetWindowsHookEx(WH_MOUSE, MouseProc, 0, GetCurrentThreadId());
  8691. MinButtonForClose := True;
  8692. FGettedTrayIconRect := False;
  8693. FMainFormHidden := False;
  8694. FWindowMoveing := False;
  8695. FHidePosition := hpNone;
  8696. SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
  8697. Caption := Application.Title;
  8698. actOpenMainForm.Caption := '打开 ' + Application.Title + ' 主界面(&O)';
  8699. //btShowMiniPage.Visible := TCustomerConfig.GetConfig.ShowGuideViewBtn;
  8700. FIsLogout := False;
  8701. DoubleBuffered := True;
  8702. pnlTop.DoubleBuffered := True;
  8703. pnlClient.DoubleBuffered := True;
  8704. pnlWorkArea.DoubleBuffered := True;
  8705. pnlLogout.DoubleBuffered := True;
  8706. edFilterKeyword.DoubleBuffered := True;
  8707. pnlWebSearch.DoubleBuffered := True;
  8708. pnlWebSearchSplit.DoubleBuffered := True;
  8709. pnlTeams.DoubleBuffered := True;
  8710. pnlAll.DoubleBuffered := True;
  8711. edLoginName.DoubleBuffered := True;
  8712. edPassword.DoubleBuffered := True;
  8713. pnlNDToolBar.DoubleBuffered := True;
  8714. pnlNDStateBar.DoubleBuffered := True;
  8715. pnlNetWorkFiles.DoubleBuffered := True;
  8716. pnlMiddleClient.DoubleBuffered := True;
  8717. pgcMultiWeb.DoubleBuffered := True;
  8718. pnlToolBar.DoubleBuffered := True;
  8719. FHintWindow := TSingleBorderHintWindow.Create(Self);
  8720. FHintWindow.Visible := False;
  8721. FGetUsersTask := TStringList.Create;
  8722. //默认值
  8723. ActiveButtonTag := 1;
  8724. HotKeyID_ReadMessage := 0;
  8725. HotKeyID_CopyScreen := 0;
  8726. FShowGroup := False;
  8727. FFlashCaptionOnOnline := True;
  8728. FLVSelectedItemBorderColor := $00E9CAAD;
  8729. FLVSelectedItemBorderInnerColor := $00F7F7F7;
  8730. FLVSelectedItemBackColor := $00FEE9CE;
  8731. FLVHeadImageBorderColor := $00E9CAAD;
  8732. FLVHeadImageBackColor := clWhite;
  8733. FLVStyle := lsMiddleHeadImage;
  8734. FLVCaptionStyle := csDisplayName;
  8735. FShowTree := False;
  8736. LoadAutoUpdateConfigs;
  8737. LoadDefaultConfigs;
  8738. FFlashTrayIconIndex := 0;
  8739. FFlashTrayIconIndexAtLogining := 0;
  8740. FNotReadMessages := TStringList.Create;
  8741. FGroups := TStringList.Create;
  8742. FWebTabs := TList.Create;
  8743. FFaceList := TStringList.Create;
  8744. FTempFaceList := TStringList.Create;
  8745. FFaceCategory := TStringList.Create;
  8746. FInputFont := TFont.Create;
  8747. FContacterListViews := TStringList.Create;
  8748. FContacterTreeViews := TStringList.Create;
  8749. FContacterTreeViews := TStringList.Create;
  8750. FSystemMessages := TList.Create;
  8751. //TMainFormController.GetController.ChangeStyle;
  8752. try
  8753. FDBHistory := TRealICQDBHistory.Create;
  8754. except
  8755. //ShowMessage('数据库创建失败');
  8756. on E: Exception do
  8757. begin
  8758. ShowMessage('异常类名称:' + E.ClassName + #13#10 + '异常信息:' + E.Message);
  8759. end;
  8760. end;
  8761. FWebPanels := TStringList.Create;
  8762. FOfflineAutoResponseTexts := TStringList.Create;
  8763. FNotAddedEmployeeList := TStringList.Create;
  8764. FSystemNotices := TList.Create;
  8765. FToolBarButtonList := TStringList.Create;
  8766. FToolBarButtonIconList := TStringList.Create;
  8767. FManageGroupMsgList := TStringList.Create;
  8768. FManageGroupMemberMsgList := TStringList.Create;
  8769. FFriendInfo := TStringList.Create;
  8770. FLoginAsSavePassword := False;
  8771. FSavePassword := False;
  8772. FAutoLogin := False;
  8773. FLoginState := stOnline;
  8774. FLeaveMessage := '';
  8775. pnlMiddleClient.Align := alClient;
  8776. pnlMiddleRight.Align := alRight;
  8777. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  8778. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  8779. ChangeLanguage(ExtractFilePath(Application.ExeName) + 'Languages\简体中文.ini');
  8780. {$region '生成显示系统消息的ListView'}
  8781. AddContacterListView(pnlTemp, LVSystemMessage);
  8782. FLVSystemMessage := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8783. FContacterListViews.Delete(0);
  8784. FLVSystemMessage.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessagePicture);
  8785. FLVSystemMessage.Style := lsSmallHeadImage;
  8786. FLVSystemMessage.CaptionStyle := csDisplayName;
  8787. FLVSystemMessage.PopupMenu := nil;
  8788. FLVSystemMessage.OnItemOnline := nil;
  8789. FLVSystemMessage.OnItemOffline := nil;
  8790. FLVSystemMessage.OnItemMouseEnter := nil;
  8791. FLVSystemMessage.OnItemMouseLeave := nil;
  8792. FLVSystemMessage.OnItemIconButtonClick := nil;
  8793. FLVSystemMessage.OnItemIconButtonDblClick := nil;
  8794. FLVSystemMessage.ShowMobileButton := False;
  8795. FLVSystemMessage.ShowTelButton := False;
  8796. FLVSystemMessage.ShowEmailButton := False;
  8797. FLVSystemMessage.ShowSMSButton := False;
  8798. FLVSystemMessage.ShowCameraButton := False;
  8799. FLVSystemMessage.ShowHeadImageButton := False;
  8800. FLVSystemMessage.ShowHint := False;
  8801. FLVSystemMessage.SelectedItemBackgroud.Graphic := nil;
  8802. FLVSystemMessage.HeadImageBorderColor := clWhite;
  8803. FLVSystemMessage.SelectedItemBorderInnerColor := clWhite;
  8804. FLVSystemMessage.SelectedItemBackColor := clWhite;
  8805. {$endregion}
  8806. {$region '生成显示群组列表的ListView'}
  8807. AddContacterListView(ScrollBoxTeam, LVTeams);
  8808. // navForContacters.Groups[3] := LVTeams;
  8809. FLVTeams := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8810. FContacterListViews.Delete(0);
  8811. FLVTeams.AdjustPosition := False;
  8812. FLVTeams.LeavePicture := nil;
  8813. FLVTeams.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  8814. FLVTeams.Style := lsSmallHeadImage;
  8815. FLVTeams.CaptionStyle := csDisplayName;
  8816. FLVTeams.PopupMenu := ppTeamListView;
  8817. FLVTeams.OnItemOnline := nil;
  8818. FLVTeams.OnItemOffline := nil;
  8819. FLVTeams.OnItemMouseEnter := nil;
  8820. FLVTeams.OnItemMouseLeave := nil;
  8821. FLVTeams.OnItemIconButtonClick := nil;
  8822. FLVTeams.OnItemIconButtonDblClick := nil;
  8823. FLVTeams.ShowMobileButton := False;
  8824. FLVTeams.ShowTelButton := False;
  8825. FLVTeams.ShowEmailButton := False;
  8826. FLVTeams.ShowSMSButton := False;
  8827. FLVTeams.ShowCameraButton := False;
  8828. FLVTeams.ShowHeadImageButton := False;
  8829. pnlTeams.Parent := ScrollBoxTeam;
  8830. pnlTeams.Align := alTop;
  8831. pnlTeams.ShowHint := False;
  8832. {$endregion}
  8833. {$region '生成显示网络硬盘文件的ListView'}
  8834. AddContacterListView(pnlNDFiles, '网络硬盘');
  8835. FLVNetWorkDisk := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8836. FLVNetWorkDisk.Align := alClient;
  8837. FContacterListViews.Delete(0);
  8838. FLVNetWorkDisk.LeavePicture := nil;
  8839. FLVNetWorkDisk.SelectedItemBackgroud.Graphic := nil;
  8840. FLVNetWorkDisk.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8841. FLVNetWorkDisk.Style := lsSmallHeadImage;
  8842. FLVNetWorkDisk.CaptionStyle := csDisplayName;
  8843. FLVNetWorkDisk.PopupMenu := ppNetWorkFile;
  8844. FLVNetWorkDisk.HeadImageBorderColor := clWhite;
  8845. FLVNetWorkDisk.SelectedItemBorderInnerColor := clWhite;
  8846. FLVNetWorkDisk.SelectedItemBackColor := clWhite;
  8847. FLVNetWorkDisk.OnItemOnline := nil;
  8848. FLVNetWorkDisk.OnItemOffline := nil;
  8849. FLVNetWorkDisk.OnItemMouseEnter := nil;
  8850. FLVNetWorkDisk.OnItemMouseLeave := nil;
  8851. FLVNetWorkDisk.OnItemIconButtonClick := nil;
  8852. FLVNetWorkDisk.OnItemIconButtonDblClick := nil;
  8853. FLVNetWorkDisk.ShowMobileButton := False;
  8854. FLVNetWorkDisk.ShowTelButton := False;
  8855. FLVNetWorkDisk.ShowEmailButton := False;
  8856. FLVNetWorkDisk.ShowSMSButton := False;
  8857. FLVNetWorkDisk.ShowCameraButton := False;
  8858. FLVNetWorkDisk.ShowHeadImageButton := False;
  8859. FLVNetWorkDisk.AdjustPosition := True;
  8860. FLVNetWorkDisk.OnItemShowHint := ItemShowHint;
  8861. FLVNetWorkDisk.OnItemDoubleClick := NDItemDoubleClick;
  8862. FLVNetWorkDisk.OnSelectItemChanged := NDSelectItemChanged;
  8863. FLVNetWorkDisk.OnItemClick := NDSelectItemChanged;
  8864. FLVNetWorkDisk.OnItemMouseEnter := NDSelectItemChanged;
  8865. FLVNetWorkDisk.OnDropFiles := NDMissionDropFiles;
  8866. FLVNetWorkDisk.OnItemMouseDown := NDItemMouseDown;
  8867. DragAcceptFiles(FLVNetWorkDisk.Handle, True);
  8868. {$endregion}
  8869. {$region '生成显示网络硬盘上传文件任务列表的ListView'}
  8870. AddContacterListView(tsUploadingFiles, '硬盘上传文件');
  8871. FLVNetWorkDiskUploadingFiles := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8872. FLVNetWorkDiskUploadingFiles.Align := alClient;
  8873. FContacterListViews.Delete(0);
  8874. FLVNetWorkDiskUploadingFiles.LeavePicture := nil;
  8875. FLVNetWorkDiskUploadingFiles.SelectedItemBackgroud.Graphic := nil;
  8876. FLVNetWorkDiskUploadingFiles.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8877. FLVNetWorkDiskUploadingFiles.Style := lsSmallHeadImage;
  8878. FLVNetWorkDiskUploadingFiles.CaptionStyle := csDisplayName;
  8879. FLVNetWorkDiskUploadingFiles.PopupMenu := ppNetWorkMisson;
  8880. FLVNetWorkDiskUploadingFiles.HeadImageBorderColor := clWhite;
  8881. FLVNetWorkDiskUploadingFiles.SelectedItemBorderInnerColor := clWhite;
  8882. FLVNetWorkDiskUploadingFiles.SelectedItemBackColor := clWhite;
  8883. FLVNetWorkDiskUploadingFiles.OnItemOnline := nil;
  8884. FLVNetWorkDiskUploadingFiles.OnItemOffline := nil;
  8885. FLVNetWorkDiskUploadingFiles.OnItemMouseEnter := nil;
  8886. FLVNetWorkDiskUploadingFiles.OnItemMouseLeave := nil;
  8887. FLVNetWorkDiskUploadingFiles.OnItemIconButtonClick := NDMissionItemIconButtonClick;
  8888. FLVNetWorkDiskUploadingFiles.OnItemIconButtonDblClick := nil;
  8889. FLVNetWorkDiskUploadingFiles.ShowMobileButton := False;
  8890. FLVNetWorkDiskUploadingFiles.ShowTelButton := False;
  8891. FLVNetWorkDiskUploadingFiles.ShowEmailButton := False;
  8892. FLVNetWorkDiskUploadingFiles.ShowSMSButton := False;
  8893. FLVNetWorkDiskUploadingFiles.ShowCameraButton := False;
  8894. FLVNetWorkDiskUploadingFiles.ShowHeadImageButton := False;
  8895. FLVNetWorkDiskUploadingFiles.AdjustPosition := False;
  8896. FLVNetWorkDiskUploadingFiles.OnItemShowHint := ItemShowHint;
  8897. FLVNetWorkDiskUploadingFiles.OnItemDoubleClick := nil;
  8898. FLVNetWorkDiskUploadingFiles.OnSelectItemChanged := nil;
  8899. FLVNetWorkDiskUploadingFiles.OnItemClick := nil;
  8900. FLVNetWorkDiskUploadingFiles.OnItemMouseEnter := nil;
  8901. FLVNetWorkDiskUploadingFiles.ShowSMSButton := True;
  8902. FLVNetWorkDiskUploadingFiles.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CancelIcon);
  8903. {$endregion}
  8904. {$region '生成显示网络硬盘下载文件任务列表的ListView'}
  8905. AddContacterListView(tsDownloadingFiles, '硬盘下载文件');
  8906. FLVNetWorkDiskDownloadingFiles := FContacterListViews.Objects[0] as TRealICQContacterListView;
  8907. FLVNetWorkDiskDownloadingFiles.Align := alClient;
  8908. FContacterListViews.Delete(0);
  8909. FLVNetWorkDiskDownloadingFiles.LeavePicture := nil;
  8910. FLVNetWorkDiskDownloadingFiles.SelectedItemBackgroud.Graphic := nil;
  8911. FLVNetWorkDiskDownloadingFiles.DefaultPictureSmall.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  8912. FLVNetWorkDiskDownloadingFiles.Style := lsSmallHeadImage;
  8913. FLVNetWorkDiskDownloadingFiles.CaptionStyle := csDisplayName;
  8914. FLVNetWorkDiskDownloadingFiles.PopupMenu := ppNetWorkMisson;
  8915. FLVNetWorkDiskDownloadingFiles.HeadImageBorderColor := clWhite;
  8916. FLVNetWorkDiskDownloadingFiles.SelectedItemBorderInnerColor := clWhite;
  8917. FLVNetWorkDiskDownloadingFiles.SelectedItemBackColor := clWhite;
  8918. FLVNetWorkDiskDownloadingFiles.OnItemOnline := nil;
  8919. FLVNetWorkDiskDownloadingFiles.OnItemOffline := nil;
  8920. FLVNetWorkDiskDownloadingFiles.OnItemMouseEnter := nil;
  8921. FLVNetWorkDiskDownloadingFiles.OnItemMouseLeave := nil;
  8922. FLVNetWorkDiskDownloadingFiles.OnItemIconButtonClick := NDMissionItemIconButtonClick;
  8923. FLVNetWorkDiskDownloadingFiles.OnItemIconButtonDblClick := nil;
  8924. FLVNetWorkDiskDownloadingFiles.ShowMobileButton := False;
  8925. FLVNetWorkDiskDownloadingFiles.ShowTelButton := False;
  8926. FLVNetWorkDiskDownloadingFiles.ShowEmailButton := False;
  8927. FLVNetWorkDiskDownloadingFiles.ShowSMSButton := False;
  8928. FLVNetWorkDiskDownloadingFiles.ShowCameraButton := False;
  8929. FLVNetWorkDiskDownloadingFiles.ShowHeadImageButton := False;
  8930. FLVNetWorkDiskDownloadingFiles.AdjustPosition := False;
  8931. FLVNetWorkDiskDownloadingFiles.OnItemShowHint := ItemShowHint;
  8932. FLVNetWorkDiskDownloadingFiles.OnItemDoubleClick := nil;
  8933. FLVNetWorkDiskDownloadingFiles.OnSelectItemChanged := nil;
  8934. FLVNetWorkDiskDownloadingFiles.OnItemClick := nil;
  8935. FLVNetWorkDiskDownloadingFiles.OnItemMouseEnter := nil;
  8936. FLVNetWorkDiskDownloadingFiles.ShowSMSButton := True;
  8937. FLVNetWorkDiskDownloadingFiles.SMSIcon.LoadFromFile(ExtractFilePath(Application.ExeName) + CancelIcon);
  8938. {$endregion}
  8939. iIndex := AddContacterListView(tsCustomers, '客服人员');
  8940. FLVCustomers := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8941. FContacterListViews.Delete(iIndex);
  8942. FLVCustomers.AdjustPosition := False;
  8943. FLVCustomers.OnItemOnline := nil;
  8944. FLVCustomers.OnItemOffline := nil;
  8945. FLVCustomers.Style := lsSmallHeadImage;
  8946. FLVCustomers.Parent := tsCustomers;
  8947. FLVCustomers.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8948. FLVCustomers.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8949. iIndex := AddContacterListView(ScrollBoxLatests, LVLatests);
  8950. FLVLatests := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8951. FLVLatests.AdjustPosition := False;
  8952. FLVLatests.OnItemOnline := nil;
  8953. FLVLatests.OnItemOffline := nil;
  8954. FLVLatests.Parent := ScrollBoxLatests;
  8955. FLVLatests.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8956. FLVLatests.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8957. iIndex := AddContacterListView(ScrollBoxSearchMoreUser, LVMoreUsers);
  8958. FSearchListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8959. FSearchListView.OnItemOnline := nil;
  8960. FSearchListView.OnItemOffline := nil;
  8961. FSearchListView.OnItemIconButtonClick := nil;
  8962. FSearchListView.OnHeadImageMouseEnter := ItemOnHeadImageEnter;
  8963. FSearchListView.OnHeadImageMouseLeave := ItemOnHeadImageLeave;
  8964. FSearchListView.ShowTelButton := False;
  8965. FSearchListView.ShowCameraButton := False;
  8966. FSearchListView.ShowEmailButton := False;
  8967. FSearchListView.AdjustPosition := False;
  8968. iIndex := AddContacterListView(ScrollBoxSearchUser, LVSearch);
  8969. FSearchListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  8970. FSearchListView.OnItemOnline := nil;
  8971. FSearchListView.OnItemOffline := nil;
  8972. ChangeUIColor(UIMainColor);
  8973. PostMessage(Handle, WM_SIZE, 0, 0);
  8974. Application.ProcessMessages;
  8975. Sleep(200);
  8976. SetUIState;
  8977. AddWebBrowserToPageControl('about:blank', -2);
  8978. lblWeatherCity.Transparent := True;
  8979. lblWeather.Transparent := True;
  8980. lblWeatheren.Transparent := True;
  8981. //扩展标签开始
  8982. FToolBarButtonList.AddObject(LVMyContacters, MyContacters);
  8983. FToolBarButtonList.AddObject(LVMoreUsers, SysMsg);
  8984. FToolBarButtonList.AddObject(LVFriends, MyFriend);
  8985. FToolBarButtonList.AddObject(LvTeams, MyTeam);
  8986. FToolBarButtonList.AddObject(LvLatests, Latests);
  8987. FToolBarButtonIconList.AddObject(LVMyContacters, MyContactersIcon);
  8988. FToolBarButtonIconList.AddObject(LVMoreUsers, SysMsgIcon);
  8989. FToolBarButtonIconList.AddObject(LVFriends, MyFriendIcon);
  8990. FToolBarButtonIconList.AddObject(LvTeams, MyTeamIcon);
  8991. FToolBarButtonIconList.AddObject(LvLatests, LatestsIcon);
  8992. //扩展标签结束
  8993. //未读消息
  8994. NotReadMessageBoxForm := TNotReadMessageBoxForm.Create(Self);
  8995. NotReadMessageBoxForm.Left := -1000;
  8996. NotReadMessageBoxForm.Top := -1000;
  8997. NotReadMessageBoxForm.Show;
  8998. NotReadMessageBoxForm.Hide;
  8999. tsContactersShow(tsContacters);
  9000. if RealICQClient.CaEnable and (ParamStr(1) = 'wscc://sso') then
  9001. begin
  9002. ca := DecodeString(ParamStr(2));
  9003. ca := URLDecode(ca);
  9004. //ca := copy(ca,pos('ca=',ca)+3,length(ca));
  9005. Sends := TStringList.Create;
  9006. IdHttp := TIdHTTP.Create(nil);
  9007. try
  9008. ResponeStr := Idhttp.post('http://' + RealICQClient.CaServerAddress + ':' + inttostr(RealICQClient.CaPort) + '/api/Structure/LoginByCA?ca=' + ca, Sends);
  9009. ResponeStr := UTF8Decode(ResponeStr);
  9010. try
  9011. jo := SO(ResponeStr);
  9012. CALoginName := jo['data.loginName'].AsString;
  9013. CAPassWord := jo['data.password'].AsString;
  9014. except
  9015. end;
  9016. finally
  9017. Freeandnil(IdHttp);
  9018. Sends.Free;
  9019. end;
  9020. if not UserIsLogined(CALoginName) then
  9021. RealICQClient.Login(CALoginName, CAPassWord, FLoginState, FLeaveMessage, FSavePassword, False, True)
  9022. else
  9023. begin
  9024. try
  9025. Application.Terminate;
  9026. except
  9027. end;
  9028. end;
  9029. end
  9030. else
  9031. begin
  9032. FAutoLogin := RealICQClient.AutoLogin;
  9033. FSavePassword := RealICQClient.SavedPassword;
  9034. SetLoginStateControlState;
  9035. if RealICQClient.AutoLogin and (RealICQClient.SavedPassword or RealICQClient.CALogin) then
  9036. RealICQClient.LoginAsSaved;
  9037. end;
  9038. //调整大小解决右边框被覆盖问题
  9039. DisableAlign;
  9040. try
  9041. PostMessage(Handle, WM_SIZE, 0, 0);
  9042. Height := Height - 1;
  9043. Height := Height + 1;
  9044. finally
  9045. EnableAlign;
  9046. end;
  9047. tsCustomerService.PageControl := nil;
  9048. RealICQClient.OnGettedSysMsgInterfaces := RealICQClientGettedSysMsgInterfaces;
  9049. Application.ProcessMessages;
  9050. except
  9051. on E: Exception do
  9052. Error(E.Message, 'TMainForm.FormCreate');
  9053. end;
  9054. end;
  9055. //------------------------------------------------------------------------------
  9056. procedure TMainForm.FormDeactivate(Sender: TObject);
  9057. begin
  9058. if edWatchword.Visible then
  9059. edWatchwordExit(edWatchword);
  9060. //debug('FormDeactivate','TMainForm.FormDeactivate');
  9061. end;
  9062. //------------------------------------------------------------------------------
  9063. procedure TMainForm.FormDestroy(Sender: TObject);
  9064. begin
  9065. try
  9066. if RealICQClient.Connected then
  9067. RealICQClient.Logout;
  9068. if AThreadPool <> nil then
  9069. AThreadPool.TerminateAllYarns;
  9070. //FreeAndNil(FDownFile);
  9071. FHintWindow.ReleaseHandle;
  9072. FHintWindow.Free;
  9073. FGetUsersTask.Clear;
  9074. FreeAndNil(FGetUsersTask);
  9075. FServerInfoList.Clear;
  9076. FreeAndNil(FServerInfoList);
  9077. // FreeAndNil(FPCAMessage);
  9078. FreeAndNil(FOfflineAutoResponseTexts);
  9079. FNotAddedEmployeeList.Clear;
  9080. FreeAndNil(FNotAddedEmployeeList);
  9081. FSystemMessages.Clear;
  9082. FreeAndNil(FSystemMessages);
  9083. FToolBarButtonList.Clear;
  9084. FreeAndNil(FToolBarButtonList);
  9085. FToolBarButtonIconList.Clear;
  9086. FreeAndNil(FToolBarButtonIconList);
  9087. FNotReadMessages.Clear;
  9088. FreeAndNil(FNotReadMessages);
  9089. FContacterListViews.Clear;
  9090. FreeAndNil(FContacterListViews);
  9091. FContacterTreeViews.Clear;
  9092. FreeAndNil(FContacterTreeViews);
  9093. FWebTabs.Clear;
  9094. FreeAndNil(FWebTabs);
  9095. FGroups.Clear;
  9096. FreeAndNil(FGroups);
  9097. FFriendInfo.Clear;
  9098. FreeAndNil(FFriendInfo);
  9099. FManageGroupMsgList.Clear;
  9100. FreeAndNil(FManageGroupMsgList);
  9101. FManageGroupMemberMsgList.Clear;
  9102. FreeAndNil(FManageGroupMemberMsgList);
  9103. while FWebPanels.Count > 0 do
  9104. begin
  9105. try
  9106. FWebPanels.Objects[0].Free;
  9107. except
  9108. end;
  9109. FWebPanels.Delete(0);
  9110. end;
  9111. FWebPanels.Clear;
  9112. FreeAndNil(FWebPanels);
  9113. while FSystemNotices.Count > 0 do
  9114. begin
  9115. try
  9116. TSystemNotices(FSystemNotices[0]).Free;
  9117. except
  9118. end;
  9119. FSystemNotices.Delete(0);
  9120. end;
  9121. FSystemNotices.Clear;
  9122. FreeAndNil(FSystemNotices);
  9123. while FFaceList.Count > 0 do
  9124. begin
  9125. try
  9126. FFaceList.Objects[0].Free;
  9127. except
  9128. end;
  9129. FFaceList.Delete(0);
  9130. end;
  9131. FFaceList.Clear;
  9132. FreeAndNil(FFaceList);
  9133. while FTempFaceList.Count > 0 do
  9134. begin
  9135. try
  9136. FTempFaceList.Objects[0].Free;
  9137. except
  9138. end;
  9139. FTempFaceList.Delete(0);
  9140. end;
  9141. FTempFaceList.Clear;
  9142. FreeAndNil(FTempFaceList);
  9143. FFaceCategory.Clear;
  9144. FreeAndNil(FFaceCategory);
  9145. FreeAndNil(FInputFont);
  9146. FreeAndNil(FDBHistory);
  9147. if HookID <> 0 then
  9148. UnHookWindowsHookEx(HookID);
  9149. if HotKeyID_ReadMessage <> 0 then
  9150. begin
  9151. UnregisterHotKey(Handle, HotKeyID_ReadMessage);
  9152. DeleteAtom(HotKeyID_ReadMessage);
  9153. end;
  9154. if HotKeyID_CopyScreen <> 0 then
  9155. begin
  9156. UnregisterHotKey(Handle, HotKeyID_CopyScreen);
  9157. DeleteAtom(HotKeyID_CopyScreen);
  9158. end;
  9159. finally
  9160. GetDataModule.Uninstall;
  9161. end;
  9162. end;
  9163. //------------------------------------------------------------------------------
  9164. procedure TMainForm.FormResize(Sender: TObject);
  9165. var
  9166. iLoop: Integer;
  9167. ContacterTreeView: TRealICQContacterTreeView;
  9168. FriendTreeView: TRealICQContacterTreeView;
  9169. ListView: TRealICQContacterListView;
  9170. begin
  9171. ShowMeInformation;
  9172. if FContacterTreeViews = nil then
  9173. Exit;
  9174. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  9175. begin
  9176. ContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  9177. ContacterTreeView.ReDrawAll;
  9178. end;
  9179. {for iLoop := 0 to FContacterTreeViews.Count - 1 do
  9180. begin
  9181. FriendTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  9182. FriendTreeView.ReDrawAll;
  9183. end; }
  9184. for iLoop := 0 to FContacterListViews.Count - 1 do
  9185. begin
  9186. ListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  9187. ListView.ReDrawAll;
  9188. end;
  9189. if FLVNetWorkDisk <> nil then
  9190. FLVNetWorkDisk.ReDrawAll;
  9191. if FTVCustomerLatests <> nil then
  9192. FTVCustomerLatests.ReDrawAll;
  9193. pnlSearchMoreUser.Width := pnlSelectServer.Width - 5;
  9194. ImgLogining.Left := (pnlSearchMoreUser.Width - ImgLogining.Width) div 2;
  9195. { TODO -olqq -c : 二维码居中 2014/12/14 11:05:27 }
  9196. ImgApp.Left := (Self.Width - ImgApp.Width - 26) div 2;
  9197. end;
  9198. //------------------------------------------------------------------------------
  9199. procedure TMainForm.SaveWindowState;
  9200. begin
  9201. if WindowState <> wsMaximized then
  9202. begin
  9203. FMainFormLeft := Left;
  9204. FMainFormTop := Top;
  9205. FMainFormHeight := Height;
  9206. FMainFormWidth := Width - pnlMiddleRight.Width;
  9207. try
  9208. SaveDefaultConfigs;
  9209. except
  9210. end;
  9211. end;
  9212. end;
  9213. //------------------------------------------------------------------------------
  9214. procedure TMainForm.sbpNewWebTabClick(Sender: TObject);
  9215. begin
  9216. AddWebBrowserToPageControl('about:blank', -1);
  9217. end;
  9218. //------------------------------------------------------------------------------
  9219. procedure TMainForm.sbpSMSClick(Sender: TObject);
  9220. begin
  9221. OpenSMSForm('', True);
  9222. end;
  9223. //------------------------------------------------------------------------------
  9224. procedure TMainForm.FormShow(Sender: TObject);
  9225. var J:Integer;
  9226. begin
  9227. try
  9228. //tsCustomers.Parent := nil;
  9229. //tsCustomers.PageControl := nil;
  9230. //pgcMainWorkArea.RemoveControl(tsCustomers);
  9231. //FreeAndNil(tsCustomers);
  9232. // Repaint;
  9233. // for J := 0 to Self.ControlCount -1 do
  9234. // if (Self.Controls[J] is TRealICQContacterTreeView) then
  9235. // Self.Controls[J].Repaint;
  9236. except
  9237. end;
  9238. //tsNetWorkDisk.Parent := nil;
  9239. //tsNetWorkDisk.PageControl := nil;
  9240. //pgcMainWorkArea.RemoveControl(tsNetWorkDisk);
  9241. //FreeAndNil(tsNetWorkDisk);
  9242. ClearMemory;
  9243. actOpenMainForm.Execute;
  9244. end;
  9245. procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
  9246. begin
  9247. if FSearchListViewInVisible then
  9248. begin
  9249. edFilterKeyword.Text := '';
  9250. edFilterKeyword.Font.Color := clGray;
  9251. end;
  9252. Action := caNone;
  9253. if pnlMiddleRight.Visible then
  9254. begin
  9255. ShowOrHideMuiltiWeb;
  9256. Exit;
  9257. end;
  9258. ZoomEffect(Self, zaMinimize);
  9259. ShowWindow(Handle, SW_HIDE);
  9260. FHidden := true;
  9261. end;
  9262. //------------------------------------------------------------------------------
  9263. procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  9264. begin
  9265. SaveWindowState;
  9266. end;
  9267. //------------------------------------------------------------------------------
  9268. procedure TMainForm.actLoginExecute(Sender: TObject);
  9269. begin
  9270. end;
  9271. //------------------------------------------------------------------------------
  9272. procedure TMainForm.actRegExecute(Sender: TObject);
  9273. begin
  9274. if RegForm <> nil then
  9275. Exit;
  9276. RegForm := TRegForm.Create(Self);
  9277. try
  9278. if RegForm.ShowModal <> mrOK then
  9279. begin
  9280. RealICQClient.CancelReg;
  9281. end;
  9282. finally
  9283. FreeAndNil(RegForm);
  9284. end;
  9285. end;
  9286. //------------------------------------------------------------------------------
  9287. procedure TMainForm.actDelFriendExecute(Sender: TObject);
  9288. var
  9289. ItemIndex: Integer;
  9290. RealICQFriendTreeView: TRealICQContacterTreeView;
  9291. Friend: TRealICQEmployee;
  9292. begin
  9293. if MessageBox(Handle, '确实要将选中的用户从好友列表中删除吗?', '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  9294. Exit;
  9295. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9296. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9297. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  9298. if (Friend <> nil) then
  9299. begin
  9300. if Friend.BranchID = LVFriends then
  9301. RealICQClient.DelFriend(Friend.LoginName);
  9302. end;
  9303. end;
  9304. //------------------------------------------------------------------------------
  9305. procedure TMainForm.actRemoveUserExecute(Sender: TObject);
  9306. var
  9307. ItemIndex: Integer;
  9308. GroupName: string;
  9309. RealICQFriendTreeView: TRealICQContacterTreeView;
  9310. Friend: TRealICQEmployee;
  9311. MenuItem: TMenuItem;
  9312. begin
  9313. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9314. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9315. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  9316. if Friend = nil then
  9317. Exit;
  9318. GroupName := Friend.BranchID;
  9319. if MessageBox(Handle, PChar('确实要将选中的用户从' + GroupName + '删除吗?'), '确认删除', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
  9320. Exit;
  9321. if FShowGroup and (FGroups.IndexOf(GroupName) <> -1) then
  9322. begin
  9323. // MenuItem := miGroup.Find(LVFriends);
  9324. // miMoveGroupClick(MenuItem);
  9325. exit;
  9326. end;
  9327. {
  9328. Screen.Cursor := crHourGlass;
  9329. Application.ProcessMessages;
  9330. try
  9331. if GroupName = lvBlacklists then
  9332. begin
  9333. RealICQClient.DelBlacklists(Friend.LoginName);
  9334. ShowAddFriendWindow(Self, Friend.LoginName, Friend.DisplayName);
  9335. Sleep(15);
  9336. end;
  9337. finally
  9338. Screen.Cursor := crDefault;
  9339. end;
  9340. }
  9341. end;
  9342. //------------------------------------------------------------------------------
  9343. procedure TMainForm.actLogoutExecute(Sender: TObject);
  9344. var
  9345. ShellPath: string;
  9346. begin
  9347. if GetTalkingFormCount > 0 then
  9348. begin
  9349. if MessageBox(Handle, '确实要注销吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  9350. Exit;
  9351. CloseAllTalkingForm;
  9352. end;
  9353. CloseAllSMSForm;
  9354. RealICQClient.Logout;
  9355. RealICQClient.FriendCount := 0;
  9356. FIsLogout := True;
  9357. ShellPath:= ExtractFilePath(paramstr(0)) + 'Online.exe';
  9358. if FileExists(ShellPath) then
  9359. WinExec(PChar(ShellPath + ' /R ' + '"' + Application.ExeName + '"'), SW_SHOW);
  9360. end;
  9361. //------------------------------------------------------------------------------
  9362. procedure TMainForm.actLoginAsExecute(Sender: TObject);
  9363. begin
  9364. if RegForm <> nil then
  9365. begin
  9366. MessageBox(RegForm.Handle, '请先关闭新用户注册窗口', '提示', MB_ICONINFORMATION);
  9367. Exit;
  9368. end;
  9369. RealICQClient.LoginAsSaved;
  9370. end;
  9371. //------------------------------------------------------------------------------
  9372. procedure TMainForm.actOfflieAutoResponseExecute(Sender: TObject);
  9373. begin
  9374. if OptionsForm <> nil then
  9375. Exit;
  9376. OptionsForm := TOptionsForm.Create(Self);
  9377. try
  9378. OptionsForm.PageIndex := 10;
  9379. OptionsForm.ShowModal;
  9380. finally
  9381. FreeAndNil(OptionsForm);
  9382. end;
  9383. end;
  9384. procedure TMainForm.actOnlineExecute(Sender: TObject);
  9385. begin
  9386. RealICQClient.ChangeState(TRealICQLoginState((Sender as TAction).Tag), (Sender as TAction).Caption);
  9387. end;
  9388. //------------------------------------------------------------------------------
  9389. procedure TMainForm.actHiddenExecute(Sender: TObject);
  9390. begin
  9391. RealICQClient.ChangeState(stHidden, '');
  9392. end;
  9393. //------------------------------------------------------------------------------
  9394. procedure TMainForm.actLeaveExecute(Sender: TObject);
  9395. begin
  9396. RealICQClient.ChangeState(stLeave, (Sender as TAction).Caption);
  9397. end;
  9398. //------------------------------------------------------------------------------
  9399. procedure TMainForm.actHelpExecute(Sender: TObject);
  9400. begin
  9401. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar('http://www.lxtalk.com'),'',SW_SHOWMAXIMIZED);
  9402. //ShellExecute(handle, 'open',PChar(GetDefaultBrowser), PChar('http://www.lxtalk.com'),'',SW_SHOWMAXIMIZED);
  9403. end;
  9404. //------------------------------------------------------------------------------
  9405. procedure TMainForm.actOtherStateExecute(Sender: TObject);
  9406. var
  9407. LeaveMessage: string;
  9408. begin
  9409. LeaveMessage := Trim(ShowMyInputBox('其它状态', '请输入离开状态说明文字', '', 16));
  9410. if Length(LeaveMessage) > 0 then
  9411. RealICQClient.ChangeState(stLeave, LeaveMessage);
  9412. end;
  9413. //------------------------------------------------------------------------------
  9414. procedure TMainForm.RealICQClientLoginResult(Sender: TObject; LoginResultType: TRealICQLoginResultType; ResultMessage: string);
  9415. var
  9416. hwnd: THandle;
  9417. DBFileName: string;
  9418. RemoteVersion: string;
  9419. RemoteKeylist: string;
  9420. begin
  9421. TimerForLogining.Enabled := False;
  9422. if not FCheckedUpdate then
  9423. begin
  9424. if not FileExists(ExtractFilePath(paramstr(0)) + 'Online.exe') then
  9425. DownLoadUpdateConfig
  9426. else
  9427. WinExec(PChar(ExtractFilePath(paramstr(0)) + 'Online.exe /S0 /C /Q'), SW_SHOW);
  9428. end;
  9429. FCheckedUpdate := not FCheckedUpdate;
  9430. case LoginResultType of
  9431. rtLoginOK, rtCanUpdate:
  9432. begin
  9433. Success('成功连接服务器!', 'TMainForm.RealICQClientLoginResult');
  9434. AddMessageHistory(smSimple, '登录至服务器', nil);
  9435. lblLoginState.Caption := '已登录,数据下载中...';
  9436. lblLoginState.Refresh;
  9437. lblNDState.Caption := RealICQClient.NetWorkDiskServerAddress + '(' + IntToStr(RealICQClient.NetWorkDiskServerPort) + ')';
  9438. DBFileName := RealICQClient.GetUserDir + PersonalMessageHistoryDBFile;
  9439. if not FileExists(DBFileName) then
  9440. CopyFile(PChar(ExtractFilePath(paramstr(0)) + MessageHistoryDBFile), PChar(DBFileName), False);
  9441. try
  9442. FDBHistory.LoginName := RealICQClient.LoginName;
  9443. FDBHistory.DBFileName := DBFileName;
  9444. except
  9445. on E: Exception do
  9446. begin
  9447. Error(E.Message, '加载本地数据库失败');
  9448. end;
  9449. end;
  9450. // btShowMiniPage.Visible := RealICQClient.ShowMiniPage;
  9451. if RealICQClient.WorkingMode = wmPublic then
  9452. begin
  9453. {$region 'wmPublic工作模式'}
  9454. { AddContacterListView(navForContacters.Groups.Objects[0] as TScrollBox, LVFriends);
  9455. navForContacters.Groups[0] := LVFriends;
  9456. AddContacterListView(navForContacters.Groups.Objects[1] as TScrollBox, LVStrangers);
  9457. navForContacters.Groups[1] := LVStrangers;
  9458. AddContacterListView(navForContacters.Groups.Objects[2] as TScrollBox, LVBlacklists);
  9459. navForContacters.Groups[2] := LVBlacklists; }
  9460. {$endregion}
  9461. //debug('wmPublic','TMainForm.RealICQClientLoginResult');
  9462. end
  9463. else if RealICQClient.WorkingMode = wmCorporation then
  9464. begin
  9465. {$region 'wmCorporation'}
  9466. FShowGroup := False;
  9467. AddFriendTreeView(ScrollBoxMyFriend, LVFriends);
  9468. AddContacterTreeView(ScrollBoxContacters, LVMyContacters);
  9469. AddContacterTreeView(ScrollBoxAddrBook, LVAddrBook);
  9470. //产品类型
  9471. FProductType := TRealICQProductType(TConditionConfig.GetConfig.ProductType);
  9472. // LQQ
  9473. // 把请求当前用户从RealICQClient移动到BranchService
  9474. TMessagesHander.GetHander.Init;
  9475. {$endregion}
  9476. //debug('wmCorporation','TMainForm.RealICQClientLoginResult');
  9477. end;
  9478. try
  9479. TTeamsAdapter.Start(RealICQClient.LoginName);
  9480. TGroupShareConfig.GetConfig.URL := RealICQClient.HeadImageURL;
  9481. btShowMiniPage.Visible := TCustomerConfig.GetConfig.ShowGuideViewBtn;
  9482. //用户类型
  9483. FUserType := RealICQClient.LoginUserType;
  9484. //关键字过滤
  9485. FFilter := TFilterConfig.GetConfig.Filter;
  9486. if FFilter then
  9487. begin
  9488. RemoteVersion := HttpGet(TFilterConfig.GetConfig.Version, 1);
  9489. if TFilterConfig.GetConfig.Local <> RemoteVersion then
  9490. begin
  9491. RemoteKeylist := HttpGet(TFilterConfig.GetConfig.Keyword, 1);
  9492. TFilterConfig.GetConfig.SaveKeylist(RemoteKeylist);
  9493. TFilterConfig.GetConfig.Local := RemoteVersion;
  9494. end;
  9495. FKeyList := TFilterConfig.GetConfig.Keylist;
  9496. end;
  9497. TMainFormController.GetController.ChangeStyle;
  9498. TMainFormController.GetController.LoginToAppCentre(RealICQClient.LoginName);
  9499. pnlToolBarResize(nil);
  9500. except
  9501. on E: Exception do
  9502. begin
  9503. Error(E.Message, 'TMainForm.RealICQClientLoginResult');
  9504. end;
  9505. end;
  9506. end;
  9507. // rtMustUpdate:
  9508. // begin
  9509. // //启动升级程序
  9510. // hWnd := FindWindow(pchar('TUpdateFrm'), pchar(trim('自动更新')));
  9511. // if hWnd = 0 then
  9512. // WinExec('Update.exe', SW_SHOW);
  9513. // end;
  9514. // rtVersionError:
  9515. // MessageBox(Handle, '抱歉,您当前使用的客户端版本不受支持', '登录失败', MB_ICONINFORMATION);
  9516. // rtLoginErrorByDisplayName:
  9517. // MessageBox(Handle, '存在姓名相同的用户,请使用登录名登录!', '登录失败', MB_ICONINFORMATION);
  9518. rtAuthorizationError:
  9519. begin
  9520. MessageBox(Handle, '用户名或密码错误', '登录失败', MB_ICONINFORMATION);
  9521. RealICQClient.ClearSavedPassword;
  9522. actLoginAs.Visible := False;
  9523. SetLoginControlsVisible(True);
  9524. end;
  9525. rtOther:
  9526. MessageBox(Handle, PChar(ResultMessage), '登录失败', MB_ICONINFORMATION);
  9527. end;
  9528. end;
  9529. //------------------------------------------------------------------------------
  9530. procedure TMainForm.RealICQClientLoginStateChanged(Sender: TObject);
  9531. begin
  9532. if not RealICQClient.Logined then
  9533. TimerForCheckLogoutTimeout.Enabled := False;
  9534. SetUIState;
  9535. ClearMemory;
  9536. end;
  9537. //------------------------------------------------------------------------------
  9538. procedure TMainForm.RealICQClientPleaseSendFaceToMe(Sender: TObject; ALoginName, AFaceMD5Code: string);
  9539. var
  9540. iIndex: Integer;
  9541. Face: TFace;
  9542. begin
  9543. iIndex := FFaceList.IndexOf(AFaceMD5Code);
  9544. if iIndex >= 0 then
  9545. begin
  9546. Face := FFaceList.Objects[iIndex] as TFace;
  9547. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, Face.FileName, foFace);
  9548. Exit;
  9549. end;
  9550. iIndex := FTempFaceList.IndexOf(AFaceMD5Code);
  9551. if iIndex >= 0 then
  9552. begin
  9553. Face := FTempFaceList.Objects[iIndex] as TFace;
  9554. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, Face.FileName, foFace);
  9555. Exit;
  9556. end;
  9557. if FileExists(FindRecvedFace(AFaceMD5Code)) then
  9558. begin
  9559. (Sender as TRealICQClient).SendFile(MainForm.UseCacheDir, MainForm.CacheDir, ALoginName, FindRecvedFace(AFaceMD5Code), foFace);
  9560. Exit;
  9561. end
  9562. end;
  9563. //------------------------------------------------------------------------------
  9564. procedure TMainForm.RealICQClientPleaseUploadTeamFace(Sender: TObject; MD5String: string; var FileName: string);
  9565. var
  9566. iIndex: Integer;
  9567. Face: TFace;
  9568. begin
  9569. iIndex := FFaceList.IndexOf(MD5String);
  9570. if iIndex >= 0 then
  9571. begin
  9572. Face := FFaceList.Objects[iIndex] as TFace;
  9573. FileName := Face.FileName;
  9574. Exit;
  9575. end;
  9576. iIndex := FTempFaceList.IndexOf(MD5String);
  9577. if iIndex >= 0 then
  9578. begin
  9579. Face := FTempFaceList.Objects[iIndex] as TFace;
  9580. FileName := Face.FileName;
  9581. Exit;
  9582. end;
  9583. if FileExists(FindRecvedFace(MD5String)) then
  9584. begin
  9585. FileName := FindRecvedFace(MD5String);
  9586. Exit;
  9587. end
  9588. end;
  9589. //------------------------------------------------------------------------------
  9590. procedure TMainForm.RealICQClientReConnectExecute(Sender: TObject; ASeconds: Integer);
  9591. begin
  9592. TimerForLogining.Enabled := False;
  9593. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  9594. TrayIcon.SetDefaultIcon;
  9595. lblLoginState.Caption := '连接已中断' + #$D#$A + IntToStr(ASeconds) + ' 秒后重新建立连接。';
  9596. lblLoginState.Visible := True;
  9597. SetLoginControlsVisible(False);
  9598. if not btLogin.Visible then
  9599. begin
  9600. btLogin.Visible := True;
  9601. btLogin.Caption := '取消(&C)';
  9602. btLogin.Refresh;
  9603. end;
  9604. lblReConnect.Visible := True;
  9605. TimerForCheckLogoutTimeout.Enabled := False;
  9606. if not RealICQClient.ReConnectExecuting then
  9607. RealICQClient.CancelReConnectAndLogin;
  9608. end;
  9609. //------------------------------------------------------------------------------
  9610. procedure TMainForm.RealICQClientRemovedUser(Sender: TObject; ALoginName: string);
  9611. var
  9612. itemIndex: Integer;
  9613. RealICQFriendTreeView: TRealICQContacterTreeView;
  9614. // Friend: TRealICQEmployee;
  9615. // Node: TTreeNode;
  9616. begin
  9617. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9618. if ItemIndex >= 0 then
  9619. begin
  9620. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9621. ItemIndex := RealICQFriendTreeView.EmployeeItems.IndexOf(ALoginName);
  9622. if ItemIndex >= 0 then
  9623. RealICQFriendTreeView.EmployeeItems.Delete(ItemIndex);
  9624. end;
  9625. end;
  9626. //------------------------------------------------------------------------------
  9627. procedure TMainForm.TimerForFlashTrayIconTimer(Sender: TObject);
  9628. var
  9629. Icon: TIcon;
  9630. Bitmap: TBitmap;
  9631. MessageID: string;
  9632. RealICQUser: TRealICQUser;
  9633. begin
  9634. if FNotReadMessages.Count = 0 then
  9635. begin
  9636. NotReadMessageBoxForm.Visible := False;
  9637. TimerForFlashTrayIcon.Enabled := False;
  9638. ShowMeInformation;
  9639. Exit;
  9640. end;
  9641. if not (RealICQClient.Logined and RealICQClient.Connected) then
  9642. begin
  9643. TimerForFlashTrayIcon.Enabled := False;
  9644. NotReadMessageBoxForm.Visible := False;
  9645. Exit;
  9646. end;
  9647. Icon := nil;
  9648. Bitmap := nil;
  9649. MessageID := FNotReadMessages.Strings[FNotReadMessages.Count - 1];
  9650. if AnsiSameStr(Copy(MessageID, 1, Length(SMSMessageID)), SMSMessageID) then
  9651. begin
  9652. Icon := TIcon.Create;
  9653. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + SMSMessageIcon);
  9654. end
  9655. else if AnsiSameStr(Copy(MessageID, 1, Length(TeamMessageID)), TeamMessageID) then
  9656. begin
  9657. Icon := TIcon.Create;
  9658. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamIcon);
  9659. end
  9660. else if AnsiSameStr(Copy(MessageID, 1, Length(SystemMessageID)), SystemMessageID) then
  9661. begin
  9662. Icon := TIcon.Create;
  9663. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + SystemMessageIcon);
  9664. end
  9665. else
  9666. begin
  9667. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(MessageID);
  9668. if FileExists(RealICQUser.HeadImageFile) then
  9669. begin
  9670. try
  9671. Bitmap := GetSamllBitmap(RealICQUser.HeadImageFile, 16, 16, False);
  9672. except
  9673. Icon := TIcon.Create;
  9674. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  9675. end;
  9676. end
  9677. else
  9678. begin
  9679. Icon := TIcon.Create;
  9680. Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultIcon);
  9681. end;
  9682. end;
  9683. try
  9684. while ImgLstForFlashTrayIcon.Count > 1 do
  9685. ImgLstForFlashTrayIcon.Delete(1);
  9686. if Icon <> nil then
  9687. ImgLstForFlashTrayIcon.AddIcon(Icon)
  9688. else if Bitmap <> nil then
  9689. ImgLstForFlashTrayIcon.Add(Bitmap, nil);
  9690. finally
  9691. try
  9692. FreeAndNil(Bitmap);
  9693. FreeAndNil(Icon);
  9694. except
  9695. end;
  9696. end;
  9697. ImgLstForFlashTrayIcon.GetIcon(FFlashTrayIconIndex, TrayIcon.Icon);
  9698. TrayIcon.SetDefaultIcon;
  9699. if FFlashTrayIconIndex <> 0 then
  9700. FFlashTrayIconIndex := 0
  9701. else
  9702. FFlashTrayIconIndex := 1;
  9703. end;
  9704. //------------------------------------------------------------------------------
  9705. procedure TMainForm.TimerForLoginingTimer(Sender: TObject);
  9706. begin
  9707. ImgLstForLogining.GetIcon(FFlashTrayIconIndexAtLogining, TrayIcon.Icon);
  9708. TrayIcon.SetDefaultIcon;
  9709. Inc(FFlashTrayIconIndexAtLogining);
  9710. if FFlashTrayIconIndexAtLogining >= ImgLstForLogining.Count then
  9711. FFlashTrayIconIndexAtLogining := 0;
  9712. // TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  9713. // TrayIcon.SetDefaultIcon;
  9714. end;
  9715. procedure TMainForm.TimerForreconnectgroupTimer(Sender: TObject);
  9716. begin
  9717. if (realICQClient.Logined and realICQClient.Connected) then
  9718. begin
  9719. { TODO -olqq -c : 重连的时候,做下异常处理 2014/12/12 15:36:23 }
  9720. try
  9721. TTeamsAdapter.Start(RealICQClient.LoginName);
  9722. { TODO -olqq -c : 在procedure TGroup.OnOpen中有重复 2014/12/12 15:41:02 }
  9723. //WebSocketTeamSubscribe;
  9724. except
  9725. on E: Exception do
  9726. Log(E.Message, 'TMainForm.TimerForreconnectgroupTimer');
  9727. end;
  9728. end;
  9729. end;
  9730. //------------------------------------------------------------------------------
  9731. procedure TMainForm.StopFlashTeam(ATeamID: string);
  9732. var
  9733. ItemIndex: Integer;
  9734. ListItem: TRealICQContacterListItem;
  9735. begin
  9736. ItemIndex := FLVTeams.Items.IndexOf(ATeamID);
  9737. if ItemIndex >= 0 then
  9738. begin
  9739. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9740. ListItem.StopFlash;
  9741. end;
  9742. end;
  9743. procedure TMainForm.StopHeadImageFlash(AID: string);
  9744. var
  9745. ItemIndex: Integer;
  9746. ListItem: TRealICQContacterListItem;
  9747. begin
  9748. ItemIndex := FLVTeams.Items.IndexOf(AID);
  9749. if ItemIndex >= 0 then
  9750. begin
  9751. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9752. ListItem.StopFlash();
  9753. end;
  9754. end;
  9755. procedure TMainForm.SysMsgClick(Sender: TObject);
  9756. begin
  9757. RealICQClient.SendGetMoreServerList;
  9758. end;
  9759. procedure TMainForm.SysMsgIconClick(Sender: TObject);
  9760. begin
  9761. RealICQClient.SendGetMoreServerList;
  9762. end;
  9763. //------------------------------------------------------------------------------
  9764. procedure TMainForm.StopFlash(ALoginName: string);
  9765. var
  9766. ItemIndex: Integer;
  9767. RealICQContacterListView: TRealICQContacterListView;
  9768. RealICQContacterListItem: TRealICQContacterListItem;
  9769. RealICQFriendTreeView: TRealICQContacterTreeView;
  9770. RealICQContacterTreeView: TRealICQContacterTreeView;
  9771. Employee: TRealICQEmployee;
  9772. Friend: TRealICQEmployee;
  9773. begin
  9774. ItemIndex := FSearchListView.Items.IndexOf(ALoginName);
  9775. if ItemIndex >= 0 then
  9776. begin
  9777. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9778. RealICQContacterListItem.StopFlash;
  9779. end;
  9780. if (RealICQClient.WorkingMode = wmCorporation) or (FShowTree and (TFriendsService.GetService.IsFriend(ALoginName)) and (TWorkmatesService.GetService.IsWorkmate(ALoginName))) then
  9781. begin
  9782. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  9783. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9784. if RealICQContacterTreeView <> nil then
  9785. begin
  9786. Employee := RealICQContacterTreeView.GetEmployee(ALoginName);
  9787. if Employee <> nil then
  9788. Employee.StopFlash
  9789. else
  9790. begin
  9791. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9792. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9793. if RealICQFriendTreeView <> nil then
  9794. begin
  9795. Friend := RealICQFriendTreeView.GetEmployee(ALoginName);
  9796. if Friend <> nil then
  9797. Friend.StopFlash;
  9798. end;
  9799. end;
  9800. end;
  9801. end
  9802. else
  9803. begin
  9804. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  9805. if RealICQContacterListView <> nil then
  9806. begin
  9807. ItemIndex := RealICQContacterListView.Items.IndexOf(ALoginName);
  9808. if ItemIndex >= 0 then
  9809. begin
  9810. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9811. RealICQContacterListItem.StopFlash;
  9812. end;
  9813. end;
  9814. end;
  9815. end;
  9816. procedure TMainForm.WMHotKeyHandle(var Msg: TWMHotKey);
  9817. var
  9818. iLoop: Integer;
  9819. AForm: TTalkingForm;
  9820. begin
  9821. msg.Result := 1; //该消息已经处理
  9822. if msg.HotKey = HotKeyID_ReadMessage then
  9823. begin
  9824. TrayIconDblClick(TrayIcon);
  9825. end;
  9826. if msg.HotKey = HotKeyID_CopyScreen then
  9827. begin
  9828. for iLoop := 0 to TalkingForms.Count - 1 do
  9829. begin
  9830. AForm := TalkingForms[iLoop];
  9831. if AForm.Active then
  9832. begin
  9833. ShowCopyScreenForm(AForm);
  9834. Exit;
  9835. end;
  9836. end;
  9837. ShowCopyScreenForm(nil);
  9838. end;
  9839. end;
  9840. //------------------------------------------------------------------------------
  9841. procedure TMainForm.ShowRealICQMessage(RealICQMessage: TRealICQMessage; ShowSendFailed: Boolean; ARealICQClient: TRealICQClient);
  9842. var
  9843. LoginName: string;
  9844. iIndex, ItemIndex: Integer;
  9845. TalkingForm: TTalkingForm;
  9846. MessageList: TList;
  9847. NotReadMessage: TNotReadMessage;
  9848. RealICQContacterListView: TRealICQContacterListView;
  9849. RealICQContacterListItem: TRealICQContacterListItem;
  9850. RealICQContacterTreeView: TRealICQContacterTreeView;
  9851. Employee: TRealICQEmployee;
  9852. RealICQFriendTreeView: TRealICQContacterTreeView;
  9853. Friend: TRealICQEmployee;
  9854. NeedAddToNotReadMessages: Boolean;
  9855. begin
  9856. try
  9857. RealICQMessage.MessageStr := TTextMessageService.GetService.ContentFilter(RealICQMessage);
  9858. FDBHistory.SaveMessage('-1', RealICQMessage.Sender, RealICQMessage.Receiver, RealICQMessage.SendDateTime, RealICQMessage.FontStr, RealICQMessage.MessageStr, RealICQMessage.IsEncryMessage);
  9859. if RealICQMessage.IsEncryMessage then
  9860. RealICQMessage.ID := FDBHistory.GetMaxMessageId;
  9861. finally
  9862. if AnsiSameText(RealICQMessage.Sender, ARealICQClient.LoginName) then
  9863. LoginName := RealICQMessage.Receiver
  9864. else
  9865. LoginName := RealICQMessage.Sender;
  9866. TalkingForm := GetTalkingForm(LoginName, ARealICQClient);
  9867. if TalkingForm = nil then
  9868. NeedAddToNotReadMessages := True
  9869. else
  9870. NeedAddToNotReadMessages := not TalkingForm.CanWriteMessage;
  9871. if NeedAddToNotReadMessages then
  9872. begin
  9873. NotReadMessage := TNotReadMessage.Create;
  9874. NotReadMessage.FRealICQMessage := RealICQMessage;
  9875. NotReadMessage.FShowSendFailed := ShowSendFailed;
  9876. NotReadMessage.FRealICQClient := ARealICQClient;
  9877. iIndex := FNotReadMessages.IndexOf(LoginName);
  9878. if iIndex >= 0 then
  9879. begin
  9880. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  9881. MessageList.Add(NotReadMessage);
  9882. end
  9883. else
  9884. begin
  9885. if MessageBoxForm = nil then
  9886. begin
  9887. {$region '跳动头像'}
  9888. ItemIndex := FSearchListView.Items.IndexOf(LoginName);
  9889. if ItemIndex >= 0 then
  9890. begin
  9891. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9892. if FlashImageOnGetMessage then
  9893. RealICQContacterListItem.Flash(fsJump);
  9894. end;
  9895. if (RealICQClient.WorkingMode = wmCorporation) or (FShowTree and TUsersService.GetUsersService.IsWorkmateOrFriend(LoginName)) then
  9896. begin
  9897. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  9898. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9899. if RealICQContacterTreeView <> nil then
  9900. begin
  9901. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  9902. if Employee <> nil then
  9903. begin
  9904. if FlashImageOnGetMessage then
  9905. Employee.Flash(fsJump);
  9906. end
  9907. else
  9908. begin
  9909. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  9910. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  9911. if RealICQFriendTreeView <> nil then
  9912. begin
  9913. Friend := RealICQFriendTreeView.GetEmployee(LoginName);
  9914. if Friend <> nil then
  9915. if FlashImageOnGetMessage then
  9916. Friend.Flash(fsJump)
  9917. end;
  9918. end;
  9919. end;
  9920. end
  9921. else
  9922. begin
  9923. RealICQContacterListView := GetListViewByLoginName(LoginName);
  9924. if RealICQContacterListView <> nil then
  9925. begin
  9926. ItemIndex := RealICQContacterListView.Items.IndexOf(LoginName);
  9927. if ItemIndex >= 0 then
  9928. begin
  9929. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  9930. if FlashImageOnGetMessage then
  9931. RealICQContacterListItem.Flash(fsJump);
  9932. end;
  9933. end; // if RealICQContacterListView <> nil ...
  9934. end;
  9935. {$endregion}
  9936. end;
  9937. MessageList := TList.Create;
  9938. MessageList.Add(NotReadMessage);
  9939. FNotReadMessages.AddObject(LoginName, MessageList);
  9940. end;
  9941. if MessageBoxForm <> nil then
  9942. begin
  9943. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  9944. FlashWindow(MessageBoxForm.Handle, True);
  9945. MessageBoxForm.ShowMessage(RealICQMessage.Sender, MTUser);
  9946. end
  9947. else if (not TimerForFlashTrayIcon.Enabled) then
  9948. TimerForFlashTrayIcon.Enabled := True;
  9949. if PlaySoundOnGetMessage then
  9950. PlayEventSound(FMessageEventSound);
  9951. NotReadMessageBoxForm.ShowNotReadMessage;
  9952. NotReadMessageBoxForm.Height := 0;
  9953. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  9954. end
  9955. else
  9956. begin
  9957. if (GetForegroundWindow <> TalkingForm.Handle) then
  9958. begin
  9959. FlashWindow(TalkingForm.Handle, True);
  9960. if PlaySoundOnGetMessage then
  9961. PlayEventSound(FMessageEventSound);
  9962. end;
  9963. TalkingForm.ShowMessage(RealICQMessage, ShowSendFailed);
  9964. end;
  9965. end;
  9966. end;
  9967. //------------------------------------------------------------------------------
  9968. procedure TMainForm.RealICQClientSendedSendFileRequest(Sender, FileTransmitter: TObject);
  9969. var
  9970. PtoPFileTransmitter: TPtoPFileTransmitter;
  9971. TalkingForm: TTalkingForm;
  9972. ALoginName: string;
  9973. RealICQUser: TRealICQUser;
  9974. ItemIndex: Integer;
  9975. RealICQContacterListItem: TRealICQContacterListItem;
  9976. begin
  9977. PtoPFileTransmitter := FileTransmitter as TPtoPFileTransmitter;
  9978. if PtoPFileTransmitter.Objective = foFace then
  9979. begin
  9980. TalkingForm := GetTalkingForm(PtoPFileTransmitter.LoginName, Sender as TRealICQClient);
  9981. if TalkingForm = nil then
  9982. Exit;
  9983. end
  9984. else
  9985. begin
  9986. TalkingForm := OpenTalkingForm(PtoPFileTransmitter.LoginName, True, Sender as TRealICQClient);
  9987. end;
  9988. if TalkingForm.CanWriteMessage then
  9989. TalkingForm.ShowSendedSendFileRequest(PtoPFileTransmitter);
  9990. {$region '更新“最近联系人列表”中的数据'}
  9991. if Sender = RealICQClient then
  9992. begin
  9993. ALoginName := PtoPFileTransmitter.LoginName;
  9994. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  9995. if RealICQUser <> nil then
  9996. begin
  9997. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  9998. if ItemIndex = -1 then
  9999. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10000. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10001. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10002. TUsersService.GetUsersService.UpdateListItem(FLVLatests, RealICQContacterListItem, RealICQUser);
  10003. RealICQContacterListItem.MoveToTop;
  10004. end;
  10005. end;
  10006. {$endregion}
  10007. end;
  10008. //------------------------------------------------------------------------------
  10009. procedure TMainForm.RealICQClientSendedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  10010. begin
  10011. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  10012. end;
  10013. procedure TMainForm.RealICQClientCancelControlRemoteControlTransmite(Sender: TObject; ALoginName: string);
  10014. var
  10015. TalkingForm: TTalkingForm;
  10016. begin
  10017. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  10018. if TalkingForm = nil then
  10019. Exit;
  10020. if TalkingForm.CanWriteMessage then
  10021. TalkingForm.ShowCancelControlRemoteControlTransmite;
  10022. end;
  10023. procedure TMainForm.RealICQClientCanceledSendFolder(Sender: TObject; AID: Cardinal; ALoginName: string);
  10024. var
  10025. ReceiveFolderRequestForm: TReceiveFolderRequestForm;
  10026. iLoop: Integer;
  10027. begin
  10028. for iLoop := 0 to ReceiveFolderForms.Count - 1 do
  10029. begin
  10030. ReceiveFolderRequestForm := TReceiveFolderRequestForm(ReceiveFolderForms[iLoop]);
  10031. if (ReceiveFolderRequestForm.FID = AID) and AnsiSameText(ALoginName, ReceiveFolderRequestForm.FLoginName) then
  10032. begin
  10033. ReceiveFolderRequestForm.CanceledSendFolder;
  10034. Break;
  10035. end;
  10036. end;
  10037. end;
  10038. procedure TMainForm.RealICQClientCancelSendFile(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  10039. var
  10040. TalkingForm: TTalkingForm;
  10041. iWaitTimes: Integer;
  10042. begin
  10043. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  10044. if TalkingForm <> nil then
  10045. begin
  10046. if (GetForegroundWindow <> TalkingForm.Handle) then
  10047. begin
  10048. FlashWindow(TalkingForm.Handle, True);
  10049. if PlaySoundOnGetMessage then
  10050. PlayEventSound(FMessageEventSound);
  10051. end;
  10052. iWaitTimes := 0;
  10053. while not TalkingForm.CanWriteMessage do
  10054. begin
  10055. Application.ProcessMessages;
  10056. Inc(iWaitTimes);
  10057. if iWaitTimes > 1000 then
  10058. break;
  10059. Sleep(10);
  10060. end;
  10061. TalkingForm.ShowCancelSendFile(AOppositeID);
  10062. end;
  10063. end;
  10064. procedure TMainForm.RealICQClientChangePasswordResult(Sender: TObject; APassChanged: Boolean; ANewPassword: string);
  10065. begin
  10066. end;
  10067. //------------------------------------------------------------------------------
  10068. procedure TMainForm.RealICQClientGettedSendFileRequest(Sender: TObject; SendFileRequestInfo: TSendFileRequestInfo);
  10069. var
  10070. AShowActive: Boolean;
  10071. TalkingForm: TTalkingForm;
  10072. iWaitTimes: Integer;
  10073. ALoginName: string;
  10074. RealICQUser: TRealICQUser;
  10075. ItemIndex: Integer;
  10076. RealICQContacterListItem: TRealICQContacterListItem;
  10077. begin
  10078. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  10079. TalkingForm := GetTalkingForm(SendFileRequestInfo.LoginName, Sender as TRealICQClient);
  10080. if TalkingForm = nil then
  10081. begin
  10082. TalkingForm := OpenTalkingForm(SendFileRequestInfo.LoginName, not AShowActive, Sender as TRealICQClient);
  10083. end;
  10084. iWaitTimes := 0;
  10085. while not TalkingForm.CanWriteMessage do
  10086. begin
  10087. Application.ProcessMessages;
  10088. Inc(iWaitTimes);
  10089. if iWaitTimes > 1000 then
  10090. break;
  10091. Sleep(10);
  10092. end;
  10093. if (GetForegroundWindow <> TalkingForm.Handle) and (SendFileRequestInfo.Objective = foFile) then
  10094. begin
  10095. FlashWindow(TalkingForm.Handle, True);
  10096. if PlaySoundOnGetMessage then
  10097. PlayEventSound(FMessageEventSound);
  10098. end;
  10099. TalkingForm.ShowGettedSendFileRequest(SendFileRequestInfo);
  10100. {$region '更新“最近联系人列表”中的数据'}
  10101. if Sender = RealICQClient then
  10102. begin
  10103. ALoginName := SendFileRequestInfo.LoginName;
  10104. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10105. if RealICQUser <> nil then
  10106. begin
  10107. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10108. if ItemIndex = -1 then
  10109. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10110. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10111. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10112. TUsersService.GetUsersService.UpdateListItem(FLVLatests, RealICQContacterListItem, RealICQUser);
  10113. RealICQContacterListItem.MoveToTop;
  10114. end;
  10115. end;
  10116. {$endregion}
  10117. end;
  10118. procedure TMainForm.RealICQClientGettedSendFolderRequest(Sender: TObject; AID, ACount: Cardinal; ALoginName: string; AFilesStream: TStream);
  10119. var
  10120. ReceiveFolderRequestForm: TReceiveFolderRequestForm;
  10121. begin
  10122. ReceiveFolderRequestForm := TReceiveFolderRequestForm.Create(Self);
  10123. ReceiveFolderRequestForm.FCount := ACount;
  10124. ReceiveFolderRequestForm.FID := AID;
  10125. ReceiveFolderRequestForm.FLoginName := ALoginName;
  10126. ReceiveFolderRequestForm.FFilesStream := AFilesStream;
  10127. ReceiveFolderRequestForm.Show;
  10128. ReceiveFolderRequestForm.BringToFront;
  10129. end;
  10130. procedure TMainForm.RealICQClientGettedSendOfflineFileRequest(Sender: TObject; ALoginName: string; AOppositeID: Cardinal);
  10131. var
  10132. TalkingForm: TTalkingForm;
  10133. iWaitTimes: Integer;
  10134. begin
  10135. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  10136. if TalkingForm <> nil then
  10137. begin
  10138. if (GetForegroundWindow <> TalkingForm.Handle) then
  10139. begin
  10140. FlashWindow(TalkingForm.Handle, True);
  10141. if PlaySoundOnGetMessage then
  10142. PlayEventSound(FMessageEventSound);
  10143. end;
  10144. iWaitTimes := 0;
  10145. while not TalkingForm.CanWriteMessage do
  10146. begin
  10147. Application.ProcessMessages;
  10148. Inc(iWaitTimes);
  10149. if iWaitTimes > 1000 then
  10150. break;
  10151. Sleep(10);
  10152. end;
  10153. TalkingForm.ShowSendOfflineFileRequest(AOppositeID);
  10154. end;
  10155. end;
  10156. //------------------------------------------------------------------------------
  10157. procedure TMainForm.RealICQClientSendMessageFailed(Sender: TObject; RealICQMessage: TRealICQMessage);
  10158. begin
  10159. ShowRealICQMessage(RealICQMessage, True, Sender as TRealICQClient);
  10160. end;
  10161. //------------------------------------------------------------------------------
  10162. procedure TMainForm.RealICQClientSendTeamMessageFailed(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  10163. begin
  10164. ShowRealICQTeamMessage(RealICQTeamMessage, True);
  10165. end;
  10166. //------------------------------------------------------------------------------
  10167. procedure TMainForm.RealICQClientShakeWindow(Sender: TObject; ALoginName: string);
  10168. var
  10169. TalkingForm: TTalkingForm;
  10170. iWaitTimes: Integer;
  10171. begin
  10172. if not MainForm.ShowShakeWindow then
  10173. Exit;
  10174. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  10175. if TalkingForm = nil then
  10176. begin
  10177. TalkingForm := OpenTalkingForm(ALoginName, True, Sender as TRealICQClient);
  10178. end;
  10179. iWaitTimes := 0;
  10180. while not TalkingForm.CanWriteMessage do
  10181. begin
  10182. Application.ProcessMessages;
  10183. Inc(iWaitTimes);
  10184. if iWaitTimes > 1000 then
  10185. break;
  10186. Sleep(10);
  10187. end;
  10188. if GetTickCount - TalkingForm.LastRecvShakeWindowTicket < 150000 then
  10189. Exit;
  10190. ForceForeGroundWindow(TalkingForm.Handle);
  10191. TalkingForm.ShowShakeWindow(False);
  10192. TalkingForm.LastRecvShakeWindowTicket := GetTickCount;
  10193. end;
  10194. //------------------------------------------------------------------------------
  10195. procedure TMainForm.RealICQClientSMSResult(Sender: TObject; AMessageID: Cardinal; AResult: Integer);
  10196. var
  10197. iIndex: Integer;
  10198. SMSMessage: TSMSMessage;
  10199. begin
  10200. iIndex := SMSMessages.IndexOf(IntToStr(AMessageID));
  10201. if iIndex >= 0 then
  10202. begin
  10203. SMSMessage := SMSMessages.Objects[iIndex] as TSMSMessage;
  10204. SMSMessage.Sended := AResult = 0;
  10205. SMSMessage.SMSForm.ShowSMSMessageResult(AMessageID, AResult);
  10206. end;
  10207. end;
  10208. //------------------------------------------------------------------------------
  10209. procedure TMainForm.RealICQClientTeamInfoReady(Sender: TObject; ARealICQTeam: TRealICQTeam);
  10210. var
  10211. iLoop, iIndex: Integer;
  10212. ListItem: TRealICQContacterListItem;
  10213. MemberList: TStringList;
  10214. begin
  10215. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  10216. if iIndex = -1 then
  10217. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  10218. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  10219. if ARealICQTeam.IsTempTeam then
  10220. ListItem.Watchword := ''
  10221. else
  10222. ListItem.Watchword := ARealICQTeam.TeamIntro;
  10223. ListItem.LoginState := stLeave;
  10224. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  10225. try
  10226. for iLoop := MemberList.Count - 1 downto 0 do
  10227. begin
  10228. if Length(Trim(MemberList[iLoop])) = 0 then
  10229. MemberList.Delete(iLoop);
  10230. end;
  10231. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  10232. finally
  10233. MemberList.Free;
  10234. end;
  10235. {try
  10236. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  10237. except
  10238. ListItem.HeadImagePicture.Graphic := nil;
  10239. end; }
  10240. if ARealICQTeam.IsTempTeam then
  10241. ListItem.DisplayName := '多人对话'
  10242. else
  10243. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  10244. ListItem.Data := ARealICQTeam;
  10245. ListItem.ReDrawItem;
  10246. // UpdateTeamOptionsForm(ARealICQTeam);
  10247. UpdateTeamTalkingForm(ARealICQTeam);
  10248. end;
  10249. //------------------------------------------------------------------------------
  10250. procedure TMainForm.RealICQClientReceivedAdversement(Sender: TObject);
  10251. begin
  10252. if (not RealICQClient.MainFormAdversement.Visible) then
  10253. begin
  10254. if pnlAdvertisement.Height > 0 then
  10255. pnlAdvertisement.Height := 0;
  10256. end
  10257. else
  10258. begin
  10259. WebBrowserForAdvertisement.OnBeforeNavigate2 := nil;
  10260. pnlForHideWebBrowser.Visible := True;
  10261. pnlForHideWebBrowser.BringToFront;
  10262. WebBrowserForAdvertisement.OnDocumentComplete := WebBrowserForAdvertisementDocumentComplete;
  10263. WebBrowserForAdvertisement.Navigate(AnsiReplaceText(AnsiReplaceText(RealICQClient.MainFormAdversement.URL, '[%LoginName%]', RealICQClient.LoginName), '[%BranchID%]', RealICQClient.Me.BranchID));
  10264. pnlWebSearch.Top := pnlAdvertisement.Top + pnlAdvertisement.Height + 1;
  10265. end;
  10266. UpdateTalkingFormAdversement;
  10267. end;
  10268. //------------------------------------------------------------------------------
  10269. procedure TMainForm.RealICQClientReceivedCustomMessage(Sender: TObject; AContent: string);
  10270. var
  10271. Contents: TStringList;
  10272. LoginName: string;
  10273. SystemMessage: TRealICQSystemMessage;
  10274. jo: ISuperObject;
  10275. reg: TPerlRegEx;
  10276. begin
  10277. if AnsiSameText('ReGetCountByReceiver', AContent) then
  10278. begin
  10279. RealICQClient.SendGetNewInformation(0);
  10280. Exit;
  10281. end;
  10282. if AnsiSameText('ReGetAnnouncement', AContent) then
  10283. begin
  10284. RealICQClient.SendGetNewInformation(1);
  10285. Exit;
  10286. end;
  10287. AContent := AnsiReplaceStr(AContent, Chr(13), '');
  10288. Contents := RealICQUtils.SplitString(AContent, Chr(10));
  10289. try
  10290. //TODO: lqq 新消息通知接口
  10291. if (Contents.Count > 1) and (CompareText(Contents[0], 'SendNotify') = 0) then
  10292. begin
  10293. jo := SO(Contents[1]);
  10294. SystemMessage := TRealICQSystemMessage.Create;
  10295. SystemMessage.MessageID := GetTickCount;
  10296. Sleep(100);
  10297. SystemMessage.MessageType := mtBroadcast;
  10298. SystemMessage.AutoOpenWindow := True;
  10299. SystemMessage.Position := mpRightBottom;
  10300. SystemMessage.Left := 0;
  10301. SystemMessage.Top := 0;
  10302. SystemMessage.Width := 258;
  10303. SystemMessage.Height := 168;
  10304. SystemMessage.Delay := 0;
  10305. SystemMessage.MaxShowTimes := 0;
  10306. SystemMessage.Title := jo.S['title'];
  10307. SystemMessage.URL := jo.S['url'];
  10308. if jo.S['appkey'] = '' then
  10309. SystemMessage.Content := Format('<p style="line-height:18px; text-indent:2em;"><a target="_blank" href="%s" style="text-decoration: none; color=#000;">%s</a></p>', [SystemMessage.URL, jo.S['content']])
  10310. else
  10311. SystemMessage.Content := Format('<p style="line-height:18px; text-indent:2em;"><a href="%s" style="text-decoration: none; color:#000;">%s</a></p>', ['SSO||' + jo.S['appkey'] + '||' + SystemMessage.URL, jo.S['content']]);
  10312. SystemMessage.AutoCloseTime := 0;
  10313. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10314. Exit;
  10315. end;
  10316. if Contents.Count >= 3 then
  10317. begin
  10318. { if AnsiSameText(Contents.Strings[0], 'CONFIRMDLG') then
  10319. begin
  10320. SystemMessage := TRealICQSystemMessage.Create;
  10321. SystemMessage.MessageID :=StrToInt(Contents.Strings[5]);// GetTickCount;
  10322. Sleep(100);
  10323. SystemMessage.MessageType := mtConfirmMsg;
  10324. SystemMessage.AutoOpenWindow := True;
  10325. SystemMessage.Position := mpCenter;
  10326. SystemMessage.Width := 278;
  10327. SystemMessage.Height := 178;
  10328. SystemMessage.Delay := 0;
  10329. SystemMessage.MaxShowTimes := 0;
  10330. SystemMessage.Content := Contents.Strings[2];
  10331. SystemMessage.Title := Contents.Strings[3];
  10332. SystemMessage.URL := Contents.Strings[4]+Chr(10)+Contents.Strings[6]+Chr(10)+Contents.Strings[7];
  10333. SystemMessage.AutoCloseTime :=120;
  10334. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10335. end; }
  10336. if AnsiSameText(Contents.Strings[0], 'RJOA') or AnsiSameText(Contents.Strings[0], 'RDOA') or AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10337. begin
  10338. SystemMessage := TRealICQSystemMessage.Create;
  10339. SystemMessage.MessageID := GetTickCount;
  10340. Sleep(100);
  10341. SystemMessage.MessageType := mtBroadcast;
  10342. if AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10343. SystemMessage.MessageType := mtAdvertisement;
  10344. SystemMessage.AutoOpenWindow := True;
  10345. SystemMessage.Position := mpRightBottom;
  10346. SystemMessage.Left := 0;
  10347. SystemMessage.Top := 0;
  10348. SystemMessage.Width := 258;
  10349. SystemMessage.Height := 168;
  10350. SystemMessage.Delay := 0;
  10351. SystemMessage.MaxShowTimes := 0;
  10352. SystemMessage.Title := '系统提醒';
  10353. reg := TPerlRegEx.Create;
  10354. try
  10355. reg.Subject := Contents.Strings[2];
  10356. reg.RegEx := '<[^>]+>';
  10357. reg.Replacement := '';
  10358. while reg.MatchAgain do
  10359. begin
  10360. if (Length(reg.Groups[0]) >= 3) and ((SameText(LeftStr(reg.Groups[0], 3), '<a ')) or (SameText(LeftStr(reg.Groups[0], 3), '<a>'))) then
  10361. Continue;
  10362. if (SameText(reg.Groups[0], '</a>')) then
  10363. Continue;
  10364. reg.Replace();
  10365. end;
  10366. SystemMessage.Content := '<p style="line-height:18px; text-indent:2em;">' + reg.Subject + '</p>';
  10367. finally
  10368. reg.Free;
  10369. end;
  10370. SystemMessage.URL := '';
  10371. SystemMessage.AutoCloseTime := 0;
  10372. if AnsiSameText(Contents.Strings[0], 'RDOA') or AnsiSameText(Contents.Strings[0], 'CONFIRM_NOTIFY') then
  10373. begin
  10374. SystemMessage.URL := Contents.Strings[4];
  10375. if Contents.Strings[6] = '1' then
  10376. begin
  10377. LoginName := RealICQClient.LoginName;
  10378. if Pos('-', RealICQClient.LoginName) > 0 then
  10379. LoginName := Copy(RealICQClient.LoginName, Pos('-', RealICQClient.LoginName) + 1, Length(RealICQClient.LoginName));
  10380. SystemMessage.URL := SystemMessage.URL + Contents.Strings[5];
  10381. end;
  10382. SystemMessage.Title := Contents.Strings[7];
  10383. end
  10384. else
  10385. begin
  10386. if Contents.Count >= 7 then
  10387. SystemMessage.URL := Contents.Strings[3];
  10388. try
  10389. if Contents.Count >= 5 then
  10390. SystemMessage.Width := StrToInt(Contents.Strings[4]);
  10391. if Contents.Count >= 6 then
  10392. SystemMessage.Height := StrToInt(Contents.Strings[5]);
  10393. if Contents.Count >= 7 then
  10394. begin
  10395. if Contents.Strings[6] = '1' then
  10396. begin
  10397. TimerForShowSystemNotices.Enabled := False;
  10398. RealICQClient.SendGetNewInformation(1);
  10399. end
  10400. else
  10401. begin
  10402. RealICQClient.SendGetNewInformation(0);
  10403. end;
  10404. end
  10405. else
  10406. begin
  10407. RealICQClient.SendGetNewInformation(0);
  10408. end;
  10409. if Contents.Count >= 8 then
  10410. SystemMessage.Title := Contents.Strings[7];
  10411. except
  10412. end;
  10413. end;
  10414. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10415. end;
  10416. if AnsiSameText(Contents.Strings[0], 'LXUMC') then
  10417. begin
  10418. // if not MainForm.ShowFileTransCompleted then Exit;
  10419. SystemMessage := TRealICQSystemMessage.Create;
  10420. SystemMessage.MessageID := GetTickCount;
  10421. SystemMessage.MessageType := mtBroadcast;
  10422. SystemMessage.AutoOpenWindow := True;
  10423. SystemMessage.Position := mpRightBottom;
  10424. SystemMessage.Left := 0;
  10425. SystemMessage.Top := 0;
  10426. SystemMessage.Width := 258;
  10427. SystemMessage.Height := 148;
  10428. SystemMessage.Delay := 0;
  10429. SystemMessage.MaxShowTimes := 0;
  10430. SystemMessage.Title := '系统提醒';
  10431. SystemMessage.Content := Contents.Strings[2];
  10432. SystemMessage.URL := '';
  10433. SystemMessage.AutoCloseTime := 0;
  10434. if Contents.Count > 3 then
  10435. SystemMessage.Title := Contents.Strings[3];
  10436. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10437. end;
  10438. if AnsiSameText(Contents.Strings[0], 'EMAIL') then
  10439. begin
  10440. if AnsiSameText(Contents.Strings[1], '0') then
  10441. begin
  10442. spbEmail.Caption := '(' + Contents.Strings[2] + ')';
  10443. end
  10444. else if AnsiSameText(Contents.Strings[1], '1') then
  10445. begin
  10446. spbEmail.Caption := '(' + IntToStr(StrToInt(ReplaceStr(ReplaceStr(spbEmail.Caption, '(', ''), ')', '')) + 1) + ')';
  10447. SystemMessage := TRealICQSystemMessage.Create;
  10448. SystemMessage.MessageID := GetTickCount;
  10449. SystemMessage.MessageType := mtBroadcast;
  10450. SystemMessage.AutoOpenWindow := True;
  10451. SystemMessage.Position := mpRightBottom;
  10452. SystemMessage.Left := 0;
  10453. SystemMessage.Top := 0;
  10454. SystemMessage.Width := 258;
  10455. SystemMessage.Height := 148;
  10456. SystemMessage.Delay := 0;
  10457. SystemMessage.MaxShowTimes := 0;
  10458. SystemMessage.Title := '系统提醒';
  10459. if AnsiSameText(Copy(Contents.Strings[3], 1, 7), 'http://') then
  10460. begin
  10461. SystemMessage.Content := '您从 <a herf="' + Contents.Strings[3] + '">' + Contents.Strings[2] + '</a> 处收到一封新邮件!';
  10462. SystemMessage.URL := Contents.Strings[3];
  10463. end
  10464. else
  10465. begin
  10466. SystemMessage.Content := '您从 ' + Contents.Strings[3] + ' 处收到一封新邮件!';
  10467. SystemMessage.URL := '';
  10468. end;
  10469. SystemMessage.AutoCloseTime := 15;
  10470. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  10471. end;
  10472. end;
  10473. end;
  10474. finally
  10475. FreeAndNil(Contents);
  10476. end;
  10477. end;
  10478. //------------------------------------------------------------------------------
  10479. procedure TMainForm.RealICQClientReceivedMessage(Sender: TObject; RealICQMessage: TRealICQMessage);
  10480. var
  10481. ItemIndex: Integer;
  10482. RealICQContacterListItem: TRealICQContacterListItem;
  10483. RealICQUser: TRealICQUser;
  10484. ALoginName: string;
  10485. begin
  10486. ShowRealICQMessage(RealICQMessage, False, Sender as TRealICQClient);
  10487. {$region '更新“最近联系人列表”中的数据'}
  10488. if Sender = RealICQClient then
  10489. begin
  10490. if not AnsiSameText(RealICQMessage.Sender, RealICQClient.LoginName) then
  10491. ALoginName := RealICQMessage.Sender
  10492. else
  10493. ALoginName := RealICQMessage.Receiver;
  10494. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10495. if RealICQUser <> nil then
  10496. begin
  10497. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10498. if ItemIndex = -1 then
  10499. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10500. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10501. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10502. TUsersService.GetUsersService.UpdateListItem(FLVLatests, RealICQContacterListItem, RealICQUser);
  10503. RealICQContacterListItem.MoveToTop;
  10504. end;
  10505. end;
  10506. {$endregion}
  10507. end;
  10508. //------------------------------------------------------------------------------
  10509. procedure TMainForm.RealICQClientReceivedOfflineAutoResponseSet(Sender: TObject; AEnabled: Boolean; AText: string);
  10510. begin
  10511. actOfflieAutoResponse.Checked := AEnabled;
  10512. if OptionsForm <> nil then
  10513. OptionsForm.GetSets;
  10514. end;
  10515. //------------------------------------------------------------------------------
  10516. procedure TMainForm.RealICQClientReceivedOfflineFile(Sender: TObject; ASender, AFileName: string; AFileSize: Int64; ASendDateTime: TDateTime);
  10517. var
  10518. AShowActive: Boolean;
  10519. TalkingForm: TTalkingForm;
  10520. iWaitTimes: Integer;
  10521. ALoginName: string;
  10522. RealICQUser: TRealICQUser;
  10523. ItemIndex: Integer;
  10524. RealICQContacterListItem: TRealICQContacterListItem;
  10525. begin
  10526. if AnsiSameText(ASender, RealICQClient.Me.LoginName) then
  10527. Exit;
  10528. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  10529. TalkingForm := GetTalkingForm(ASender, RealICQClient);
  10530. if TalkingForm = nil then
  10531. begin
  10532. TalkingForm := OpenTalkingForm(ASender, not AShowActive, RealICQClient);
  10533. end;
  10534. iWaitTimes := 0;
  10535. while not TalkingForm.CanWriteMessage do
  10536. begin
  10537. Application.ProcessMessages;
  10538. Inc(iWaitTimes);
  10539. if iWaitTimes > 1000 then
  10540. break;
  10541. Sleep(10);
  10542. end;
  10543. if (GetForegroundWindow <> TalkingForm.Handle) then
  10544. begin
  10545. FlashWindow(TalkingForm.Handle, True);
  10546. if PlaySoundOnGetMessage then
  10547. PlayEventSound(FMessageEventSound);
  10548. end;
  10549. TFileTransmitAdapter.Receive(TalkingForm, AFileName, 0, ASender, '', ASendDateTime, Self.RealICQClient, AFileSize);
  10550. {$region '更新“最近联系人列表”中的数据'}
  10551. if Sender = RealICQClient then
  10552. begin
  10553. ALoginName := ASender;
  10554. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  10555. if RealICQUser <> nil then
  10556. begin
  10557. ItemIndex := FLVLatests.Items.IndexOf(ALoginName);
  10558. if ItemIndex = -1 then
  10559. ItemIndex := FLVLatests.Items.Add(ALoginName);
  10560. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10561. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  10562. TUsersService.GetUsersService.UpdateListItem(FLVLatests, RealICQContacterListItem, RealICQUser);
  10563. RealICQContacterListItem.MoveToTop;
  10564. end;
  10565. end;
  10566. {$endregion}
  10567. end;
  10568. //------------------------------------------------------------------------------
  10569. procedure TMainForm.RealICQClientReceivedServerList(Sender: TObject; AServerList: string);
  10570. var
  10571. ServerList: TStringList;
  10572. iLoop, chrPos: Integer;
  10573. MenuItem: TMenuItem;
  10574. ServerInfo: TServerInfo;
  10575. //config: TConditionConfig;
  10576. begin
  10577. //config := TConditionConfig.GetConfig;
  10578. while ppServerList.Items.Count > 0 do
  10579. ppServerList.Items.Delete(0);
  10580. ServerList := SplitString(AServerList, Chr(10));
  10581. try
  10582. iLoop := 0;
  10583. while iLoop < ServerList.Count - 1 do
  10584. begin
  10585. ServerInfo := TServerInfo.Create;
  10586. ServerInfo.ServerId := ServerList[iLoop];
  10587. Inc(iLoop);
  10588. ServerInfo.ServerName := ServerList[iLoop];
  10589. Inc(iLoop);
  10590. // if config.OtherServersDisable and not (UpperCase(ServerInfo.ServerId) = UpperCase(RealICQClient.ServerID)) then
  10591. // begin
  10592. // Continue;
  10593. // end;
  10594. MenuItem := TMenuItem.Create(ppServerList);
  10595. MenuItem.AutoHotkeys := maManual;
  10596. MenuItem.AutoLineReduction := maManual;
  10597. MenuItem.Caption := '&' + ServerInfo.ServerName;
  10598. MenuItem.Hint := ServerInfo.ServerId;
  10599. MenuItem.OnClick := miChangeServerClick;
  10600. MenuItem.Tag := iLoop;
  10601. if UpperCase(ServerInfo.ServerId) = UpperCase(RealICQClient.ServerID) then
  10602. begin
  10603. edServerList.Text := ServerInfo.ServerName;
  10604. ImgLoadingMoreBranchs.Visible := True;
  10605. ScrollBoxMoreUser.Visible := False;
  10606. //RealICQClient.SendGetMoreBranch(ServerInfo.ServerId);
  10607. RealICQClient.SendGetBranchs(ServerInfo.ServerId, 0);
  10608. FCurrentServerID := ServerInfo.ServerId;
  10609. //Todo: 调用Online.exe
  10610. if FileExists(ExtractFilePath(Application.ExeName) + 'Online.exe') then
  10611. TCheckRunProcessThread.Create('Online', ExtractFilePath(Application.ExeName) + 'Online.exe')
  10612. //else
  10613. //Self.PostUpdateLog;
  10614. end;
  10615. FServerInfoList.AddObject(ServerInfo.ServerId, ServerInfo);
  10616. ppServerList.Items.Add(MenuItem);
  10617. end;
  10618. finally
  10619. FreeAndNil(ServerList);
  10620. end;
  10621. end;
  10622. //------------------------------------------------------------------------------
  10623. procedure TMainForm.ShowRealICQTeamMessage(RealICQTeamMessage: TRealICQTeamMessage; ShowSendFailed: Boolean);
  10624. var
  10625. nTeamID: string;
  10626. iIndex, ItemIndex: Integer;
  10627. MessageList: TList;
  10628. TalkingForm: TTalkingForm;
  10629. NotReadTeamMessage: TNotReadTeamMessage;
  10630. NeedAddToNotReadMessages: Boolean;
  10631. ListItem: TRealICQContacterListItem;
  10632. ASave: Boolean;
  10633. begin
  10634. try
  10635. ASave := AutoSaveMessage;
  10636. if Copy(RealICQTeamMessage.MessageStr, 1, 11) = '<TeamShare>' then
  10637. begin
  10638. if Copy(RealICQTeamMessage.MessageStr, Length(RealICQTeamMessage.MessageStr) - 11, 12) = '</TeamShare>' then
  10639. begin
  10640. ASave := False;
  10641. end;
  10642. end;
  10643. if ASave then
  10644. begin
  10645. FDBHistory.SaveMessage(RealICQTeamMessage.TeamID, RealICQTeamMessage.Sender, RealICQClient.LoginName, RealICQTeamMessage.SendDateTime, RealICQTeamMessage.FontStr, RealICQTeamMessage.MessageStr, RealICQTeamMessage.IsEncryMessage);
  10646. if RealICQTeamMessage.IsEncryMessage then
  10647. RealICQTeamMessage.ID := FDBHistory.GetMaxMessageId;
  10648. end;
  10649. except
  10650. end;
  10651. nTeamID := RealICQTeamMessage.TeamID;
  10652. TalkingForm := GetTeamTalkingForm(nTeamID);
  10653. if TalkingForm = nil then
  10654. NeedAddToNotReadMessages := True
  10655. else
  10656. NeedAddToNotReadMessages := not TalkingForm.CanWriteMessage;
  10657. if NeedAddToNotReadMessages then
  10658. begin
  10659. NotReadTeamMessage := TNotReadTeamMessage.Create;
  10660. NotReadTeamMessage.FRealICQTeamMessage := RealICQTeamMessage;
  10661. NotReadTeamMessage.FShowSendFailed := ShowSendFailed;
  10662. iIndex := FNotReadMessages.IndexOf(TeamMessageID + nTeamID);
  10663. if iIndex >= 0 then
  10664. begin
  10665. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  10666. MessageList.Add(NotReadTeamMessage);
  10667. end
  10668. else
  10669. begin
  10670. {$region '跳动头像'}
  10671. ItemIndex := FLVTeams.Items.IndexOf(nTeamID);
  10672. if ItemIndex >= 0 then
  10673. begin
  10674. ListItem := FLVTeams.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  10675. if FlashImageOnGetMessage then
  10676. ListItem.Flash(fsJump);
  10677. end;
  10678. {$endregion}
  10679. MessageList := TList.Create;
  10680. MessageList.Add(NotReadTeamMessage);
  10681. FNotReadMessages.AddObject(TeamMessageID + nTeamID, MessageList);
  10682. TimerForFlashTrayIcon.Enabled := True;
  10683. if PlaySoundOnGetMessage then
  10684. PlayEventSound(FMessageEventSound);
  10685. end;
  10686. if MessageBoxForm <> nil then
  10687. begin
  10688. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  10689. FlashWindow(MessageBoxForm.Handle, True);
  10690. MessageBoxForm.ShowMessage(RealICQTeamMessage.Sender, MTTeam);
  10691. Exit;
  10692. end
  10693. else if (not TimerForFlashTrayIcon.Enabled) then
  10694. TimerForFlashTrayIcon.Enabled := True;
  10695. NotReadMessageBoxForm.ShowNotReadMessage;
  10696. NotReadMessageBoxForm.Height := 0;
  10697. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10698. end
  10699. else
  10700. begin
  10701. if (GetForegroundWindow <> TalkingForm.Handle) then
  10702. begin
  10703. FlashWindow(TalkingForm.Handle, True);
  10704. if PlaySoundOnGetMessage then
  10705. PlayEventSound(FMessageEventSound);
  10706. end;
  10707. TalkingForm.ShowTeamMessage(RealICQTeamMessage, ShowSendFailed);
  10708. end;
  10709. end;
  10710. procedure TMainForm.RealICQClientReceivedSMS(Sender: TObject; ASMSSender, ASMSContent: string; ASMSDateTime: TDateTime);
  10711. var
  10712. NotReadSMSMessage: TNotReadSMSMessage;
  10713. SMSForm: TSMSForm;
  10714. ASender: string;
  10715. iLoop: Integer;
  10716. ARealICQUser: TRealICQUser;
  10717. NeedAddToNotReadMessages: Boolean;
  10718. MessageList: TList;
  10719. iIndex: Integer;
  10720. AUsers: TStringList;
  10721. begin
  10722. ASender := '';
  10723. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  10724. try
  10725. for iLoop := 0 to AUsers.Count - 1 do
  10726. begin
  10727. ARealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  10728. if Length(Trim(ARealICQUser.Mobile)) < 11 then
  10729. continue;
  10730. if Pos(ARealICQUser.Mobile, ASMSSender) > 0 then
  10731. begin
  10732. ASender := ARealICQUser.LoginName;
  10733. Break;
  10734. end;
  10735. if Length(ARealICQUser.Mobile) < 10 then
  10736. begin
  10737. if AnsiSameStr('1060578' + ARealICQUser.Mobile, ASMSSender) then
  10738. begin
  10739. ASender := ARealICQUser.LoginName;
  10740. Break;
  10741. end;
  10742. end;
  10743. end;
  10744. // if ASender = '' then
  10745. // ASender := ASMSSender;
  10746. finally
  10747. FreeAndNil(AUsers);
  10748. end;
  10749. SMSForm := GetSMSForm(ASender);
  10750. NotReadSMSMessage := TNotReadSMSMessage.Create;
  10751. NotReadSMSMessage.FSMSSender := ASMSSender;
  10752. NotReadSMSMessage.FSMSContent := ASMSContent;
  10753. NotReadSMSMessage.FSMSDateTime := ASMSDateTime;
  10754. iIndex := FNotReadMessages.IndexOf(SMSMessageID + ASender);
  10755. if iIndex >= 0 then
  10756. begin
  10757. MessageList := FNotReadMessages.Objects[iIndex] as TList;
  10758. MessageList.Add(NotReadSMSMessage);
  10759. end
  10760. else
  10761. begin
  10762. MessageList := TList.Create;
  10763. MessageList.Add(NotReadSMSMessage);
  10764. FNotReadMessages.AddObject(SMSMessageID + ASender, MessageList);
  10765. TimerForFlashTrayIcon.Enabled := True;
  10766. if PlaySoundOnGetMessage then
  10767. PlayEventSound(FMessageEventSound);
  10768. end;
  10769. if SMSForm = nil then
  10770. NeedAddToNotReadMessages := True
  10771. else
  10772. NeedAddToNotReadMessages := not SMSForm.CanWriteMessage;
  10773. if NeedAddToNotReadMessages then
  10774. begin
  10775. TimerForFlashTrayIcon.Enabled := True;
  10776. if PlaySoundOnGetMessage then
  10777. PlayEventSound(FMessageEventSound);
  10778. if MessageBoxForm <> nil then
  10779. begin
  10780. if (GetForegroundWindow <> MessageBoxForm.Handle) then
  10781. FlashWindow(MessageBoxForm.Handle, True);
  10782. MessageBoxForm.ShowMessage(ASender, MTSMS);
  10783. Exit;
  10784. end
  10785. else if (not TimerForFlashTrayIcon.Enabled) then
  10786. TimerForFlashTrayIcon.Enabled := True;
  10787. NotReadMessageBoxForm.ShowNotReadMessage;
  10788. NotReadMessageBoxForm.Height := 0;
  10789. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10790. end
  10791. else
  10792. begin
  10793. if (GetForegroundWindow <> SMSForm.Handle) then
  10794. begin
  10795. FlashWindow(SMSForm.Handle, True);
  10796. if PlaySoundOnGetMessage then
  10797. PlayEventSound(FMessageEventSound);
  10798. end;
  10799. //显示收到的短消息
  10800. SMSForm.LoadNotReadSMSMessages;
  10801. end;
  10802. end;
  10803. //------------------------------------------------------------------------------
  10804. procedure TMainForm.RealICQClientReceivedSystemMessage(Sender: TObject; ASystemMessage: TRealICQSystemMessage);
  10805. begin
  10806. if (ASystemMessage.MaxShowTimes = 0) or ((GetSystemMessageCounter(ASystemMessage.MessageID) < ASystemMessage.MaxShowTimes) and (ASystemMessage.MaxShowTimes > 0)) then
  10807. begin
  10808. try
  10809. FDBHistory.SaveSystemMessage(ASystemMessage.MessageID, ASystemMessage.MessageType, ASystemMessage.Position, ASystemMessage.Left, ASystemMessage.Top, ASystemMessage.Width, ASystemMessage.Height, ASystemMessage.Title, ASystemMessage.Content, ASystemMessage.URL, ASystemMessage.AutoCloseTime);
  10810. except
  10811. end;
  10812. FSystemMessages.Insert(0, ASystemMessage);
  10813. if TimerForShowSystemMessage.Enabled = False then
  10814. TimerForShowSystemMessage.Enabled := True;
  10815. end;
  10816. end;
  10817. //------------------------------------------------------------------------------
  10818. procedure TMainForm.ShowSystemMessage(ASystemMessage: TRealICQSystemMessage);
  10819. begin
  10820. try
  10821. OpenSystemMessageForm(IntToStr(ASystemMessage.MessageID), ASystemMessage.MessageType, ASystemMessage.Position, ASystemMessage.Left, ASystemMessage.Top, ASystemMessage.Width, ASystemMessage.Height, ASystemMessage.Title, ASystemMessage.Content, ASystemMessage.URL, ASystemMessage.AutoCloseTime);
  10822. IncSystemMessageCounter(ASystemMessage.MessageID);
  10823. finally
  10824. FreeAndNil(ASystemMessage);
  10825. end;
  10826. end;
  10827. //------------------------------------------------------------------------------
  10828. procedure TMainForm.TimerForShowSystemMessageTimer(Sender: TObject);
  10829. var
  10830. iLoop: Integer;
  10831. ASystemMessage: TRealICQSystemMessage;
  10832. begin
  10833. if FSystemMessages.Count = 0 then
  10834. TimerForShowSystemMessage.Enabled := False
  10835. else
  10836. begin
  10837. for iLoop := FSystemMessages.Count - 1 downto 0 do
  10838. begin
  10839. ASystemMessage := FSystemMessages[iLoop];
  10840. ASystemMessage.Delay := ASystemMessage.Delay - 0.2;
  10841. if ASystemMessage.Delay <= 0 then
  10842. begin
  10843. FSystemMessages.Delete(iLoop);
  10844. if ASystemMessage.AutoOpenWindow then
  10845. begin
  10846. ShowSystemMessage(ASystemMessage);
  10847. end
  10848. else
  10849. begin
  10850. FNotReadMessages.AddObject(SystemMessageID + IntToStr(ASystemMessage.MessageID), ASystemMessage);
  10851. TimerForFlashTrayIcon.Enabled := True;
  10852. if PlaySoundOnGetSystemMessage then
  10853. PlayEventSound(FSystemMessageEventSound);
  10854. NotReadMessageBoxForm.ShowNotReadMessage;
  10855. NotReadMessageBoxForm.Height := 0;
  10856. NotReadMessageBoxForm.Top := Screen.WorkAreaHeight - NotReadMessageBoxForm.Height;
  10857. end;
  10858. end;
  10859. end;
  10860. if (self.MessageBoxForm <> nil) then
  10861. MessageBoxForm.ShowSystemMessages(FSystemMessages);
  10862. end;
  10863. end;
  10864. //------------------------------------------------------------------------------
  10865. procedure TMainForm.RealICQClientReceivedTeamMessage(Sender: TObject; RealICQTeamMessage: TRealICQTeamMessage);
  10866. begin
  10867. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  10868. end;
  10869. procedure TMainForm.RealICQClientReceivedVideoImage(Sender: TObject; ALoginName: string; ABitmap: TBitmap);
  10870. begin
  10871. end;
  10872. {
  10873. //------------------------------------------------------------------------------
  10874. procedure TMainForm.UpdateFriendNode(Friend: TRealICQEmployee; RealICQUser: TRealICQUser; ANeedFlash: Boolean);
  10875. var
  10876. GIFImage: TGIFImage;
  10877. jo: IsuperObject;
  10878. ARemarkTel, ARemarkMobile, ARemark: string;
  10879. begin
  10880. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10881. if jo <> nil then
  10882. begin
  10883. ARemark := jo.S['Remark'];
  10884. ARemarkTel := jo.S['Phone'];
  10885. ARemarkMobile := jo.S['Mobile'];
  10886. end;
  10887. Friend.HasCamera := RealICQUser.InstalledCamera;
  10888. Friend.Watchword := RealICQUser.Watchword;
  10889. Friend.LeaveMessage := RealICQUser.LeaveMessage;
  10890. Friend.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10891. Friend.TelephoneHint := '';
  10892. if Length(Trim(ARemarkTel)) > 0 then
  10893. begin
  10894. Friend.TelephoneHint := Friend.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10895. end;
  10896. if Length(Trim(RealICQUser.Tel)) > 0 then
  10897. begin
  10898. if Length(Trim(Friend.TelephoneHint)) > 0 then
  10899. Friend.TelephoneHint := Friend.TelephoneHint + ' ';
  10900. Friend.TelephoneHint := Friend.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10901. end;
  10902. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10903. begin
  10904. if Length(Trim(Friend.TelephoneHint)) > 0 then
  10905. Friend.TelephoneHint := Friend.TelephoneHint + ' ';
  10906. Friend.TelephoneHint := Friend.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10907. end;
  10908. Friend.HasMobilePhone := False;
  10909. Friend.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  10910. Friend.HasSMS := (Length(Trim(RealICQUser.Mobile)) > 0);
  10911. if not Friend.HasTelephone then
  10912. Friend.HasTelephone := Friend.HasSMS;
  10913. Friend.Mobile := Trim(RealICQUser.Mobile);
  10914. Friend.Tel := Trim(RealICQUser.Tel);
  10915. if Length(Trim(ARemarkMobile)) > 0 then
  10916. Friend.MobilePhoneHint := Trim(ARemarkMobile)
  10917. else
  10918. Friend.MobilePhoneHint := Trim(RealICQUser.Mobile);
  10919. Friend.HeadImageHint := '单击显示联系人卡片';
  10920. Friend.TelephoneHint := Friend.TelephoneHint;
  10921. Friend.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  10922. Friend.SMSHint := Trim(Friend.MobilePhoneHint) + '(双击发送手机短信息)';
  10923. Friend.CameraHint := '双击发送视频对话邀请';
  10924. if (RealICQClient.EnableSecretLevel) and (RealICQUser.Secret = slAllCannotSee) then
  10925. begin
  10926. Friend.TelephoneHint := '*';
  10927. Friend.MobilePhoneHint := '*';
  10928. Friend.SMSHint := '*';
  10929. end;
  10930. if FileExists(RealICQUser.HeadImageFile) then
  10931. begin
  10932. try
  10933. if (RealICQUser.HeadImageFileType = htGIF) then
  10934. begin
  10935. GIFImage := TGIFImage.Create;
  10936. GIFImage.Animate := False;
  10937. try
  10938. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  10939. Friend.HeadImagePicture.Bitmap.Assign(GIFImage);
  10940. finally
  10941. GIFImage.Free;
  10942. end;
  10943. end
  10944. else
  10945. Friend.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  10946. except
  10947. Friend.HeadImagePicture.Graphic := nil;
  10948. end;
  10949. end
  10950. else
  10951. Friend.HeadImagePicture.Graphic := nil;
  10952. Friend.DisplayName := RealICQUser.DisplayName;
  10953. Friend.LoginState := RealICQUser.LoginState;
  10954. Friend.Data := RealICQUser;
  10955. if ANeedFlash then
  10956. Friend.Update;
  10957. end;
  10958. //------------------------------------------------------------------------------
  10959. procedure TMainForm.UpdateEmployeeNode(Employee: TRealICQEmployee; RealICQUser: TRealICQUser; ANeedFlash: Boolean);
  10960. var
  10961. GIFImage: TGIFImage;
  10962. jo: ISuperObject;
  10963. ARemarkTel, ARemarkMobile, ARemark: string;
  10964. begin
  10965. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  10966. if jo <> nil then
  10967. begin
  10968. ARemark := jo.S['Remark'];
  10969. ARemarkTel := jo.S['Phone'];
  10970. ARemarkMobile := jo.S['Mobile'];
  10971. end;
  10972. Employee.HasCamera := RealICQUser.InstalledCamera;
  10973. Employee.Watchword := RealICQUser.Watchword;
  10974. Employee.LeaveMessage := RealICQUser.LeaveMessage;
  10975. Employee.HasNewSNS := ShowSNS and RealICQUser.HasNewSNSUpdate;
  10976. Employee.NewSNSHint := '个人空间最近有更新,点击查看';
  10977. Employee.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  10978. Employee.TelephoneHint := '';
  10979. if Length(Trim(ARemarkTel)) > 0 then
  10980. begin
  10981. Employee.TelephoneHint := Employee.TelephoneHint + '备注:' + Trim(ARemarkTel);
  10982. end;
  10983. if Length(Trim(RealICQUser.Tel)) > 0 then
  10984. begin
  10985. if Length(Trim(Employee.TelephoneHint)) > 0 then
  10986. Employee.TelephoneHint := Employee.TelephoneHint + ' ';
  10987. Employee.TelephoneHint := Employee.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  10988. end;
  10989. if Length(Trim(RealICQUser.Mobile)) > 0 then
  10990. begin
  10991. if Length(Trim(Employee.TelephoneHint)) > 0 then
  10992. Employee.TelephoneHint := Employee.TelephoneHint + ' ';
  10993. Employee.TelephoneHint := Employee.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  10994. end;
  10995. Employee.HasMobilePhone := False;
  10996. Employee.HasSMS := (Length(Trim(RealICQUser.Mobile)) > 0);
  10997. Employee.Tel := Trim(RealICQUser.Tel);
  10998. Employee.Mobile := Trim(RealICQUser.Mobile);
  10999. if Length(Trim(ARemarkMobile)) > 0 then
  11000. Employee.MobilePhoneHint := Trim(ARemarkMobile)
  11001. else
  11002. Employee.MobilePhoneHint := Trim(RealICQUser.Mobile);
  11003. Employee.HeadImageHint := '单击显示联系人卡片';
  11004. Employee.TelephoneHint := Trim(Employee.TelephoneHint);
  11005. Employee.AddFriendHint := '双击添加好友';
  11006. Employee.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  11007. Employee.SMSHint := Employee.MobilePhoneHint + '(双击发送手机短信息)';
  11008. Employee.CameraHint := '双击发送视频对话邀请';
  11009. if (RealICQClient.EnableSecretLevel) and (RealICQUser.Secret = slAllCannotSee) and (Employee.LoginName <> MainForm.RealICQClient.Me.LoginName) then
  11010. begin
  11011. Employee.TelephoneHint := '*';
  11012. Employee.MobilePhoneHint := '*';
  11013. Employee.SMSHint := '*';
  11014. end;
  11015. if (RealICQClient.EnableSecretLevel) and (RealICQUser.Secret = slOnlyFriendCanSee) and not (TUsersService.GetUsersService.IsWorkmateOrFriend(Employee.LoginName)) then
  11016. begin
  11017. Employee.TelephoneHint := '*';
  11018. Employee.MobilePhoneHint := '*';
  11019. Employee.SMSHint := '*';
  11020. end;
  11021. if FileExists(RealICQUser.HeadImageFile) then
  11022. begin
  11023. try
  11024. if (RealICQUser.HeadImageFileType = htGIF) then
  11025. begin
  11026. GIFImage := TGIFImage.Create;
  11027. GIFImage.Animate := False;
  11028. try
  11029. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  11030. Employee.HeadImagePicture.Bitmap.Assign(GIFImage);
  11031. finally
  11032. GIFImage.Free;
  11033. end;
  11034. end
  11035. else
  11036. Employee.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  11037. except
  11038. Employee.HeadImagePicture.Graphic := nil;
  11039. end;
  11040. end
  11041. else
  11042. Employee.HeadImagePicture.Graphic := nil;
  11043. Employee.DisplayName := RealICQUser.DisplayName;
  11044. Employee.LoginState := RealICQUser.LoginState;
  11045. Employee.Data := RealICQUser;
  11046. if (FMeUserType = lbutCompany) and (TLBUserViewService.GetService.GetUserType(RealICQUser.LoginName) = lbutCompany) then
  11047. begin
  11048. Employee.TelephoneHint := '*';
  11049. Employee.MobilePhoneHint := '*';
  11050. Employee.SMSHint := '*';
  11051. end;
  11052. if ANeedFlash then
  11053. Employee.Update;
  11054. end;
  11055. //------------------------------------------------------------------------------
  11056. procedure TMainForm.BindUserDataToItem(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; ANeedFlash: Boolean = True);
  11057. var
  11058. GIFImage: TGIFImage;
  11059. jo: ISuperObject;
  11060. ARemarkTel, ARemarkMobile, ARemark: string;
  11061. begin
  11062. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  11063. if jo <> nil then
  11064. begin
  11065. ARemark := jo.S['Remark'];
  11066. ARemarkTel := jo.S['Phone'];
  11067. ARemarkMobile := jo.S['Mobile'];
  11068. end;
  11069. RealICQContacterListItem.HasCamera := RealICQUser.InstalledCamera;
  11070. RealICQContacterListItem.Watchword := RealICQUser.Watchword;
  11071. RealICQContacterListItem.LeaveMessage := RealICQUser.LeaveMessage;
  11072. RealICQContacterListItem.Branch := RealICQUser.Branch;
  11073. RealICQContacterListItem.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  11074. RealICQContacterListItem.TelephoneHint := '';
  11075. if Length(Trim(ARemarkTel)) > 0 then
  11076. begin
  11077. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '备注:' + Trim(ARemarkTel);
  11078. end;
  11079. if Length(Trim(RealICQUser.Tel)) > 0 then
  11080. begin
  11081. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  11082. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  11083. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  11084. end;
  11085. if Length(Trim(RealICQUser.Mobile)) > 0 then
  11086. begin
  11087. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  11088. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  11089. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  11090. end;
  11091. RealICQContacterListItem.HasMobilePhone := (Length(Trim(RealICQUser.Mobile)) > 0) or (Length(Trim(ARemarkMobile)) > 0);
  11092. RealICQContacterListItem.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  11093. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasMobilePhone;
  11094. RealICQContacterListItem.HeadImageHint := '单击显示联系人卡片';
  11095. if Length(Trim(ARemarkMobile)) > 0 then
  11096. RealICQContacterListItem.MobilePhoneHint := Trim(ARemarkMobile)
  11097. else
  11098. RealICQContacterListItem.MobilePhoneHint := Trim(RealICQUser.Mobile);
  11099. RealICQContacterListItem.Mobile := Trim(RealICQUser.Mobile);
  11100. RealICQContacterListItem.Tel := Trim(RealICQUser.Tel);
  11101. RealICQContacterListItem.HasMobilePhone := False;
  11102. RealICQContacterListItem.MobilePhoneHint := RealICQContacterListItem.MobilePhoneHint + '(双击发送手机短信息)';
  11103. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint;
  11104. RealICQContacterListItem.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  11105. RealICQContacterListItem.SMSHint := RealICQContacterListItem.MobilePhoneHint;
  11106. RealICQContacterListItem.CameraHint := '双击发送视频对话邀请';
  11107. RealICQContacterListItem.HasTelephone := RealICQContacterListItem.HasTelephone and RealICQContacterListItem.ListView.ShowTelButton;
  11108. RealICQContacterListItem.HasMobilePhone := RealICQContacterListItem.HasMobilePhone and RealICQContacterListItem.ListView.ShowMobileButton;
  11109. RealICQContacterListItem.HasEmail := RealICQContacterListItem.HasEmail and RealICQContacterListItem.ListView.ShowEmailButton;
  11110. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasSMS and RealICQContacterListItem.ListView.ShowSMSButton;
  11111. if FileExists(RealICQUser.HeadImageFile) then
  11112. begin
  11113. try
  11114. if (RealICQUser.HeadImageFileType = htGIF) then
  11115. begin
  11116. GIFImage := TGIFImage.Create;
  11117. GIFImage.Animate := False;
  11118. try
  11119. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  11120. RealICQContacterListItem.HeadImagePicture.Bitmap.Assign(GIFImage);
  11121. finally
  11122. GIFImage.Free;
  11123. end;
  11124. end
  11125. else
  11126. RealICQContacterListItem.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  11127. except
  11128. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11129. end;
  11130. end
  11131. else
  11132. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11133. RealICQContacterListItem.DisplayName := RealICQUser.DisplayName;
  11134. RealICQContacterListItem.LoginState := RealICQUser.LoginState;
  11135. RealICQContacterListItem.Data := RealICQUser;
  11136. if ANeedFlash then
  11137. RealICQContacterListItem.ReDrawItem;
  11138. end;
  11139. procedure TMainForm.BindUserDataToItemForGroup(RealICQContacterListItem: TRealICQContacterListItem; RealICQUser: TRealICQUser; AGroupAlias: string; ANeedFlash: Boolean);
  11140. var
  11141. GIFImage: TGIFImage;
  11142. jo: IsuperObject;
  11143. ARemarkTel, ARemarkMobile, ARemark: string;
  11144. begin
  11145. jo := TUserRemarkService.GetService.GetUserRemark(RealICQUser.LoginName);
  11146. if jo <> nil then
  11147. begin
  11148. ARemark := jo.S['Remark'];
  11149. ARemarkTel := jo.S['Phone'];
  11150. ARemarkMobile := jo.S['Mobile'];
  11151. end;
  11152. RealICQContacterListItem.HasCamera := RealICQUser.InstalledCamera;
  11153. RealICQContacterListItem.Watchword := RealICQUser.Watchword;
  11154. RealICQContacterListItem.LeaveMessage := RealICQUser.LeaveMessage;
  11155. RealICQContacterListItem.Branch := RealICQUser.Branch;
  11156. RealICQContacterListItem.HasTelephone := (Length(Trim(ARemarkTel)) > 0) or (Length(Trim(RealICQUser.Tel)) > 0) or (Length(Trim(RealICQUser.Mobile)) > 0);
  11157. RealICQContacterListItem.TelephoneHint := '';
  11158. if Length(Trim(ARemarkTel)) > 0 then
  11159. begin
  11160. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '备注:' + Trim(ARemarkTel);
  11161. end;
  11162. if Length(Trim(RealICQUser.Tel)) > 0 then
  11163. begin
  11164. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  11165. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  11166. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '电话:' + Trim(RealICQUser.Tel);
  11167. end;
  11168. if Length(Trim(RealICQUser.Mobile)) > 0 then
  11169. begin
  11170. if Length(Trim(RealICQContacterListItem.TelephoneHint)) > 0 then
  11171. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + ' ';
  11172. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint + '手机:' + Trim(RealICQUser.Mobile);
  11173. end;
  11174. RealICQContacterListItem.HasMobilePhone := (Length(Trim(RealICQUser.Mobile)) > 0) or (Length(Trim(ARemarkMobile)) > 0);
  11175. RealICQContacterListItem.HasEmail := (Length(Trim(RealICQUser.Email)) > 0);
  11176. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasMobilePhone;
  11177. RealICQContacterListItem.HeadImageHint := '单击显示联系人卡片';
  11178. if Length(Trim(ARemarkMobile)) > 0 then
  11179. RealICQContacterListItem.MobilePhoneHint := Trim(ARemarkMobile)
  11180. else
  11181. RealICQContacterListItem.MobilePhoneHint := Trim(RealICQUser.Mobile);
  11182. RealICQContacterListItem.Mobile := Trim(RealICQUser.Mobile);
  11183. RealICQContacterListItem.Tel := Trim(RealICQUser.Tel);
  11184. RealICQContacterListItem.HasMobilePhone := False;
  11185. RealICQContacterListItem.MobilePhoneHint := RealICQContacterListItem.MobilePhoneHint + '(双击发送手机短信息)';
  11186. RealICQContacterListItem.TelephoneHint := RealICQContacterListItem.TelephoneHint;
  11187. RealICQContacterListItem.EmailHint := Trim(RealICQUser.Email) + '(双击发送邮件)';
  11188. RealICQContacterListItem.SMSHint := RealICQContacterListItem.MobilePhoneHint;
  11189. RealICQContacterListItem.CameraHint := '双击发送视频对话邀请';
  11190. RealICQContacterListItem.HasTelephone := RealICQContacterListItem.HasTelephone and RealICQContacterListItem.ListView.ShowTelButton;
  11191. RealICQContacterListItem.HasMobilePhone := RealICQContacterListItem.HasMobilePhone and RealICQContacterListItem.ListView.ShowMobileButton;
  11192. RealICQContacterListItem.HasEmail := RealICQContacterListItem.HasEmail and RealICQContacterListItem.ListView.ShowEmailButton;
  11193. RealICQContacterListItem.HasSMS := RealICQContacterListItem.HasSMS and RealICQContacterListItem.ListView.ShowSMSButton;
  11194. if FileExists(RealICQUser.HeadImageFile) then
  11195. begin
  11196. try
  11197. if (RealICQUser.HeadImageFileType = htGIF) then
  11198. begin
  11199. GIFImage := TGIFImage.Create;
  11200. GIFImage.Animate := False;
  11201. try
  11202. GIFImage.LoadFromFile(RealICQUser.HeadImageFile);
  11203. RealICQContacterListItem.HeadImagePicture.Bitmap.Assign(GIFImage);
  11204. finally
  11205. GIFImage.Free;
  11206. end;
  11207. end
  11208. else
  11209. RealICQContacterListItem.HeadImagePicture.LoadFromFile(RealICQUser.HeadImageFile);
  11210. except
  11211. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11212. end;
  11213. end
  11214. else
  11215. RealICQContacterListItem.HeadImagePicture.Graphic := nil;
  11216. RealICQContacterListItem.DisplayName := AGroupAlias; //RealICQUser.DisplayName;
  11217. RealICQContacterListItem.LoginState := RealICQUser.LoginState;
  11218. RealICQContacterListItem.Data := RealICQUser;
  11219. if ANeedFlash then
  11220. RealICQContacterListItem.ReDrawItem;
  11221. end;
  11222. }
  11223. //------------------------------------------------------------------------------
  11224. procedure TMainForm.btCloseTopMessageClick(Sender: TObject);
  11225. begin
  11226. pnlForTopMessage.Visible := False;
  11227. FTopSystemMessage := nil;
  11228. end;
  11229. procedure TMainForm.btCustomerDisplayNameClick(Sender: TObject);
  11230. var
  11231. Point: TPoint;
  11232. begin
  11233. Point.X := 0;
  11234. Point.Y := btCustomerDisplayName.Height + 1;
  11235. Point := btCustomerDisplayName.ClientToScreen(Point);
  11236. ppChangeCustomerState.Popup(Point.X, Point.Y);
  11237. end;
  11238. procedure TMainForm.btLoginClick(Sender: TObject);
  11239. var
  11240. ca: ICAClient;
  11241. b: Boolean;
  11242. begin
  11243. if RealICQClient.Logining then
  11244. RealICQClient.CancelLogin
  11245. else if RealICQClient.ReConnectExecuting then
  11246. RealICQClient.CancelReConnectAndLogin
  11247. else if actLoginAs.Visible and actLoginAs.Enabled and FLoginAsSavePassword then
  11248. begin
  11249. actLoginAs.Execute
  11250. end
  11251. else if RealICQClient.Logined then
  11252. begin
  11253. RealICQClient.Logout;
  11254. end
  11255. else
  11256. begin
  11257. if RealICQClient.CaEnable and RealICQClient.CALogin then
  11258. begin
  11259. b := actLoginAs.Enabled;
  11260. actLoginAs.Enabled := true;
  11261. actLoginAs.Execute;
  11262. actLoginAs.Enabled := b;
  11263. Exit;
  11264. end;
  11265. if Length(Trim(edLoginName.Text)) = 0 then
  11266. begin
  11267. MessageBox(Handle, '请输入用户名!', '提示', MB_ICONINFORMATION);
  11268. Exit;
  11269. end;
  11270. if Length(edPassword.Text) = 0 then
  11271. begin
  11272. MessageBox(Handle, '请输入密码!', '提示', MB_ICONINFORMATION);
  11273. Exit;
  11274. end;
  11275. RealICQClient.AutoLogin := FAutoLogin;
  11276. RealICQClient.Login(Trim(edLoginName.Text), edPassword.Text, FLoginState, FLeaveMessage, FSavePassword, False, False);
  11277. end;
  11278. end;
  11279. procedure TMainForm.btMainMenuClick(Sender: TObject);
  11280. var
  11281. Point: TPoint;
  11282. begin
  11283. edtSearchMoreUser.Text := '';
  11284. Point.X := 24;
  11285. Point.Y := btMainMenu.top;
  11286. Point := btMainMenu.ClientToScreen(Point);
  11287. ppMainMenu.Popup(Point.X, Point.Y - GetSystemMetrics(SM_CYMENU) * 8);
  11288. end;
  11289. procedure TMainForm.btnCALoginClick(Sender: TObject);
  11290. begin
  11291. RealICQClient.CALogin := not RealICQClient.CALogin;
  11292. // if RealICQClient.CALogin then
  11293. // begin
  11294. // ImgLstCheckStates.GetIcon(1, btnCaLogin.Icon);
  11295. //// edLoginName.Text := CA_TEXT;
  11296. // edLoginName.Enabled := False;
  11297. // edPassword.Enabled := False;
  11298. // spbChangeLoginName.Enabled := False;
  11299. // end
  11300. // else
  11301. // begin
  11302. // ImgLstCheckStates.GetIcon(0, btnCaLogin.Icon);
  11303. //// edLoginName.Text := '';
  11304. // edLoginName.Enabled := True;
  11305. // edPassword.Enabled := True;
  11306. // spbChangeLoginName.Enabled := True;
  11307. // end;
  11308. SetLoginStateControlState;
  11309. end;
  11310. //------------------------------------------------------------------------------
  11311. procedure TMainForm.cbxURLInputerDropDown(Sender: TObject);
  11312. var
  11313. iLoop: Integer;
  11314. Items: TStringList;
  11315. begin
  11316. Items := TStringList.Create;
  11317. try
  11318. GetIEHistory(Items);
  11319. cbxURLInputer.ItemsEx.Clear;
  11320. for iLoop := 0 to Items.Count - 1 do
  11321. begin
  11322. with cbxURLInputer.ItemsEx.Add do
  11323. begin
  11324. Caption := Items.Strings[iLoop];
  11325. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  11326. ImageIndex := 2
  11327. else if Copy(Caption, 1, 4) = 'ftp:' then
  11328. ImageIndex := 1
  11329. else
  11330. ImageIndex := 0;
  11331. end;
  11332. end;
  11333. finally
  11334. Items.Free;
  11335. end;
  11336. end;
  11337. //------------------------------------------------------------------------------
  11338. procedure TMainForm.cbxURLInputerKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  11339. begin
  11340. if Key = 13 then
  11341. spbGoClick(spbGo);
  11342. end;
  11343. //------------------------------------------------------------------------------
  11344. procedure TMainForm.cbxURLInputerSelect(Sender: TObject);
  11345. begin
  11346. spbGoClick(spbGo);
  11347. end;
  11348. //------------------------------------------------------------------------------
  11349. procedure TMainForm.SetStyleMenuChecked;
  11350. begin
  11351. case FLVStyle of
  11352. lsBigHeadImage:
  11353. actShowBigHeadImage.Checked := True;
  11354. lsMiddleHeadImage:
  11355. actShowMiddleHeadImage.Checked := True;
  11356. lsSmallHeadImage:
  11357. actShowSmallHeadImage.Checked := True;
  11358. lsNoHeadImage:
  11359. actShowNormalHeadImage.Checked := True;
  11360. end;
  11361. case FLVCaptionStyle of
  11362. csDisplayName:
  11363. actShowDisplayName.Checked := True;
  11364. csLoginName:
  11365. actShowLoginName.Checked := True;
  11366. csDisplayNameAndLoginName:
  11367. actShowAllName.Checked := True;
  11368. end;
  11369. actShowRemark.Checked := RealICQClient.ShowRemark;
  11370. end;
  11371. //------------------------------------------------------------------------------
  11372. procedure TMainForm.SetLoginStateMenuChecked;
  11373. var
  11374. LeaveMsg: string;
  11375. begin
  11376. actOnline.Checked := False;
  11377. actHidden.Checked := False;
  11378. actOffline.Checked := False;
  11379. actBusy.Checked := False;
  11380. actMute.Checked := False;
  11381. actLeave.Checked := False;
  11382. actRepast.Checked := False;
  11383. actPhone.Checked := False;
  11384. actMeeting.Checked := False;
  11385. actOtherState.Checked := False;
  11386. if RealICQClient.Me = nil then
  11387. begin
  11388. actOffline.Checked := True;
  11389. Exit;
  11390. end;
  11391. LeaveMsg := RealICQClient.Me.LeaveMessage;
  11392. if RealICQClient.Me.LoginState = stOnline then
  11393. actOnline.Checked := True
  11394. else if RealICQClient.Me.LoginState = stHidden then
  11395. actHidden.Checked := True
  11396. else if RealICQClient.Me.LoginState = stLeave then
  11397. begin
  11398. if AnsiSameText(actLeave.Caption, LeaveMsg) then
  11399. actLeave.Checked := True
  11400. else if AnsiSameText(actRepast.Caption, LeaveMsg) then
  11401. actRepast.Checked := True
  11402. else if AnsiSameText(actMeeting.Caption, LeaveMsg) then
  11403. actMeeting.Checked := True
  11404. else
  11405. actOtherState.Checked := True;
  11406. end
  11407. else if RealICQClient.Me.LoginState = stBusy then
  11408. begin
  11409. if AnsiSameText(actBusy.Caption, LeaveMsg) then
  11410. actBusy.Checked := True
  11411. else if AnsiSameText(actPhone.Caption, LeaveMsg) then
  11412. actPhone.Checked := True
  11413. else
  11414. actOtherState.Checked := True;
  11415. end
  11416. else if RealICQClient.Me.LoginState = stMute then
  11417. actMute.Checked := True
  11418. else
  11419. actOtherState.Checked := True;
  11420. end;
  11421. //------------------------------------------------------------------------------
  11422. procedure TMainForm.ShowMeInformation;
  11423. var
  11424. ADisplayName, ATrueDisplayName, AWatchword, AStateMsg: WideString;
  11425. HeadPic: TPicture;
  11426. GIFImage: TGIFImage;
  11427. begin
  11428. if RealICQClient.Me = nil then
  11429. Exit;
  11430. if FNotReadMessages.Count = 0 then
  11431. begin
  11432. case RealICQClient.Me.LoginState of
  11433. stOffline:
  11434. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Offline.ico');
  11435. stOnline:
  11436. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Online.ico');
  11437. stLeave:
  11438. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\leave.ico');
  11439. stBusy:
  11440. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Busy.ico');
  11441. stMute:
  11442. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\Mute.ico');
  11443. stHidden:
  11444. TrayIcon.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\TrayIcon\invisible.ico');
  11445. end;
  11446. TrayIcon.SetDefaultIcon;
  11447. end;
  11448. if FileExists(RealICQClient.Me.HeadImageFile) then
  11449. begin
  11450. try
  11451. if (RealICQClient.Me.HeadImageFileType = htGIF) then
  11452. begin
  11453. GIFImage := TGIFImage.Create;
  11454. GIFImage.Animate := FShowGIFInMailForm and (RealICQClient.Me.LoginState <> stHidden);
  11455. try
  11456. GIFImage.LoadFromFile(RealICQClient.Me.HeadImageFile);
  11457. if GIFImage.Animate then
  11458. imgHead.Picture.Assign(GIFImage)
  11459. else
  11460. imgHead.Picture.Bitmap.Assign(GIFImage);
  11461. finally
  11462. GIFImage.Free;
  11463. end;
  11464. end
  11465. else
  11466. imgHead.Picture.LoadFromFile(RealICQClient.Me.HeadImageFile);
  11467. except
  11468. imgHead.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  11469. end;
  11470. end
  11471. else
  11472. begin
  11473. imgHead.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + DefaultPictureBig);
  11474. end;
  11475. {if RealICQClient.Me.LoginState = stHidden then
  11476. begin
  11477. HeadPic := TPicture.Create;
  11478. try
  11479. HeadPic.Bitmap.Assign(imgHead.Picture.Graphic);
  11480. Grayscale(HeadPic.Bitmap);
  11481. imgHead.Picture.Bitmap.Assign(HeadPic.Bitmap);
  11482. finally
  11483. HeadPic.Free;
  11484. end;
  11485. end;
  11486. imgLeave.Visible := False;}
  11487. case RealICQClient.Me.LoginState of
  11488. stOffline:
  11489. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Offline.ico');
  11490. stOnline:
  11491. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Online.ico');
  11492. stLeave:
  11493. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\away.ico');
  11494. stBusy:
  11495. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Busy.ico');
  11496. stMute:
  11497. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\Mute.ico');
  11498. stHidden:
  11499. spbDisplayName.Icon.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Images\State\Big\invisible.ico');
  11500. end;
  11501. if (RealICQClient.Me.LoginState = stLeave) or (RealICQClient.Me.LoginState = stBusy) then
  11502. AStateMsg := RealICQClient.Me.LeaveMessage
  11503. else
  11504. begin
  11505. if RealICQClient.Me.LoginState = stMobileOnline then
  11506. AStateMsg := StateValues[Integer(RealICQClient.Me.LoginState)]
  11507. else
  11508. AStateMsg := StateValues[Integer(RealICQClient.Me.LoginState) mod 5];
  11509. end;
  11510. ATrueDisplayName := RealICQClient.Me.Nickname;
  11511. ADisplayName := ATrueDisplayName + '(' + AStateMsg + ')';
  11512. spbDisplayName.Hint := ADisplayName;
  11513. spbDisplayName.ShowHint := False;
  11514. TrayIcon.Hint := Application.Title + ' - ' + ADisplayName;
  11515. AWatchword := RealICQClient.Me.Watchword;
  11516. if Length(Trim(AWatchword)) = 0 then
  11517. AWatchword := '在此键入您的个性签名';
  11518. spbWatchword.Hint := AWatchword;
  11519. spbWatchword.ShowHint := False;
  11520. btn_lock_DisplayName.Caption := ADisplayName; // + Format('(%s)', [StateValues[Integer(RealICQClient.Me.LoginState)]]);
  11521. btn_lock_DisplayName.AutoSize := False;
  11522. btn_lock_DisplayName.AutoSize := True;
  11523. btn_lock_DisplayName.Update;
  11524. img_lock_HeadPrev.Picture := imgHead.Picture;
  11525. //字符串长度过长时,截短字符串并在后面显示“...”
  11526. while spbDisplayName.Canvas.TextWidth(ADisplayName) > pnlTop.Width - 86 do
  11527. begin
  11528. if Length(ATrueDisplayName) > 3 then
  11529. begin
  11530. if Copy(ATrueDisplayName, Length(ATrueDisplayName) - 2, Length(ATrueDisplayName)) = '...' then
  11531. ATrueDisplayName := Copy(ATrueDisplayName, 1, Length(ATrueDisplayName) - 3);
  11532. ATrueDisplayName := Copy(ATrueDisplayName, 1, Length(ATrueDisplayName) - 1) + '...';
  11533. end
  11534. else if Length(AStateMsg) > 3 then
  11535. begin
  11536. if Copy(AStateMsg, Length(AStateMsg) - 2, Length(AStateMsg)) = '...' then
  11537. AStateMsg := Copy(AStateMsg, 1, Length(AStateMsg) - 3);
  11538. AStateMsg := Copy(AStateMsg, 1, Length(AStateMsg) - 1) + '...';
  11539. end
  11540. else
  11541. break;
  11542. ADisplayName := ATrueDisplayName + '(' + AStateMsg + ')';
  11543. spbDisplayName.ShowHint := True;
  11544. end;
  11545. //字符串长度过长时,截短字符串并在后面显示“...”
  11546. while spbWatchword.Canvas.TextWidth(AWatchword) > pnlTop.Width - 86 do
  11547. begin
  11548. if Length(AWatchword) > 3 then
  11549. begin
  11550. if Copy(AWatchword, Length(AWatchword) - 2, Length(AWatchword)) = '...' then
  11551. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 3);
  11552. AWatchword := Copy(AWatchword, 1, Length(AWatchword) - 1) + '...';
  11553. end
  11554. else
  11555. break;
  11556. spbWatchword.ShowHint := True;
  11557. end;
  11558. spbDisplayName.Caption := ADisplayName;
  11559. spbWatchword.Caption := AWatchword;
  11560. edWatchword.Text := RealICQClient.Me.Watchword;
  11561. if OptionsForm <> nil then
  11562. begin
  11563. OptionsForm.ShowHeadImage;
  11564. OptionsForm.GetSets;
  11565. //OptionsForm.GetPersonalSet;
  11566. end;
  11567. SetLoginStateMenuChecked;
  11568. end;
  11569. //------------------------------------------------------------------------------
  11570. procedure TMainForm.RealICQClientGetDBProcedureResult(Sender: TObject; DBProcedureName, ArgIn, ArgOut: string);
  11571. var
  11572. WebPanel: TWebPanel;
  11573. WebTabAcount: TWebTabAcount;
  11574. StrList1, StrList2: TStringList;
  11575. iLoop, iIndex: Integer;
  11576. begin
  11577. if AnsiSameText(DBProcedureName, 'YJ_AddTempRemark') then
  11578. begin
  11579. 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);
  11580. end;
  11581. if AnsiSameText(DBProcedureName, 'GetWebTabAcounts') then
  11582. begin
  11583. StrList1 := SplitString(ArgOut, Chr(13));
  11584. for iLoop := 0 to StrList1.Count - 1 do
  11585. begin
  11586. if StrList1.Strings[iLoop] = '' then
  11587. Continue;
  11588. StrList2 := SplitString(StrList1.Strings[iLoop], Chr(10));
  11589. WebTabAcount := TWebTabAcount.Create;
  11590. try
  11591. WebTabAcount.FWebTabID := StrToInt(StrList2.Strings[0]);
  11592. WebTabAcount.FTitle := StrList2.Strings[1];
  11593. WebTabAcount.LoginName := StrList2.Strings[2];
  11594. WebTabAcount.FPassword := StrList2.Strings[3];
  11595. WebTabAcount.FExplain := StrList2.Strings[4];
  11596. iIndex := FWebPanels.IndexOf(IntToStr(WebTabAcount.FWebTabID));
  11597. if iIndex >= 0 then
  11598. begin
  11599. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  11600. WebPanel.FAcounts.Add(WebTabAcount);
  11601. end;
  11602. except
  11603. FreeAndNil(WebTabAcount);
  11604. end;
  11605. end;
  11606. end;
  11607. end;
  11608. procedure TMainForm.RealICQClientGetNotReadMessageCount(Sender: TObject; iCount: Integer);
  11609. begin
  11610. spbShowNotReadMessage.Caption := Format('(%d)', [iCount]);
  11611. end;
  11612. procedure TMainForm.RealICQClientGetSystemNoticesCount(Sender: TObject; iCount: Integer; NoticesRecords: array of TSystemNotices);
  11613. var
  11614. iLoop: Integer;
  11615. ANoticesRecord: TSystemNotices;
  11616. begin
  11617. FLastGetSystemNoticesTicket := GetTickCount;
  11618. while FSystemNotices.Count > 0 do
  11619. begin
  11620. ANoticesRecord := FSystemNotices[0];
  11621. FSystemNotices.Delete(0);
  11622. try
  11623. FreeAndNil(ANoticesRecord);
  11624. except
  11625. end;
  11626. end;
  11627. for iLoop := Low(NoticesRecords) to High(NoticesRecords) do
  11628. begin
  11629. ANoticesRecord := NoticesRecords[iLoop];
  11630. FSystemNotices.Add(ANoticesRecord);
  11631. end;
  11632. pnlForTopMessage.Visible := iCount > 0;
  11633. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  11634. FSystemNoticeIndex := 0;
  11635. if pnlForTopMessage.Visible then
  11636. begin
  11637. ShowSystemNotices;
  11638. end;
  11639. end;
  11640. procedure TMainForm.TimerForShowSystemNoticesTimer(Sender: TObject);
  11641. begin
  11642. TimerForShowSystemNotices.Enabled := pnlForTopMessage.Visible;
  11643. btNextLogClick(nil);
  11644. if GetTickCount - FLastGetSystemNoticesTicket > 60000 * 30 then
  11645. begin
  11646. TimerForShowSystemNotices.Enabled := False;
  11647. RealICQClient.SendGetNewInformation(1);
  11648. end;
  11649. end;
  11650. procedure TMainForm.ShowSystemNotices;
  11651. var
  11652. ANoticesRecord: TSystemNotices;
  11653. begin
  11654. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  11655. while ANoticesRecord.EndDate < Now do
  11656. begin
  11657. FSystemNotices.Delete(FSystemNoticeIndex);
  11658. FreeAndNil(ANoticesRecord);
  11659. if FSystemNotices.Count > 0 then
  11660. begin
  11661. if FSystemNoticeIndex >= FSystemNotices.Count then
  11662. FSystemNoticeIndex := FSystemNotices.Count - 1;
  11663. if FSystemNoticeIndex < 0 then
  11664. FSystemNoticeIndex := 0;
  11665. ANoticesRecord := FSystemNotices[FSystemNoticeIndex];
  11666. end
  11667. else
  11668. begin
  11669. pnlForTopMessage.Visible := False;
  11670. TimerForShowSystemNotices.Enabled := False;
  11671. Exit;
  11672. end;
  11673. end;
  11674. lblLogsTitle.Caption := Format('系统公告(%d/%d)', [FSystemNoticeIndex + 1, FSystemNotices.Count]);
  11675. lblLogs.Caption := ANoticesRecord.Title;
  11676. lblLogs.Hint := ANoticesRecord.Title + '(有效期:' + DateTimeToStr(ANoticesRecord.EndDate) + ')';
  11677. TimerForShowSystemNotices.Enabled := False;
  11678. TimerForShowSystemNotices.Enabled := FSystemNotices.Count > 0;
  11679. end;
  11680. procedure TMainForm.btNextLogClick(Sender: TObject);
  11681. begin
  11682. Inc(FSystemNoticeIndex, 1);
  11683. if FSystemNoticeIndex >= FSystemNotices.Count then
  11684. FSystemNoticeIndex := 0;
  11685. ShowSystemNotices;
  11686. end;
  11687. procedure TMainForm.btn_lockClick(Sender: TObject);
  11688. var
  11689. iLoop: Integer;
  11690. AForm: TSMSForm;
  11691. begin
  11692. if Assigned(MessageBoxForm) then
  11693. MessageBoxForm.Hide;
  11694. if Assigned(MessagesManagerForm) then
  11695. MessagesManagerForm.Visible := False;
  11696. if Assigned(SearchForm) then
  11697. SearchForm.Visible := False;
  11698. for iLoop := SMSForms.Count - 1 downto 0 do
  11699. begin
  11700. AForm := SMSForms[iLoop];
  11701. AForm.Visible := False;
  11702. end;
  11703. pnlLocked.Visible := True;
  11704. pnlLocked.BringToFront;
  11705. ChangeTalkingFormVisible(False);
  11706. end;
  11707. procedure TMainForm.btn_unlockClick(Sender: TObject);
  11708. var
  11709. APassword: string;
  11710. iLoop: Integer;
  11711. AForm: TSMSForm;
  11712. begin
  11713. actOpenMainForm.Execute;
  11714. APassword := ShowMyInputBox(PChar('解锁'), PChar('请输入您的登录密码以解除锁定状态! '), '', 32);
  11715. if Trim(APassword) = '' then
  11716. Exit;
  11717. if AnsiSameText(APassword, MainForm.RealICQClient.Password) then
  11718. begin
  11719. ChangeTalkingFormVisible(True);
  11720. pnlLocked.Visible := False;
  11721. pnlMiddleClient.Visible := RealICQClient.Logined and RealICQClient.Connected;
  11722. if Assigned(MessagesManagerForm) then
  11723. MessagesManagerForm.Visible := True;
  11724. if Assigned(SearchForm) then
  11725. SearchForm.Visible := True;
  11726. for iLoop := SMSForms.Count - 1 downto 0 do
  11727. begin
  11728. AForm := SMSForms[iLoop];
  11729. AForm.Visible := True;
  11730. end;
  11731. end
  11732. else
  11733. begin
  11734. showmessage('您输入的密码有误! ');
  11735. end;
  11736. end;
  11737. procedure TMainForm.btPrevLogClick(Sender: TObject);
  11738. begin
  11739. Dec(FSystemNoticeIndex, 1);
  11740. if FSystemNoticeIndex < 0 then
  11741. FSystemNoticeIndex := FSystemNotices.Count - 1;
  11742. ShowSystemNotices;
  11743. end;
  11744. procedure TMainForm.spbShowNotReadMessageClick(Sender: TObject);
  11745. begin
  11746. { if MessageBoxForm=nil then
  11747. begin
  11748. MessageBoxForm:=TMessageBoxForm.Create(self);
  11749. end;
  11750. MessageBoxForm.Show; }
  11751. if FNewConsole then
  11752. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + NewBaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(InBoxURL)])), '', SW_SHOWDEFAULT)
  11753. else
  11754. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(InBoxURL)])), '', SW_SHOWDEFAULT);
  11755. end;
  11756. //----------------------------------------------
  11757. procedure TMainForm.OpenNewWorkDisk(Path: string);
  11758. var
  11759. UserInfo: string;
  11760. C: TCopyDataStruct;
  11761. hwnd: THandle;
  11762. begin
  11763. WinExec(PChar(ExtractFilePath(Application.ExeName) + Path), sw_show);
  11764. UserInfo := RealICQClient.LoginName + #10 + RealICQClient.Password;
  11765. with c do
  11766. begin
  11767. dwData := WM_COPYDATA;
  11768. lpData := PChar(UserInfo + #0);
  11769. cbData := Length(UserInfo) + 2;
  11770. end;
  11771. hWnd := FindWindow(pchar('TMainForm'), pchar('网络存储'));
  11772. if hWnd <> 0 then
  11773. SendMessage(hwnd, WM_COPYDATA, 0, integer(@c));
  11774. end;
  11775. //---------------------------------------------------
  11776. procedure TMainForm.SaveBranchUserDataToXML(FileName: string);
  11777. var
  11778. iLoop: Integer;
  11779. XMLDocument: TXMLDocument;
  11780. Nodes, BranchsNode, BranchNode, UsersNode, UserNode: IXMLNode;
  11781. BranchInfo: TRealICQBranchInfo;
  11782. RealICQUser: TRealICQUser;
  11783. LoginName: string;
  11784. AUsers: TStringList;
  11785. begin
  11786. XMLDocument := TXMLDocument.Create(Self);
  11787. try
  11788. try
  11789. XMLDocument.Active := True;
  11790. if not FileExists(FileName) then
  11791. begin
  11792. XMLDocument.XML.Text := '<?xml version="1.0"?><Data>' + '<Branchs>' + '</Branchs>' + '<Users>' + '</Users></Data>';
  11793. XMLDocument.Active := True;
  11794. end
  11795. else
  11796. begin
  11797. XMLDocument.LoadFromFile(FileName);
  11798. end;
  11799. Nodes := XMLDocument.DocumentElement;
  11800. BranchsNode := Nodes.ChildNodes.Get(0);
  11801. UsersNode := Nodes.ChildNodes.Get(1);
  11802. BranchsNode.ChildNodes.Clear;
  11803. UsersNode.ChildNodes.Clear;
  11804. for iLoop := 0 to self.RealICQClient.Branchs.Count - 1 do
  11805. begin
  11806. BranchInfo := RealICQClient.Branchs.Objects[iLoop] as TRealICQBranchInfo;
  11807. BranchNode := BranchsNode.AddChild('Branch');
  11808. BranchNode.Attributes['ID'] := BranchInfo.ID;
  11809. BranchNode.Attributes['Name'] := BranchInfo.BranchName;
  11810. BranchNode.Attributes['ParentID'] := BranchInfo.ParentID;
  11811. end;
  11812. AUsers := TUsersService.GetUsersService.GetWorkmatesAndFriends;
  11813. try
  11814. for iLoop := 0 to AUsers.Count - 1 do
  11815. begin
  11816. RealICQUser := AUsers.Objects[iLoop] as TRealICQUser;
  11817. LoginName := RealICQUser.LoginName;
  11818. if AnsiPos('+', LoginName) > 0 then
  11819. LoginName := Copy(LoginName, AnsiPos('+', LoginName) + 1, Length(LoginName) - AnsiPos('+', LoginName));
  11820. UserNode := UsersNode.AddChild('User');
  11821. UserNode.Attributes['LoginName'] := LoginName;
  11822. UserNode.Attributes['DisplayName'] := RealICQUser.DisplayName;
  11823. UserNode.Attributes['BranchID'] := RealICQUser.BranchID;
  11824. end;
  11825. finally
  11826. FreeAndNil(AUsers);
  11827. end;
  11828. XMLDocument.SaveToFile(FileName);
  11829. except
  11830. on E: Exception do
  11831. showmessage(e.Message);
  11832. end;
  11833. finally
  11834. XMLDocument.Free;
  11835. end;
  11836. end;
  11837. //------网络存储-------------------------------------
  11838. procedure TMainForm.spbNetworkBackupClick(Sender: TObject);
  11839. var
  11840. UserInfo, LoginName: string;
  11841. C: TCopyDataStruct;
  11842. hwnd: THandle;
  11843. FilePath: string;
  11844. begin
  11845. FilePath := ExtractFilePath(paramstr(0)) + 'NetworkBackup\';
  11846. SaveBranchUserDataToXml(FilePath + 'BranchUsers.XML');
  11847. LoginName := RealICQClient.LoginName;
  11848. if AnsiPos('+', LoginName) > 0 then
  11849. LoginName := Copy(LoginName, AnsiPos('+', LoginName) + 1, Length(LoginName) - AnsiPos('+', LoginName));
  11850. WinExec(PChar(FilePath + 'NetworkBackup.exe ' + LoginName + ' ' + RealICQClient.Password), sw_show);
  11851. end;
  11852. procedure TMainForm.RealICQClientGettedAudioTransmiteConnectted(Sender: TObject; ALoginName: string);
  11853. var
  11854. TalkingForm: TTalkingForm;
  11855. begin
  11856. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11857. if TalkingForm = nil then
  11858. Exit;
  11859. if TalkingForm.CanWriteMessage then
  11860. TalkingForm.ShowGettedAudioTransmiteConnectted;
  11861. end;
  11862. //------------------------------------------------------------------------------
  11863. procedure TMainForm.RealICQClientGettedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  11864. var
  11865. AShowActive: Boolean;
  11866. TalkingForm: TTalkingForm;
  11867. iWaitTimes: Integer;
  11868. begin
  11869. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  11870. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11871. if TalkingForm = nil then
  11872. begin
  11873. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  11874. end;
  11875. iWaitTimes := 0;
  11876. while not TalkingForm.CanWriteMessage do
  11877. begin
  11878. Application.ProcessMessages;
  11879. Inc(iWaitTimes);
  11880. if iWaitTimes > 1000 then
  11881. break;
  11882. Sleep(10);
  11883. end;
  11884. if (GetForegroundWindow <> TalkingForm.Handle) then
  11885. begin
  11886. FlashWindow(TalkingForm.Handle, True);
  11887. if PlaySoundOnGetMessage then
  11888. PlayEventSound(FMessageEventSound);
  11889. end;
  11890. TalkingForm.ShowGettedAudioTransmiteRequest;
  11891. end;
  11892. //------------------------------------------------------------------------------
  11893. procedure TMainForm.RealICQClientGettedAudioTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  11894. var
  11895. TalkingForm: TTalkingForm;
  11896. begin
  11897. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11898. if TalkingForm = nil then
  11899. Exit;
  11900. if TalkingForm.CanWriteMessage then
  11901. TalkingForm.ShowGettedAudioTransmiteResponse(AAcceptted);
  11902. end;
  11903. //------显示全市页面查询结果------------------------------------------------------------------------
  11904. procedure TMainForm.RealICQClientSearchUserResult(Sender: TObject);
  11905. var
  11906. iIndex, iLoop: Integer;
  11907. ListItem: TRealICQContacterListItem;
  11908. RealICQUser: TRealICQUser;
  11909. Branch: TRealICQBranch;
  11910. RealICQContacterTreeView: TRealICQContacterTreeView;
  11911. begin
  11912. iIndex := FContacterListViews.IndexOf(LVMoreUsers);
  11913. FSearchMoreUserListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  11914. for iLoop := 0 to RealICQClient.SearchUsers.Count - 1 do
  11915. begin
  11916. RealICQUser := RealICQClient.SearchUsers.Objects[iLoop] as TRealICQUser;
  11917. iIndex := FSearchMoreUserListView.Items.IndexOf(RealICQUser.LoginName);
  11918. if iIndex = -1 then
  11919. begin
  11920. iIndex := FSearchMoreUserListView.Items.Add(RealICQUser.LoginName);
  11921. ListItem := FSearchMoreUserListView.Items.Objects[iIndex] as TRealICQContacterListItem;
  11922. ListItem.DisplayName := RealICQUser.DisplayName;
  11923. ListItem.LoginState := RealICQUser.LoginState;
  11924. ListItem.Data := RealICQUser;
  11925. Application.ProcessMessages;
  11926. end;
  11927. end;
  11928. RealICQContacterTreeView := FContacterTreeViews.Objects[FContacterTreeViews.IndexOf(LVMoreUsers)] as TRealICQContacterTreeView;
  11929. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  11930. begin
  11931. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  11932. if (AnsiPos(UpperCase(RealICQClient.KeyWord), UpperCase(Branch.BranchName)) > 0) or (AnsiPos(UpperCase(RealICQClient.KeyWord), GetPYIndexString(Branch.BranchName)) > 0) then
  11933. begin
  11934. iIndex := FSearchMoreUserListView.Items.Add(Branch.BranchName);
  11935. ListItem := FSearchMoreUserListView.Items.Objects[iIndex] as TRealICQContacterListItem;
  11936. ListItem.DisplayName := Branch.BranchName;
  11937. ListItem.LoginState := stOnline;
  11938. ListItem.StateIndex := 0;
  11939. ListItem.Data := Branch;
  11940. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + BranchCollapsedBMP);
  11941. end;
  11942. end;
  11943. PostMessage(FSearchMoreUserListView.Handle, WM_SIZE, 0, 0);
  11944. ImgLogining.Visible := False;
  11945. ScrollBoxSearchMoreUser.Visible := FSearchMoreUserListView.Items.Count > 0;
  11946. LblSearchHint.Visible := not ScrollBoxSearchMoreUser.Visible;
  11947. LblSearchHint.Caption := '没有找到相关记录';
  11948. end;
  11949. procedure TMainForm.RealICQClientSendedAudioTransmiteRequest(Sender: TObject; ALoginName: string);
  11950. var
  11951. TalkingForm: TTalkingForm;
  11952. begin
  11953. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11954. if TalkingForm = nil then
  11955. Exit;
  11956. if TalkingForm.CanWriteMessage then
  11957. TalkingForm.ShowSendedAudioTransmiteRequest;
  11958. end;
  11959. procedure TMainForm.RealICQClientSendedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  11960. var
  11961. TalkingForm: TTalkingForm;
  11962. begin
  11963. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11964. if TalkingForm = nil then
  11965. Exit;
  11966. if TalkingForm.CanWriteMessage then
  11967. TalkingForm.ShowSendedRemoteControlTransmiteControlRequest;
  11968. end;
  11969. procedure TMainForm.RealICQClientSendedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  11970. var
  11971. TalkingForm: TTalkingForm;
  11972. begin
  11973. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11974. if TalkingForm = nil then
  11975. Exit;
  11976. if TalkingForm.CanWriteMessage then
  11977. TalkingForm.ShowSendedRemoteControlTransmiteRequest;
  11978. end;
  11979. //------------------------------------------------------------------------------
  11980. procedure TMainForm.RealICQClientGettedCancelAudioTransmite(Sender: TObject; ALoginName: string);
  11981. var
  11982. TalkingForm: TTalkingForm;
  11983. begin
  11984. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11985. if TalkingForm = nil then
  11986. Exit;
  11987. if TalkingForm.CanWriteMessage then
  11988. TalkingForm.ShowCanceledAudioTransmite;
  11989. end;
  11990. procedure TMainForm.RealICQClientGettedCancelRemoteControlTransmite(Sender: TObject; ALoginName: string);
  11991. var
  11992. TalkingForm: TTalkingForm;
  11993. begin
  11994. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  11995. if TalkingForm = nil then
  11996. Exit;
  11997. if TalkingForm.CanWriteMessage then
  11998. TalkingForm.ShowCanceledRemoteControlTransmite;
  11999. end;
  12000. //------------------------------------------------------------------------------
  12001. procedure TMainForm.RealICQClientGettedStopAudioTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  12002. var
  12003. TalkingForm: TTalkingForm;
  12004. begin
  12005. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12006. if TalkingForm = nil then
  12007. Exit;
  12008. if TalkingForm.CanWriteMessage then
  12009. TalkingForm.ShowStoppedAudioTransmite(AIsStopper);
  12010. end;
  12011. procedure TMainForm.RealICQClientGettedStopRemoteControlTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  12012. var
  12013. TalkingForm: TTalkingForm;
  12014. begin
  12015. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12016. if TalkingForm = nil then
  12017. Exit;
  12018. if TalkingForm.CanWriteMessage then
  12019. TalkingForm.ShowStoppedRemoteControlTransmite(AIsStopper);
  12020. end;
  12021. //------------------------------------------------------------------------------
  12022. procedure TMainForm.RealICQClientGettedVideoTransmiteConnectted(Sender: TObject; ALoginName: string; ASendBigBmp, ARecvBigBmp: Boolean);
  12023. var
  12024. TalkingForm: TTalkingForm;
  12025. begin
  12026. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12027. if TalkingForm = nil then
  12028. Exit;
  12029. if TalkingForm.CanWriteMessage then
  12030. TalkingForm.ShowGettedVideoTransmiteConnectted(ASendBigBmp, ARecvBigBmp);
  12031. end;
  12032. //------------------------------------------------------------------------------
  12033. procedure TMainForm.RealICQClientGettedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  12034. var
  12035. AShowActive: Boolean;
  12036. TalkingForm: TTalkingForm;
  12037. iWaitTimes: Integer;
  12038. begin
  12039. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stBusy) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  12040. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12041. if TalkingForm = nil then
  12042. begin
  12043. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  12044. end;
  12045. iWaitTimes := 0;
  12046. while not TalkingForm.CanWriteMessage do
  12047. begin
  12048. Application.ProcessMessages;
  12049. Inc(iWaitTimes);
  12050. if iWaitTimes > 1000 then
  12051. break;
  12052. Sleep(10);
  12053. end;
  12054. if (GetForegroundWindow <> TalkingForm.Handle) then
  12055. begin
  12056. FlashWindow(TalkingForm.Handle, True);
  12057. if PlaySoundOnGetMessage then
  12058. PlayEventSound(FMessageEventSound);
  12059. end;
  12060. TalkingForm.ShowGettedVideoTransmiteRequest;
  12061. end;
  12062. //------------------------------------------------------------------------------
  12063. procedure TMainForm.RealICQClientGettedVideoTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12064. var
  12065. TalkingForm: TTalkingForm;
  12066. begin
  12067. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12068. if TalkingForm = nil then
  12069. Exit;
  12070. if TalkingForm.CanWriteMessage then
  12071. TalkingForm.ShowGettedVideoTransmiteResponse(AAcceptted);
  12072. end;
  12073. procedure TMainForm.RealICQClientGettedWebUrl(Sender: TObject);
  12074. begin
  12075. // if trim(RealICQClient.WeatherUrl)<>'' then
  12076. // begin
  12077. // FDownFile.OnComplete:=DownFileComplete;
  12078. // FDownFile.ThreadDownFile(RealICQClient.WeatherUrl,ExtractFilePath(Application.ExeName)+'Weather.txt');
  12079. // end;
  12080. end;
  12081. //------------------------------------------------------------------------------
  12082. procedure TMainForm.RealICQClientSendedVideoTransmiteRequest(Sender: TObject; ALoginName: string);
  12083. var
  12084. TalkingForm: TTalkingForm;
  12085. begin
  12086. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12087. if TalkingForm = nil then
  12088. Exit;
  12089. if TalkingForm.CanWriteMessage then
  12090. TalkingForm.ShowSendedVideoTransmiteRequest;
  12091. end;
  12092. //------------------------------------------------------------------------------
  12093. procedure TMainForm.RealICQClientGettedCancelVideoTransmite(Sender: TObject; ALoginName: string);
  12094. var
  12095. TalkingForm: TTalkingForm;
  12096. begin
  12097. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12098. if TalkingForm = nil then
  12099. Exit;
  12100. if TalkingForm.CanWriteMessage then
  12101. TalkingForm.ShowCanceledVideoTransmite;
  12102. end;
  12103. procedure TMainForm.RealICQClientGettedCanSendSMSCount(Sender: TObject);
  12104. begin
  12105. UpdateCanSendSMSCount;
  12106. end;
  12107. //------------------------------------------------------------------------------
  12108. procedure TMainForm.RealICQClientGettedStopVideoTransmite(Sender: TObject; ALoginName: string; AIsStopper: Boolean);
  12109. var
  12110. TalkingForm: TTalkingForm;
  12111. begin
  12112. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12113. if TalkingForm = nil then
  12114. Exit;
  12115. if TalkingForm.CanWriteMessage then
  12116. TalkingForm.ShowStoppedVideoTransmite(AIsStopper);
  12117. end;
  12118. //---显示黑名单-------------------------------------------------------------
  12119. procedure TMainForm.ShowBlacklists;
  12120. var
  12121. iLoop, ItemIndex: Integer;
  12122. RealICQUser: TRealICQUser;
  12123. FriendTreeView: TRealICQContacterTreeView;
  12124. Friend: TRealICQEmployee;
  12125. begin
  12126. SetFlashCaptionOnOnlineValue(False);
  12127. try
  12128. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  12129. FriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12130. for iLoop := 0 to RealICQClient.Blacklists.Count - 1 do
  12131. begin
  12132. RealICQUser := RealICQClient.Blacklists.Objects[iLoop] as TRealICQUser;
  12133. if trim(RealICQUser.DisplayName) = '' then
  12134. TUsersService.GetUsersService.GetOrRequestUser(RealICQUser.LoginName, RealICQClient);
  12135. if (FriendTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then
  12136. Continue;
  12137. Friend := TRealICQEmployee.Create(RealICQUser.LoginName);
  12138. Friend.BranchID := LVBlackLists;
  12139. FriendTreeView.AddEmployee(Friend);
  12140. //UpdateFriendNode(Friend, RealICQUser, False);
  12141. TUsersService.GetUsersService.UpdateTreeNode(FriendTreeView, Friend, RealICQUser, False);
  12142. end;
  12143. finally
  12144. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  12145. end;
  12146. end;
  12147. //------------------------------------------------------------------------------
  12148. procedure TMainForm.RealICQClientGettedBlacklists(Sender: TObject);
  12149. begin
  12150. ShowBlacklists;
  12151. end;
  12152. //-------显示与自己不同部门的联系人------------------------------
  12153. procedure TMainForm.RealICQClientGettedBranchUser(Sender: TObject);
  12154. var
  12155. iLoop, ItemIndex: Integer;
  12156. RealICQUser: TRealICQUser;
  12157. RealICQContacterTreeView: TRealICQContacterTreeView;
  12158. Employee: TRealICQEmployee;
  12159. TmpBranch, RootBranch: TRealICQBranch;
  12160. OnlineEmployee: Integer;
  12161. begin
  12162. // TmpBranch:=nil;
  12163. // RootBranch:=nil;
  12164. // ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  12165. // RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12166. // RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12167. // RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12168. // RealICQContacterTreeView.AdjustPosition :=False;
  12169. // RealICQContacterTreeView.HideSystemScrollBar;
  12170. // pgcMainWorkArea.DisableAlign;
  12171. // RealICQContacterTreeView.BeginUpdate;
  12172. // try
  12173. // ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户');
  12174. // if ItemIndex>=0 then
  12175. // RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12176. // OnlineEmployee:=0;
  12177. //
  12178. // for iLoop:=0 to RealICQContacterTreeView.EmployeeItems.Count-1 do
  12179. // begin
  12180. // Employee:=RealICQContacterTreeView.EmployeeItems.Objects[iLoop] as TRealICQEmployee;
  12181. // if (Employee.LoginState <> stOffline) and (Employee.LoginState <> stHidden) then
  12182. // OnlineEmployee := OnlineEmployee + 1;
  12183. // end;
  12184. // for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12185. // begin
  12186. // TmpBranch:=RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  12187. // if not TmpBranch.IsGetUserList then
  12188. // begin
  12189. // TmpBranch.OnlineEmployee:=0;
  12190. // TmpBranch.EmployeeCount:=0;
  12191. // TmpBranch.IsGetUserList:=True;
  12192. // end;
  12193. // if (TmpBranch.ParentID='0') then
  12194. // RootBranch:=TmpBranch
  12195. // end;
  12196. // if RootBranch<>nil then
  12197. // begin
  12198. // RootBranch.OnlineEmployee:=OnlineEmployee;
  12199. // RootBranch.EmployeeCount:= RealICQContacterTreeView.EmployeeItems.Count;
  12200. // end;
  12201. // {$region '添加联系人'}
  12202. // for iLoop := RealICQClient.Friends.Count - 1 downto 0 do
  12203. // begin
  12204. // RealICQUser := RealICQClient.Friends.Objects[iLoop] as TRealICQUser;
  12205. // if (RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then Continue;
  12206. // if AnsiSameText(RealICQUser.BranchID, 'U') then Continue;
  12207. //
  12208. // Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12209. // Employee.BranchID := RealICQUser.BranchID;
  12210. // Employee.HasAddFriend:=False;
  12211. // Employee.HasEmail :=False;
  12212. // RealICQContacterTreeView.AddEmployee(Employee);
  12213. // if Assigned(Employee.Node.Parent) then
  12214. // begin
  12215. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12216. // end
  12217. // else
  12218. // FreeAndNil(Employee);
  12219. // end;
  12220. // {$endregion}
  12221. // PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12222. // finally
  12223. // RealICQContacterTreeView.EndUpdate;
  12224. // pgcMainWorkArea.EnableAlign;
  12225. // end;
  12226. end;
  12227. //------------------------------------------------------------------------------
  12228. procedure TMainForm.LoadLatests;
  12229. var
  12230. FLatestUsers: TStringList;
  12231. RealICQUser: TRealICQUser;
  12232. RealICQContacterListItem: TRealICQContacterListItem;
  12233. iLoop, ItemIndex: Integer;
  12234. LoginName: string;
  12235. begin
  12236. FLatestUsers := DBHistory.GetLatests(RealICQClient.LoginName);
  12237. try
  12238. for iLoop := 0 to FLatestUsers.Count - 1 do
  12239. begin
  12240. if iLoop >= 20 then
  12241. Break;
  12242. LoginName := FLatestUsers[iLoop];
  12243. if (AnsiPos('+', LoginName) <= 0) and (trim(RealICQClient.CenterServerID) <> '') then
  12244. LoginName := RealICQClient.CenterServerID + '+' + LoginName;
  12245. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  12246. if RealICQUser = nil then
  12247. Continue;
  12248. if not AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  12249. begin
  12250. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  12251. if ItemIndex = -1 then
  12252. ItemIndex := FLVLatests.Items.Add(RealICQUser.LoginName);
  12253. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  12254. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  12255. TUsersService.GetUsersService.UpdateListItem(FLVLatests, RealICQContacterListItem, RealICQUser);
  12256. end;
  12257. end;
  12258. finally
  12259. FreeAndNil(FLatestUsers);
  12260. end;
  12261. end;
  12262. //------------------------------------------------------------------------------
  12263. procedure TMainForm.GetOtherBranchs;
  12264. var
  12265. iLoop: Integer;
  12266. RealICQUser: TRealICQUser;
  12267. ALoginNames: string;
  12268. begin
  12269. ALoginNames := '';
  12270. for iLoop := 0 to FNotAddedEmployeeList.Count - 1 do
  12271. begin
  12272. RealICQUser := FNotAddedEmployeeList.Objects[iLoop] as TRealICQUser;
  12273. ALoginNames := ALoginNames + RealICQUser.LoginName;
  12274. if (iLoop < FNotAddedEmployeeList.Count - 1) then
  12275. ALoginNames := ALoginNames + Chr(10);
  12276. end;
  12277. if (Length(Trim(ALoginNames)) > 0) then
  12278. RealICQClient.SendGetFriendsInfo(ALoginNames);
  12279. end;
  12280. //-----计算某个部门的总上线人数和总用户数-----------------------------------
  12281. procedure TMainForm.GetBranchEmpOnlineAndSum(Branchs: TStringList; BranchInfo: TRealICQBranchInfo; var OnlineEmployee, EmployeeCount: Integer);
  12282. var
  12283. iLoop: Integer;
  12284. TmpBranchInfo: TRealICQBranchInfo;
  12285. begin
  12286. OnlineEmployee := OnlineEmployee + BranchInfo.OnlineEmployee;
  12287. EmployeeCount := EmployeeCount + BranchInfo.EmployeeCount;
  12288. for iLoop := 0 to Branchs.Count - 1 do
  12289. begin
  12290. TmpBranchInfo := Branchs.Objects[iLoop] as TRealICQBranchInfo;
  12291. if TmpBranchInfo.ParentID = BranchInfo.ID then
  12292. begin
  12293. GetBranchEmpOnlineAndSum(Branchs, TmpBranchInfo, OnlineEmployee, EmployeeCount);
  12294. end;
  12295. end;
  12296. end;
  12297. //------------------------------------------------------------------------------
  12298. procedure TMainForm.ShowBranchAndUsers(ExpandSelfNode: Boolean = False);
  12299. var
  12300. iLoop, ItemIndex: Integer;
  12301. OnlineEmployee, EmployeeCount: Integer;
  12302. RealICQUser: TRealICQUser;
  12303. RealICQContacterTreeView: TRealICQContacterTreeView;
  12304. BranchInfo: TRealICQBranchInfo;
  12305. Branch: TRealICQBranch;
  12306. Employee: TRealICQEmployee;
  12307. ParentNode: TTreeNode;
  12308. begin
  12309. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  12310. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12311. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12312. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12313. RealICQContacterTreeView.AdjustPosition := False;
  12314. RealICQContacterTreeView.HideSystemScrollBar;
  12315. //pgcMainWorkArea.DisableAlign;
  12316. { TODO -olqq -c : 添加部门和用户 2015/3/14 17:03:49 }
  12317. { TODO -olqq -c : 需要考虑 2015/3/14 17:05:43 }
  12318. RealICQContacterTreeView.BeginUpdate;
  12319. try
  12320. {$region '添加部门'}
  12321. for iLoop := 0 to RealICQClient.Branchs.Count - 1 do
  12322. begin
  12323. BranchInfo := RealICQClient.Branchs.Objects[iLoop] as TRealICQBranchInfo;
  12324. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12325. Continue;
  12326. OnlineEmployee := 0;
  12327. EmployeeCount := 0;
  12328. GetBranchEmpOnlineAndSum(RealICQClient.Branchs, BranchInfo, OnlineEmployee, EmployeeCount);
  12329. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12330. Branch.BranchID := BranchInfo.ID;
  12331. Branch.ParentID := BranchInfo.ParentID;
  12332. Branch.IsGetUserList := False;
  12333. Branch.OnlineEmployee := OnlineEmployee;
  12334. Branch.EmployeeCount := EmployeeCount;
  12335. RealICQContacterTreeView.AddBranch(Branch);
  12336. end;
  12337. // RealICQContacterTreeView.ReAlignBranchs;
  12338. {$endregion}
  12339. // {$region '添加联系人'}
  12340. // for iLoop := RealICQClient.Friends.Count - 1 downto 0 do
  12341. // begin
  12342. // RealICQUser := RealICQClient.Friends.Objects[iLoop] as TRealICQUser;
  12343. // if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  12344. // begin
  12345. // ShowMeInformation;
  12346. // end;
  12347. // //if (RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName)) >= 0 then Continue;
  12348. // Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12349. // Employee.BranchID := RealICQUser.BranchID;
  12350. // Employee.HasEmail :=False;// (Length(Trim(RealICQUser.Email)) > 0);
  12351. // Employee.HasAddFriend:=False;
  12352. // if not AnsiSameText(Employee.BranchID, 'U') then
  12353. // begin
  12354. // RealICQContacterTreeView.AddEmployee(Employee);
  12355. // if Assigned(Employee.Node.Parent) then
  12356. // begin
  12357. // UpdateEmployeeNode(Employee, RealICQUser, False);
  12358. // end
  12359. // else
  12360. // begin
  12361. // FreeAndNil(Employee);
  12362. // if AnsiPos('-',RealICQUser.LoginName)>0 then
  12363. // begin
  12364. // // RealICQClient.GetUserInformation(RealICQUser.LoginName,True);
  12365. // if (FNotAddedEmployeeList.IndexOf(RealICQUser.LoginName)) < 0 then
  12366. // FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  12367. // end;
  12368. // end;
  12369. // end
  12370. // else
  12371. // begin
  12372. // if AnsiPos('-',RealICQUser.LoginName)>0 then
  12373. // begin
  12374. // TUsersService.GetUsersService.RequestUserInformation(RealICQUser.LoginName, RealICQClient);
  12375. // if (FNotAddedEmployeeList.IndexOf(RealICQUser.LoginName)) < 0 then
  12376. // FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  12377. // end;
  12378. // end;
  12379. // end;
  12380. // {$endregion}
  12381. {
  12382. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  12383. if Employee <> nil then
  12384. begin
  12385. UpdateEmployeeNode(Employee, RealICQUser, True);
  12386. end;
  12387. }
  12388. {$region '展开自己所在的部门树'}
  12389. if ExpandSelfNode then
  12390. begin
  12391. Employee := RealICQContacterTreeView.GetEmployee(RealICQClient.Me.LoginName);
  12392. ParentNode := Employee.Node.Parent;
  12393. while ParentNode <> nil do
  12394. begin
  12395. ParentNode.Expanded := True;
  12396. Branch := ParentNode.Data;
  12397. Branch.IsGetUserList := True;
  12398. ParentNode := ParentNode.Parent;
  12399. end;
  12400. RealICQContacterTreeView.MoveScrollBarToTop;
  12401. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12402. end;
  12403. {$endregion}
  12404. finally
  12405. RealICQContacterTreeView.EndUpdate;
  12406. //pgcMainWorkArea.EnableAlign;
  12407. end;
  12408. GetOtherBranchs;
  12409. end;
  12410. //-------------
  12411. procedure TMainForm.ShowBranchAndFriends;
  12412. begin
  12413. end;
  12414. //------------------------------------------------------------------------------
  12415. procedure TMainForm.RealICQClientUsersBranchReady(Sender: TObject);
  12416. begin
  12417. end;
  12418. //------------------------------------------------------------------------------
  12419. procedure TMainForm.RealICQClientGettedFriendList(Sender: TObject);
  12420. begin
  12421. RealICQClient.OnGetCanSendSMSCount := Self.RealICQClientGettedCanSendSMSCount;
  12422. lblLoginState.Caption := '载入联系人列表...';
  12423. lblLoginState.Refresh;
  12424. try
  12425. if tsCustomers.Parent <> nil then
  12426. begin
  12427. tsCustomers.Parent := nil;
  12428. tsCustomers.PageControl := nil;
  12429. pgcMainWorkArea.RemoveControl(tsCustomers);
  12430. end;
  12431. except
  12432. end;
  12433. { TODO -olqq -c : 需要考虑 2015/3/14 17:06:30 }
  12434. //读取最近的联系人列表
  12435. try
  12436. LoadLatests;
  12437. except
  12438. end;
  12439. {$region '读取配置信息'}
  12440. try
  12441. //读取组配置信息
  12442. LoadGroupConfigs;
  12443. except
  12444. DeleteFile(TRealICQClient.GetUserDir + GroupConfigXMLFile);
  12445. LoadGroupConfigs;
  12446. end;
  12447. try
  12448. //读取样式
  12449. LoadStyleConfigs;
  12450. except
  12451. DeleteFile(TRealICQClient.GetUserDir + StyleConfigXMLFile);
  12452. LoadStyleConfigs;
  12453. end;
  12454. try
  12455. //读取热键设置
  12456. LoadHotKeyConfigs;
  12457. except
  12458. DeleteFile(TRealICQClient.GetUserDir + HotKeyConfigXMLFile);
  12459. LoadHotKeyConfigs;
  12460. end;
  12461. try
  12462. //读取消息提示和声音配置信息
  12463. LoadHintAndSoundConfigs;
  12464. except
  12465. DeleteFile(TRealICQClient.GetUserDir + HintAndSoundConfigXMLFile);
  12466. LoadHintAndSoundConfigs;
  12467. end;
  12468. try
  12469. //读取文件传输配置选项
  12470. LoadReceiveFileConfigs;
  12471. except
  12472. DeleteFile(TRealICQClient.GetUserDir + ReceiveFileConfigXMLFile);
  12473. LoadReceiveFileConfigs;
  12474. end;
  12475. try
  12476. //读取安全配置选项
  12477. LoadSafeConfigs;
  12478. except
  12479. DeleteFile(TRealICQClient.GetUserDir + SafeConfigXMLFile);
  12480. LoadSafeConfigs;
  12481. end;
  12482. try
  12483. //读取字体,表情等信息
  12484. LoadInputConfigs;
  12485. except
  12486. DeleteFile(TRealICQClient.GetUserDir + InputConfigXMLFile);
  12487. LoadInputConfigs;
  12488. end;
  12489. try
  12490. //读取出差设置
  12491. LoadOfflineAutoResponseSets;
  12492. except
  12493. DeleteFile(TRealICQClient.GetUserDir + OfflineAutoResponseConfigXMLFile);
  12494. LoadOfflineAutoResponseSets;
  12495. end;
  12496. {$endregion}
  12497. SetFlashCaptionOnOnlineValue(False);
  12498. FCanAlert := False;
  12499. // ShowBranchAndUsers(True);
  12500. try
  12501. //重新保存组成员列表
  12502. SaveGroupConfigs;
  12503. except
  12504. end;
  12505. FCanAlert := True;
  12506. ChangeUIColor(FUIMainColor);
  12507. SetFlashCaptionOnOnlineValue(FFlashCaptionOnOnline);
  12508. try
  12509. CheckCacheDir;
  12510. except
  12511. end;
  12512. try
  12513. ShowGroupInterface;
  12514. except
  12515. end;
  12516. spbShowNotReadMessage.Caption := Format('(%d)', [0]);
  12517. RealICQClient.SendGetNewInformation(0);
  12518. Sleep(50);
  12519. pnlForTopMessage.Visible := False;
  12520. RealICQClient.SendGetNewInformation(1);
  12521. if ScrollBoxTeam.Visible or PnlMoreUser.Visible or ScrollBoxMyFriend.Visible or ScrollBoxLatests.Visible then
  12522. else
  12523. SetToolBarState(MyContacters);
  12524. try
  12525. RealICQClientReceivedAdversement(nil);
  12526. except
  12527. end;
  12528. RealICQClient.SendGetMoreServerList;
  12529. // PostMessage(Handle, WM_SIZE, 0, 0);
  12530. //Application.ProcessMessages;
  12531. RealICQClient.SendGetWebUrl;
  12532. if FIsLogout then
  12533. RealICQClient.SendGetMoreServerList;
  12534. MainForm.RealICQClient.OnGettedAddrBookGroups := GettedAddrBookGroups;
  12535. MainForm.RealICQClient.OnManageAddrBookResult := GettedManageAddrBookResult;
  12536. RealICQClient.SendGetAddrBookGroup;
  12537. // if RealICQClient.ShowMiniPage then
  12538. // RealICQClient.SendGetNewInformation(2);
  12539. if TCustomerConfig.GetConfig.ShowGuideView then
  12540. btShowMiniPageClick(nil);
  12541. try
  12542. pgcMainWorkArea.ActivePageIndex := 0;
  12543. except
  12544. end;
  12545. end;
  12546. procedure TMainForm.TimerForGetBranchOnlineStatesTimer(Sender: TObject);
  12547. begin
  12548. miChangeServerClick(nil);
  12549. TimerForGetBranchUsersOnlineStates.Enabled := False;
  12550. TimerForGetBranchUsersOnlineStates.Enabled := True;
  12551. end;
  12552. procedure TMainForm.TimerForGetBranchUsersOnlineStatesTimer(Sender: TObject);
  12553. var
  12554. iLoop, ItemIndex: Integer;
  12555. RealICQContacterTreeView: TRealICQContacterTreeView;
  12556. Branch: TRealICQBranch;
  12557. StrBranchs: string;
  12558. begin
  12559. TimerForGetBranchUsersOnlineStates.Enabled := False;
  12560. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12561. if ItemIndex >= 0 then
  12562. begin
  12563. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12564. StrBranchs := '';
  12565. for iLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12566. begin
  12567. Branch := RealICQContacterTreeView.BranchItems.Objects[iLoop] as TRealICQBranch;
  12568. if Branch.Node.Expanded then
  12569. begin
  12570. StrBranchs := StrBranchs + Branch.BranchID + ',';
  12571. end;
  12572. end;
  12573. miChangeServerClick(nil);
  12574. if Length(StrBranchs) > 0 then
  12575. RealICQClient.SendGetMoreUser(StrBranchs, FCurrentServerID);
  12576. end;
  12577. end;
  12578. procedure TMainForm.btShowMiniPageClick(Sender: TObject);
  12579. var
  12580. AShowMiniPageSet, AShowMiniPageWhenEverLoginSet: Boolean;
  12581. jo: ISuperObject;
  12582. begin
  12583. jo := SO();
  12584. // if TConditionConfig.GetConfig.RemoteUI then
  12585. // begin
  12586. // jo.S['url'] := Format('%s/guideview/index.html?v=%d', [TConditionConfig.GetConfig.RemoteUIHost, GetTickCount]);
  12587. // end
  12588. // else
  12589. // jo.S['url'] := ExtractFilePath(paramstr(0)) + 'html/guideview/#/';
  12590. jo.S['caption'] := '引导页';
  12591. jo.B['center'] := True;
  12592. jo.B['unsizeable'] := True;
  12593. // if not Assigned(AGuideViewForm) then
  12594. AGuideViewForm := TGuideViewForm.Create(Self);
  12595. AGuideViewForm.SetFormInfo(jo.AsString);
  12596. AGuideViewForm.Show;
  12597. // AShowMiniPageSet := RealICQClient.ShowMiniPageSet;
  12598. // AShowMiniPageWhenEverLoginSet := RealICQClient.ShowMiniPageWhenEverLoginSet;
  12599. // try
  12600. // RealICQClient.ShowMiniPageSet := True;
  12601. // RealICQClient.ShowMiniPageWhenEverLoginSet := True;
  12602. // RealICQClientGettedMiniPageSets(nil);
  12603. // finally
  12604. // RealICQClient.ShowMiniPageSet := AShowMiniPageSet;
  12605. // RealICQClient.ShowMiniPageWhenEverLoginSet := AShowMiniPageWhenEverLoginSet;
  12606. // end;
  12607. end;
  12608. procedure TMainForm.RealICQClientGettedMiniPageSets(Sender: TObject);
  12609. var
  12610. SystemMessage: TRealICQSystemMessage;
  12611. UserLoginName: string;
  12612. begin
  12613. //if (Sender <> nil) then
  12614. if not RealICQClient.ShowMiniPageSet then
  12615. Exit;
  12616. SystemMessage := TRealICQSystemMessage.Create;
  12617. SystemMessage.MessageID := 10000;
  12618. SystemMessage.MessageType := mtAdvertisement;
  12619. SystemMessage.AutoOpenWindow := True;
  12620. SystemMessage.Position := mpCenter;
  12621. SystemMessage.Left := 0;
  12622. SystemMessage.Top := 0;
  12623. SystemMessage.Width := 618;
  12624. SystemMessage.Height := 465;
  12625. SystemMessage.Delay := 0;
  12626. SystemMessage.MaxShowTimes := 0;
  12627. SystemMessage.Title := '每日新闻';
  12628. SystemMessage.Content := '';
  12629. UserLoginName := MainForm.RealICQClient.LoginName;
  12630. if Pos('+', UserLoginName) > 0 then
  12631. UserLoginName := Copy(UserLoginName, Pos('+', UserLoginName) + 1, Length(UserLoginName));
  12632. //SystemMessage.URL := Format(MiniPageURL, [UserLoginName]);
  12633. SystemMessage.URL := Format(RealICQClient.WebAppBaseURL + MiniPageURL, [UserLoginName]);
  12634. SystemMessage.AutoCloseTime := 0;
  12635. if RealICQClient.ShowMiniPageWhenEverLoginSet then
  12636. SystemMessage.MaxShowTimes := 0
  12637. else
  12638. SystemMessage.MaxShowTimes := 1;
  12639. RealICQClientReceivedSystemMessage(RealICQClient, SystemMessage);
  12640. end;
  12641. procedure TMainForm.RealICQClientGettedMoreBranchList(Sender: TObject);
  12642. var
  12643. iLoop, jLoop, ItemIndex: Integer;
  12644. RealICQContacterTreeView: TRealICQContacterTreeView;
  12645. BranchInfo: TRealICQBranchInfo;
  12646. Branch, TopBranch: TRealICQBranch;
  12647. OnlineEmployee, EmployeeCount: Integer;
  12648. AFinded: Boolean;
  12649. Employee: TRealICQEmployee;
  12650. begin
  12651. //debug('RealICQClientGettedMoreBranchList','mainform');
  12652. AFinded := False;
  12653. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12654. if ItemIndex >= 0 then
  12655. begin
  12656. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12657. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12658. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12659. for iLoop := 0 to RealICQClient.MoreBranchs.Count - 1 do
  12660. begin
  12661. BranchInfo := RealICQClient.MoreBranchs.Objects[iLoop] as TRealICQBranchInfo;
  12662. if BranchInfo.ParentID = '0' then
  12663. begin
  12664. for jLoop := 0 to RealICQContacterTreeView.BranchItems.Count - 1 do
  12665. begin
  12666. Branch := RealICQContacterTreeView.BranchItems.Objects[jLoop] as TRealICQBranch;
  12667. if (Branch.ParentID = '0') and AnsiSameText(Branch.BranchID, BranchInfo.ID) then
  12668. begin
  12669. AFinded := True;
  12670. Break;
  12671. end;
  12672. end;
  12673. Break;
  12674. end;
  12675. end;
  12676. if not AFinded then
  12677. begin
  12678. try
  12679. RealICQContacterTreeView.Clear;
  12680. FreeAndNil(RealICQContacterTreeView);
  12681. FContacterTreeViews.Delete(ItemIndex);
  12682. except
  12683. Exit;
  12684. end;
  12685. end;
  12686. end;
  12687. if not AFinded then
  12688. ItemIndex := AddContacterTreeView(ScrollBoxMoreUser, LVMoreUsers)
  12689. else
  12690. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12691. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12692. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12693. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12694. RealICQContacterTreeView.AdjustPosition := False;
  12695. RealICQContacterTreeView.AutoChangeOnlineNumeric := False;
  12696. RealICQContacterTreeView.AutoCalculate := False;
  12697. if not AFinded then
  12698. begin
  12699. RealICQContacterTreeView.HideSystemScrollBar;
  12700. tsContacters.DisableAlign;
  12701. RealICQContacterTreeView.BeginUpdate;
  12702. end;
  12703. try
  12704. {$region '添加部门'}
  12705. for iLoop := 0 to RealICQClient.MoreBranchs.Count - 1 do
  12706. begin
  12707. BranchInfo := RealICQClient.MoreBranchs.Objects[iLoop] as TRealICQBranchInfo;
  12708. OnlineEmployee := 0;
  12709. EmployeeCount := 0;
  12710. GetBranchEmpOnlineAndSum(RealICQClient.MoreBranchs, BranchInfo, OnlineEmployee,EmployeeCount);
  12711. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12712. begin
  12713. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12714. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12715. //Branch.EmployeeCount := EmployeeCount;
  12716. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12717. Branch.Update;
  12718. Continue;
  12719. end;
  12720. //-----------------------------------------------------------------
  12721. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12722. Branch.BranchID := BranchInfo.ID;
  12723. Branch.ParentID := BranchInfo.ParentID;
  12724. if Branch.ParentID = '0' then
  12725. begin
  12726. TopBranch := Branch;
  12727. //EmployeeCount:=EmployeeCount-BranchInfo.EmployeeCount;
  12728. if BranchInfo.EmployeeCount > 0 then
  12729. begin
  12730. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12731. end;
  12732. end;
  12733. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12734. //Branch.EmployeeCount:=EmployeeCount;
  12735. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12736. RealICQContacterTreeView.AddBranch(Branch);
  12737. Application.ProcessMessages;
  12738. end;
  12739. {$endregion}
  12740. if not AFinded then
  12741. begin
  12742. RealICQContacterTreeView.ReAlignBranchs;
  12743. if Assigned(TopBranch) then
  12744. TopBranch.Node.Expanded := True;
  12745. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12746. RealICQContacterTreeView.MoveScrollBarToTop;
  12747. end;
  12748. finally
  12749. if not AFinded then
  12750. begin
  12751. RealICQContacterTreeView.EndUpdate;
  12752. tsContacters.EnableAlign;
  12753. end;
  12754. end;
  12755. ImgLoadingMoreBranchs.Visible := False;
  12756. ScrollBoxMoreUser.Visible := True;
  12757. {TimerForGetBranchOnlineStates.Enabled := False;
  12758. TimerForGetBranchOnlineStates.Enabled := True;}
  12759. end;
  12760. //----用户单击部门------------------------------------
  12761. procedure TMainForm.NodeBranchClick(Sender: TObject; Branch: TRealICQBranch);
  12762. var
  12763. RealICQContacterTreeView: TRealICQContacterTreeView;
  12764. ItemIndex: Integer;
  12765. Employee: TRealICQEmployee;
  12766. BranchInfo: TRealICQBranchInfo;
  12767. begin
  12768. //-------获取指定部门下的用户------------------------------------------------
  12769. if (not Branch.IsGetUserList) then// and (FGetUsersTask.IndexOf(Branch.BranchID) < 0) then
  12770. begin
  12771. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12772. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12773. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  12774. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  12775. // BranchInfo := MainForm.RealICQClient.MoreBranchs.Objects[MainForm.RealICQClient.MoreBranchs.IndexOf(Branch.BranchID)] as TRealICQBranchInfo;
  12776. // FGetUsersTask.AddObject(Branch.BranchID, Branch);
  12777. // if (BranchInfo.IsGetUserList) then
  12778. // begin
  12779. // //RealICQContacterTreeView.ReCalculateEmployeeCount(Branch);
  12780. // RealICQClientGettedMoreUserList(nil)
  12781. // end
  12782. // else
  12783. if RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户') < 0 then
  12784. begin
  12785. Employee := TRealICQEmployee.Create('正在下载用户');
  12786. Employee.BranchID := Branch.BranchID;
  12787. RealICQContacterTreeView.AddEmployee(Employee);
  12788. Branch.Node.Expanded := True;
  12789. GetBranchUser(Branch);
  12790. Branch.IsGetUserList := True;
  12791. end;
  12792. end;
  12793. end;
  12794. //----------------------------------------------------------------------------
  12795. procedure TMainForm.GetBranchUser(Branch: TRealICQBranch);
  12796. var
  12797. RealICQContacterTreeView: TRealICQContacterTreeView;
  12798. iIndex: Integer;
  12799. begin
  12800. //debug(Branch.BranchName,'GetBranchUser');
  12801. SetGetMoreUserEvent;
  12802. //iIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12803. //RealICQContacterTreeView := FContacterTreeViews.Objects[iIndex] as TRealICQContacterTreeView;
  12804. //RealICQContacterTreeView.ReCalculateEmployeeCount(Branch);
  12805. RealICQClient.SendGetBranchs(FCurrentServerID, StrToInt(Branch.BranchID));
  12806. Sleep(5);
  12807. RealICQClient.SendGetMoreUser(Branch.BranchID, FCurrentServerID);
  12808. end;
  12809. //----------------------------------------------------------------------
  12810. procedure TMainForm.RealICQClientGettedMoreUserList(Sender: TObject);
  12811. var
  12812. iLoop, ItemIndex: Integer;
  12813. RealICQUser: TRealICQUser;
  12814. RealICQContacterTreeView: TRealICQContacterTreeView;
  12815. Employee: TRealICQEmployee;
  12816. TmpBranch, Branch, TopBranch: TRealICQBranch;
  12817. ParentNode: TTreeNode;
  12818. BranchInfo: TRealICQBranchInfo;
  12819. begin
  12820. TmpBranch := nil;
  12821. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  12822. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  12823. RealICQContacterTreeView.AdjustPosition := False;
  12824. RealICQContacterTreeView.HideSystemScrollBar;
  12825. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  12826. RealICQContacterTreeView.OnItemOnline := nil;
  12827. RealICQContacterTreeView.OnItemOffline := nil;
  12828. tsContacters.DisableAlign;
  12829. RealICQContacterTreeView.BeginUpdate;
  12830. try
  12831. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf('正在下载用户');
  12832. if ItemIndex >= 0 then
  12833. begin
  12834. Employee := RealICQContacterTreeView.GetEmployee('正在下载用户');
  12835. ParentNode := Employee.Node.Parent;
  12836. TmpBranch := TRealICQBranch(ParentNode.Data);
  12837. TmpBranch.IsGetUserList := True;
  12838. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12839. end;
  12840. {$region '添加联系人'}
  12841. for iLoop := RealICQClient.MoreUsers.Count - 1 downto 0 do
  12842. begin
  12843. RealICQUser := RealICQClient.MoreUsers.Objects[iLoop] as TRealICQUser;
  12844. ItemIndex := RealICQContacterTreeView.BranchItems.IndexOf(RealICQUser.BranchID);
  12845. if ItemIndex < 0 then
  12846. Continue;
  12847. ItemIndex := RealICQContacterTreeView.EmployeeItems.IndexOf(RealICQUser.LoginName);
  12848. if ItemIndex >= 0 then
  12849. RealICQContacterTreeView.EmployeeItems.Delete(ItemIndex);
  12850. Employee := TRealICQEmployee.Create(RealICQUser.LoginName);
  12851. Employee.BranchID := RealICQUser.BranchID; //很重要
  12852. RealICQContacterTreeView.AddEmployee(Employee);
  12853. //UpdateEmployeeNode(Employee, RealICQUser, False);
  12854. TUsersService.GetUsersService.UpdateTreeNode(RealICQContacterTreeView, Employee, RealICQUser);
  12855. end;
  12856. {$endregion}
  12857. {$region '添加部门'}
  12858. for iLoop := RealICQClient.MoreBranchs2.Count - 1 downto 0 do
  12859. begin
  12860. BranchInfo := RealICQClient.MoreBranchs2.Objects[iLoop] as TRealICQBranchInfo;
  12861. if (RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)) >= 0 then
  12862. begin
  12863. Branch := RealICQContacterTreeView.BranchItems.Objects[RealICQContacterTreeView.BranchItems.IndexOf(BranchInfo.ID)] as TRealICQBranch;
  12864. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12865. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12866. Branch.Update;
  12867. Continue;
  12868. end;
  12869. Branch := TRealICQBranch.Create(BranchInfo.BranchName);
  12870. Branch.BranchID := BranchInfo.ID;
  12871. Branch.ParentID := BranchInfo.ParentID;
  12872. if Branch.ParentID = '0' then
  12873. begin
  12874. TopBranch := Branch;
  12875. if BranchInfo.EmployeeCount > 0 then
  12876. begin
  12877. RealICQClient.SendGetMoreUser(TopBranch.BranchID, FCurrentServerID);
  12878. end;
  12879. end;
  12880. Branch.OnlineEmployee := BranchInfo.OnlineEmployee;
  12881. Branch.EmployeeCount := BranchInfo.EmployeeCount;
  12882. RealICQContacterTreeView.AddBranch(Branch);
  12883. Application.ProcessMessages;
  12884. end;
  12885. {$endregion}
  12886. // PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12887. finally
  12888. RealICQContacterTreeView.EndUpdate;
  12889. if TmpBranch <> nil then
  12890. begin
  12891. PostMessage(RealICQContacterTreeView.Handle, WM_SIZE, 0, 0);
  12892. Debug(TmpBranch.BranchName, '添加全市用户列表');
  12893. TmpBranch.Node.Expanded := True;
  12894. end;
  12895. tsContacters.EnableAlign;
  12896. end;
  12897. end;
  12898. //-------------------桌面备份---------------------------------------------------
  12899. procedure TMainForm.RealICQClientGettedPermission(Sender: TObject);
  12900. begin
  12901. spbNetworkBackup.Visible := RealICQClient.UserPermission.EnableBackup;
  12902. end;
  12903. //----------------------------------------------------------------------
  12904. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteBeControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12905. var
  12906. TalkingForm: TTalkingForm;
  12907. begin
  12908. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12909. if TalkingForm = nil then
  12910. Exit;
  12911. if TalkingForm.CanWriteMessage then
  12912. TalkingForm.ShowGettedRemoteControlTransmiteControlBeControlResponse(AAcceptted);
  12913. end;
  12914. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteConnectted(Sender: TObject; ALoginName: string);
  12915. var
  12916. TalkingForm: TTalkingForm;
  12917. begin
  12918. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12919. if TalkingForm = nil then
  12920. Exit;
  12921. if TalkingForm.CanWriteMessage then
  12922. TalkingForm.ShowGettedRemoteControlTransmiteConnectted;
  12923. end;
  12924. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlRequest(Sender: TObject; ALoginName: string);
  12925. var
  12926. TalkingForm: TTalkingForm;
  12927. begin
  12928. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12929. if TalkingForm = nil then
  12930. Exit;
  12931. if TalkingForm.CanWriteMessage then
  12932. TalkingForm.ShowGettedRemoteControlTransmiteControlRequest;
  12933. end;
  12934. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteControlResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12935. var
  12936. TalkingForm: TTalkingForm;
  12937. begin
  12938. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12939. if TalkingForm = nil then
  12940. Exit;
  12941. if TalkingForm.CanWriteMessage then
  12942. TalkingForm.ShowGettedRemoteControlTransmiteControlControlResponse(AAcceptted);
  12943. end;
  12944. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteRequest(Sender: TObject; ALoginName: string);
  12945. var
  12946. AShowActive: Boolean;
  12947. TalkingForm: TTalkingForm;
  12948. iWaitTimes: Integer;
  12949. begin
  12950. AShowActive := (RealICQClient.IsAutoState = True) and (RealICQClient.Me.LoginState = stLeave) and AnsiSameText(RealICQClient.Me.LeaveMessage, '忙碌');
  12951. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12952. if TalkingForm = nil then
  12953. begin
  12954. TalkingForm := OpenTalkingForm(ALoginName, not AShowActive, Sender as TRealICQClient);
  12955. end;
  12956. iWaitTimes := 0;
  12957. while not TalkingForm.CanWriteMessage do
  12958. begin
  12959. Application.ProcessMessages;
  12960. Inc(iWaitTimes);
  12961. if iWaitTimes > 1000 then
  12962. break;
  12963. Sleep(10);
  12964. end;
  12965. if (GetForegroundWindow <> TalkingForm.Handle) then
  12966. begin
  12967. FlashWindow(TalkingForm.Handle, True);
  12968. if PlaySoundOnGetMessage then
  12969. PlayEventSound(FMessageEventSound);
  12970. end;
  12971. TalkingForm.ShowGettedRemoteControlTransmiteRequest;
  12972. end;
  12973. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteResponse(Sender: TObject; ALoginName: string; AAcceptted: Boolean);
  12974. var
  12975. TalkingForm: TTalkingForm;
  12976. begin
  12977. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12978. if TalkingForm = nil then
  12979. Exit;
  12980. if TalkingForm.CanWriteMessage then
  12981. TalkingForm.ShowGettedRemoteControlTransmiteResponse(AAcceptted);
  12982. end;
  12983. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenImage(Sender: TObject; ALoginName: string; ALeft, ATop, AWidth, AHeight: Integer; AP: TPoint; ABitmap: TBitmap);
  12984. begin
  12985. if RemoteControlForm = nil then
  12986. Exit;
  12987. RemoteControlForm.imgRCScreen.Picture.Bitmap.Canvas.CopyRect(Rect(ALeft, ATop, ALeft + AWidth, ATop + AHeight), ABitmap.canvas, Rect(0, 0, ABitmap.width, ABitmap.height)); //拷贝
  12988. end;
  12989. procedure TMainForm.RealICQClientGettedRemoteControlTransmiteScreenSize(Sender: TObject; ALoginName: string; AWidth, AHeight: Integer);
  12990. var
  12991. TalkingForm: TTalkingForm;
  12992. begin
  12993. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  12994. if TalkingForm = nil then
  12995. Exit;
  12996. TalkingForm.ShowGettedRemoteControlTransmiteRecvedScreenSize(AWidth, AHeight);
  12997. end;
  12998. //------------------------------------------------------------------------------
  12999. procedure TMainForm.CheckCacheDir;
  13000. var
  13001. DSearchRec: TSearchRec;
  13002. FindResult: Integer;
  13003. begin
  13004. FindResult := FindFirst(CacheDir + '*' + CacheFileExt, faAnyFile, DSearchRec);
  13005. while FindResult = 0 do
  13006. begin
  13007. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13008. begin
  13009. try
  13010. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  13011. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  13012. except
  13013. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  13014. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  13015. end;
  13016. end;
  13017. FindResult := FindNext(DSearchRec);
  13018. end;
  13019. FindResult := FindFirst(CacheDir + '*' + CacheResumeSizeFileExt, faAnyFile, DSearchRec);
  13020. while FindResult = 0 do
  13021. begin
  13022. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13023. begin
  13024. try
  13025. if Date - StrToDateTime(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2)) > AudoDeleteCacheFileDate then
  13026. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  13027. except
  13028. if Date - StrToDateTime(AnsiReplaceStr(GetFileTimeInfo(CacheDir + ExtractFileName(DSearchRec.Name), 2), '-', '/')) > AudoDeleteCacheFileDate then
  13029. DeleteFile(CacheDir + ExtractFileName(DSearchRec.Name));
  13030. end;
  13031. end;
  13032. FindResult := FindNext(DSearchRec);
  13033. end;
  13034. if GetDirectorySize(CacheDir) > MaxCacheDirSize * 1024 * 1024 then
  13035. begin
  13036. if MessageBox(Handle, PChar('Cache目录的大小已经超过 ' + IntToStr(MaxCacheDirSize) + 'MB,是否打开Cache目录进行管理?'), '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_OK then
  13037. WinExec(PChar('explorer "' + CacheDir + '"'), SW_SHOWNORMAL);
  13038. end;
  13039. end;
  13040. //------------------------------------------------------------------------------
  13041. procedure TMainForm.ShowWebTabs;
  13042. var
  13043. iLoop: Integer;
  13044. TabSheet: TTabSheet;
  13045. Bitmap: TBitmap;
  13046. WebPanel: TWebPanel;
  13047. EUser, EPass: string;
  13048. begin
  13049. //先删除
  13050. try
  13051. for iLoop := 0 to FWebTabs.Count - 1 do
  13052. begin
  13053. TabSheet := FWebTabs[iLoop];
  13054. TabSheet.OnShow := nil;
  13055. TabSheet.PageControl := nil;
  13056. FreeAndNil(TabSheet);
  13057. end;
  13058. except
  13059. end;
  13060. FWebTabs.Clear;
  13061. //显示
  13062. pgcMainWorkArea.DisableAlign;
  13063. try
  13064. for iLoop := 0 to FWebPanels.Count - 1 do
  13065. begin
  13066. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  13067. if (not WebPanel.Show) and (not WebPanel.MustShow) then
  13068. Continue;
  13069. if ((AnsiPos('邮件', WebPanel.FName) > 0) or (AnsiPos('邮箱', WebPanel.FName) > 0) or (AnsiPos('信箱', WebPanel.FName) > 0)) and (WebPanel.MustShow) then
  13070. begin
  13071. if WebPanel.UserIMLoginName then
  13072. EUser := RealICQClient.LoginName
  13073. else
  13074. EUser := WebPanel.CustomLoginName;
  13075. if WebPanel.UserIMPassword then
  13076. EPass := RealICQClient.Password
  13077. else
  13078. EPass := WebPanel.CustomPassword;
  13079. //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]));
  13080. end;
  13081. TabSheet := TTabSheet.Create(pgcMainWorkArea);
  13082. TabSheet.Parent := pgcMainWorkArea;
  13083. TabSheet.DoubleBuffered := True;
  13084. TabSheet.Caption := WebPanel.Name;
  13085. TabSheet.ShowHint := False;
  13086. if FileExists(WebPanel.Image) then
  13087. begin
  13088. Bitmap := GetSamllBitmap(WebPanel.Image, 32, 32, False);
  13089. try
  13090. try
  13091. Bitmap.LoadFromFile(WebPanel.Image);
  13092. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  13093. ImgLstPageControl.Add(Bitmap, nil);
  13094. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  13095. except
  13096. //
  13097. end;
  13098. finally
  13099. FreeAndNil(Bitmap);
  13100. end;
  13101. end
  13102. else
  13103. TabSheet.ImageIndex := 2; //?号图标
  13104. TabSheet.OnShow := WebTabShow;
  13105. TabSheet.Tag := iLoop;
  13106. TabSheet.PageControl := pgcMainWorkArea;
  13107. FWebTabs.Add(TabSheet);
  13108. end;
  13109. finally
  13110. pgcMainWorkArea.EnableAlign;
  13111. end;
  13112. end;
  13113. //------------------------------------------------------------------------------
  13114. procedure TMainForm.RealICQClientGetWebTabs(Sender: TObject; ATabCount: Integer; WebTabRecords: array of TWebTabRecord);
  13115. var
  13116. iLoop, jLoop: Integer;
  13117. WebTabRecord: TWebTabRecord;
  13118. WebPanel: TWebPanel;
  13119. FFinded: Boolean;
  13120. AWebPanels: TStringList;
  13121. begin
  13122. LoadWebPanelsFromXML;
  13123. AWebPanels := TStringList.Create;
  13124. for iLoop := 0 to FWebPanels.Count - 1 do
  13125. begin
  13126. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  13127. AWebPanels.AddObject(WebPanel.ID, WebPanel);
  13128. end;
  13129. FWebPanels.Clear;
  13130. for iLoop := Low(WebTabRecords) to High(WebTabRecords) do
  13131. begin
  13132. WebTabRecord := WebTabRecords[iLoop];
  13133. if AWebPanels.IndexOf(WebTabRecord.ID) < 0 then
  13134. begin
  13135. WebPanel := TWebPanel.Create;
  13136. //FWebPanels.AddObject(WebTabRecord.Name, WebPanel);
  13137. WebPanel.FUserIMLoginName := True;
  13138. WebPanel.FUserIMPassword := True;
  13139. WebPanel.FCustomLoginName := '';
  13140. WebPanel.FCustomPassword := '';
  13141. WebPanel.FShow := False;
  13142. end
  13143. else
  13144. begin
  13145. WebPanel := AWebPanels.Objects[AWebPanels.IndexOf(WebTabRecord.ID)] as TWebPanel;
  13146. end;
  13147. WebPanel.MustShow := WebTabRecord.MustShow;
  13148. if WebPanel.MustShow then
  13149. WebPanel.FShow := True;
  13150. WebPanel.FID := WebTabRecord.ID;
  13151. WebPanel.FName := WebTabRecord.Name;
  13152. WebPanel.FURL := WebTabRecord.URL;
  13153. WebPanel.FImage := WebTabRecord.IconFile;
  13154. WebPanel.Content := WebTabRecord.Content;
  13155. if AnsiSameText(WebTabRecord.Method, 'GET') then
  13156. WebPanel.FNavigateType := ntGET
  13157. else if AnsiSameText(WebTabRecord.Method, 'POST') then
  13158. WebPanel.FNavigateType := ntPOST
  13159. else
  13160. WebPanel.FNavigateType := ntFill;
  13161. WebPanel.FPostFields := WebTabRecord.PostFields;
  13162. FWebPanels.AddObject(WebPanel.FID, WebPanel);
  13163. end;
  13164. {for iLoop := FWebPanels.Count - 1 downto 0 do
  13165. begin
  13166. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  13167. //if WebPanel.MustShow then
  13168. begin
  13169. FFinded := False;
  13170. for jLoop := Low(WebTabRecords) to High(WebTabRecords) do
  13171. begin
  13172. WebTabRecord := WebTabRecords[jLoop];
  13173. if AnsiSameStr(WebTabRecord.ID, WebPanel.ID) then
  13174. begin
  13175. FFinded := True;
  13176. Break;
  13177. end;
  13178. end;
  13179. if not FFinded then
  13180. begin
  13181. FreeAndNil(WebPanel);
  13182. FWebPanels.Delete(iLoop);
  13183. end;
  13184. end;
  13185. end; }
  13186. SaveWebPanelsToXML;
  13187. DisplayWebs := False;
  13188. ShowWebTabs;
  13189. DisplayWebs := True;
  13190. end;
  13191. //------------------------------------------------------------------------------
  13192. procedure TMainForm.RealICQClientInputting(Sender: TObject; ALoginName: string; AInputting: Boolean);
  13193. var
  13194. TalkingForm: TTalkingForm;
  13195. begin
  13196. TalkingForm := GetTalkingForm(ALoginName, Sender as TRealICQClient);
  13197. if TalkingForm = nil then
  13198. Exit;
  13199. TalkingForm.ShowInputting(AInputting);
  13200. end;
  13201. //------------------------------------------------------------------------------
  13202. procedure TMainForm.RealICQClientJoinedTeam(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13203. var
  13204. AlertMessage: string;
  13205. RealICQUser: TRealICQUser;
  13206. begin
  13207. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13208. if RealICQUser.DisplayName = '' then
  13209. AlertMessage := RealICQUser.LoginName
  13210. else
  13211. AlertMessage := RealICQUser.DisplayName;
  13212. if ARealICQTeam.IsTempTeam then
  13213. AlertMessage := AlertMessage + ' 将您添加进了 临时多人会话'
  13214. else
  13215. AlertMessage := AlertMessage + ' 将您添加进了群组: ' + ARealICQTeam.TeamCaption;
  13216. ShowNotifyAlertForm(AlertMessage);
  13217. AddMessageHistory(smSimple, AlertMessage, nil);
  13218. UpdateTeamTalkingForm(ARealICQTeam);
  13219. end;
  13220. //------------------------------------------------------------------------------
  13221. procedure TMainForm.RealICQClientJoinTeamRequest(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName, ATag: string);
  13222. begin
  13223. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ARealICQTeam.TeamCaption, ARealICQTeam.TeamID]), nil);
  13224. ShowJoinTeamRequestWindow(Self, ARealICQTeam.TeamID, ARealICQTeam.TeamCaption, ALoginName, ATag);
  13225. end;
  13226. //------------------------------------------------------------------------------
  13227. procedure TMainForm.RealICQClientJoinTeamResponse(Sender: TObject; ATeamID: string; ALoginName: string; ATag: string; AAcceptted: Boolean);
  13228. var
  13229. ATeam: TRealICQTeam;
  13230. begin
  13231. ATeam := TTeamsAdapter.GetTeam(ATeamID);
  13232. if ATeam = nil then
  13233. Exit;
  13234. if AAcceptted then
  13235. begin
  13236. AddMessageHistory(smSimple, ALoginName + ' 接受了您加入群组 ' + ATeam.TeamCaption + ' 的请求', nil);
  13237. ShowNotifyAlertForm(ALoginName + ' 接受您加入群组 ' + ATeam.TeamCaption + ' 的请求');
  13238. end
  13239. else
  13240. begin
  13241. if Length(ATag) = 0 then
  13242. ATag := '无';
  13243. AddMessageHistory(smSimple, ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption, nil);
  13244. ShowNotifyAlertForm(ALoginName + ' 拒绝您加入群组 ' + ATeam.TeamCaption + #$D#$A + '附言 :' + ATag);
  13245. end;
  13246. end;
  13247. //------------------------------------------------------------------------------
  13248. procedure TMainForm.RealICQClientTeamDisbanded(Sender: TObject; ARealICQTeam: TRealICQTeam);
  13249. var
  13250. iIndex: Integer;
  13251. AlertMessage: string;
  13252. RealICQUser: TRealICQUser;
  13253. begin
  13254. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13255. if iIndex >= 0 then
  13256. begin
  13257. FLVTeams.Items.Delete(iIndex);
  13258. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  13259. if RealICQUser = RealICQClient.Me then
  13260. AlertMessage := '您'
  13261. else if RealICQUser.DisplayName = '' then
  13262. AlertMessage := RealICQUser.LoginName
  13263. else
  13264. AlertMessage := RealICQUser.DisplayName;
  13265. if ARealICQTeam.IsTempTeam then
  13266. AlertMessage := AlertMessage + ' 解散了 多人对话'
  13267. else
  13268. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  13269. ShowNotifyAlertForm(AlertMessage);
  13270. AddMessageHistory(smSimple, AlertMessage, nil);
  13271. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13272. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13273. UpdateTeamTalkingForm(ARealICQTeam);
  13274. end;
  13275. end;
  13276. procedure TMainForm.RealICQClientTeamQuitted(Sender: TObject; ARealICQTeam: TRealICQTeam; ALoginName: string);
  13277. var
  13278. iIndex: Integer;
  13279. AlertMessage: string;
  13280. begin
  13281. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  13282. if iIndex >= 0 then
  13283. begin
  13284. FLVTeams.Items.Delete(iIndex);
  13285. if ARealICQTeam.IsTempTeam then
  13286. AlertMessage := '您 退出了 多人对话'
  13287. else
  13288. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  13289. ShowNotifyAlertForm(AlertMessage);
  13290. AddMessageHistory(smSimple, AlertMessage, nil);
  13291. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  13292. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  13293. UpdateTeamTalkingForm(ARealICQTeam);
  13294. end;
  13295. end;
  13296. //------------------------------------------------------------------------------
  13297. procedure TMainForm.SetFlashCaptionOnOnlineValue(Value: Boolean);
  13298. var
  13299. iLoop: Integer;
  13300. GroupName: string;
  13301. RealICQContacterListView: TRealICQContacterListView;
  13302. RealICQContacterTreeView: TRealICQContacterTreeView;
  13303. begin
  13304. for iLoop := 0 to FContacterListViews.Count - 1 do
  13305. begin
  13306. GroupName := FContacterListViews[iLoop];
  13307. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  13308. RealICQContacterListView.FlashCaptionOnOnline := Value and (GroupName <> LVStrangers) and (GroupName <> LVBlacklists) and (GroupName <> LVLatests);
  13309. end;
  13310. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  13311. begin
  13312. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  13313. RealICQContacterTreeView.FlashCaptionOnOnline := Value;
  13314. RealICQContacterTreeView.ReDrawAll;
  13315. end;
  13316. end;
  13317. //------------------------------------------------------------------------------
  13318. procedure TMainForm.RealICQClientUserExInformationChanged(Sender: TObject; RealICQUser: TRealICQUser);
  13319. begin
  13320. if (OptionsForm <> nil) and (RealICQUser = RealICQClient.Me) then
  13321. begin
  13322. OptionsForm.GetSets;
  13323. end;
  13324. UpdateSeeInformationForm(RealICQUser);
  13325. UpdateTalkingForm(RealICQUser);
  13326. UpdateSMSForm(RealICQUser);
  13327. end;
  13328. //------------------------------------------------------------------------------
  13329. procedure TMainForm.RealICQClientUserInformationReady(Sender: TObject; RealICQUser: TRealICQUser);
  13330. var
  13331. ItemIndex: Integer;
  13332. RealICQContacterListItem: TRealICQContacterListItem;
  13333. RealICQContacterListView: TRealICQContacterListView;
  13334. RealICQFriendTreeView: TRealICQContacterTreeView;
  13335. RealICQContacterTreeView: TRealICQContacterTreeView;
  13336. Employee: TRealICQEmployee;
  13337. Friend: TRealICQEmployee;
  13338. iIndex, iLoop, jLoop: Integer;
  13339. GroupName: string;
  13340. GroupMembers: TStringList;
  13341. begin
  13342. if UserCardForm <> nil then
  13343. begin
  13344. if AnsiSameText(UserCardForm.LoginName, RealICQUser.LoginName) then
  13345. UserCardForm.LoginName := RealICQUser.LoginName;
  13346. end;
  13347. {$region '如果正处于过滤用户的状态,则同时也更新FSearchListView中的数据'}
  13348. if FSearchListViewInVisible then
  13349. begin
  13350. ItemIndex := FSearchListView.Items.IndexOf(RealICQUser.LoginName);
  13351. if ItemIndex >= 0 then
  13352. begin
  13353. RealICQContacterListItem := FSearchListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13354. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13355. TUsersService.GetUsersService.UpdateListItem(FSearchListView, RealICQContacterListItem, RealICQUser);
  13356. end;
  13357. end;
  13358. {$endregion}
  13359. {$region '更新“最近联系人列表”中的数据'}
  13360. ItemIndex := FLVLatests.Items.IndexOf(RealICQUser.LoginName);
  13361. if ItemIndex >= 0 then
  13362. begin
  13363. RealICQContacterListItem := FLVLatests.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13364. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13365. TUsersService.GetUsersService.UpdateListItem(FLVLatests, RealICQContacterListItem, RealICQUser);
  13366. end;
  13367. {$endregion}
  13368. {$region 'wmCorporation工作模式或采用了树型方式组织好友列表'}
  13369. if TUsersService.GetUsersService.IsWorkmateOrFriend(RealICQUser.LoginName) then
  13370. begin
  13371. if AnsiSameText(RealICQUser.LoginName, RealICQClient.LoginName) then
  13372. ShowMeInformation;
  13373. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  13374. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13375. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13376. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13377. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13378. if Employee <> nil then
  13379. //UpdateEmployeeNode(Employee, RealICQUser, True);
  13380. TUsersService.GetUsersService.UpdateTreeNode(RealICQContacterTreeView, Employee, RealICQUser);
  13381. ItemIndex := FContacterTreeViews.IndexOf(LvFriends);
  13382. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13383. Friend := RealICQFriendTreeView.GetEmployee(RealICQUser.LoginName);
  13384. if Friend <> nil then
  13385. //UpdateFriendNode(Friend, RealICQUser, True);
  13386. TUsersService.GetUsersService.UpdateTreeNode(RealICQFriendTreeView, Friend, RealICQUser);
  13387. {$region '更新自定义组中的信息'}
  13388. if RealICQClient.WorkingMode = wmCorporation then
  13389. begin
  13390. for iLoop := 0 to FGroups.Count - 1 do
  13391. begin
  13392. GroupName := FGroups[iLoop];
  13393. GroupMembers := FGroups.Objects[iLoop] as TStringList;
  13394. for jLoop := 0 to GroupMembers.Count - 1 do
  13395. begin
  13396. if AnsiSameText(GroupMembers[jLoop], RealICQClient.LoginName) then
  13397. begin
  13398. iIndex := FContacterListViews.IndexOf(GroupName);
  13399. if iIndex >= 0 then
  13400. begin
  13401. RealICQContacterListView := FContacterListViews.Objects[iIndex] as TRealICQContacterListView;
  13402. if RealICQContacterListView.Items.IndexOf(RealICQClient.LoginName) = -1 then
  13403. RealICQContacterListView.Items.Add(RealICQClient.LoginName);
  13404. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  13405. if ItemIndex >= 0 then
  13406. begin
  13407. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  13408. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  13409. TUsersService.GetUsersService.UpdateListItem(RealICQContacterListView, RealICQContacterListItem, RealICQUser);
  13410. end;
  13411. end; //if
  13412. end; //if
  13413. end; //for jLoop
  13414. end; //for iLoop
  13415. {$endregion}
  13416. end;
  13417. {$endregion}
  13418. end;
  13419. {$region '更新“全市”中的数据'}
  13420. if RealICQClient.MoreUsers.IndexOf(RealICQUser.LoginName) >= 0 then
  13421. begin
  13422. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  13423. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13424. RealICQContacterTreeView.OnHeadImageMouseEnter := NodeOnHeadImageMouseEnter;
  13425. RealICQContacterTreeView.OnHeadImageMouseLeave := NodeOnHeadImageMouseLeave;
  13426. RealICQContacterTreeView.OnItemOnline := nil;
  13427. RealICQContacterTreeView.OnItemOffline := nil;
  13428. RealICQContacterTreeView.AutoChangeOnlineNumeric := True;
  13429. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13430. if Employee <> nil then
  13431. //UpdateEmployeeNode(Employee, RealICQUser, True);
  13432. TUsersService.GetUsersService.UpdateTreeNode(RealICQContacterTreeView, Employee, RealICQUser);
  13433. end;
  13434. {$endregion}
  13435. UpdateSeeInformationForm(RealICQUser);
  13436. UpdateTalkingForm(RealICQUser);
  13437. //debug('8','RealICQClientUserInformationReady');
  13438. UpdateSMSForm(RealICQUser);
  13439. UpdateMemberInfoOfTeamOptionsForm(RealICQUser);
  13440. UpdateAddrBookInfo(RealICQUser);
  13441. end;
  13442. procedure TMainForm.UpdateAddrBookInfo(RealICQUser: TRealICQUser);
  13443. var
  13444. iLoop, ItemIndex: Integer;
  13445. Employee: TRealICQEmployee;
  13446. TmpRealICQUser: TRealICQUser;
  13447. RealICQContacterTreeView: TRealICQContacterTreeView;
  13448. begin
  13449. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVAddrBook);
  13450. if ItemIndex < 0 then
  13451. Exit;
  13452. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  13453. Employee := RealICQContacterTreeView.GetEmployee(RealICQUser.LoginName);
  13454. if (Employee <> nil) then
  13455. begin
  13456. Employee.Mobile := RealICQUser.Mobile;
  13457. Employee.SMSHint := RealICQUser.Mobile;
  13458. Employee.Tel := RealICQUser.Tel;
  13459. Employee.Update;
  13460. end
  13461. else
  13462. Exit;
  13463. ItemIndex := MainForm.RealICQClient.AddrBookUsers.IndexOf(RealICQUser.LoginName);
  13464. if ItemIndex < 0 then
  13465. Exit;
  13466. TmpRealICQUser := MainForm.RealICQClient.AddrBookUsers.Objects[ItemIndex] as TRealICQUser;
  13467. TmpRealICQUser.Mobile := RealICQUser.Mobile;
  13468. TmpRealICQUser.Tel := RealICQUser.Tel;
  13469. end;
  13470. //------------------------------------------------------------------------------
  13471. procedure TMainForm.ShowNetWorkDiskSpaceInfo;
  13472. begin
  13473. lblNDSpaceSize.Caption := Format('%0fM/%dM', [RealICQNetWorkDiskClient.UsedSpaceSize / (1024 * 1024), RealICQNetWorkDiskClient.MaxSpaceSize div (1024 * 1024)]);
  13474. end;
  13475. //------------------------------------------------------------------------------
  13476. procedure TMainForm.RealICQNetWorkDiskClientConnectStateChanged(Sender: TObject);
  13477. begin
  13478. if tsNetWorkDisk.Parent = nil then
  13479. Exit;
  13480. try
  13481. FConfirmReplaceResult := -1;
  13482. if RealICQNetWorkDiskClient.Connectting then
  13483. begin
  13484. lblNDState.Caption := '正在连接...';
  13485. lblNDSpaceSize.Caption := '';
  13486. end
  13487. else if RealICQNetWorkDiskClient.Connected then
  13488. begin
  13489. lblNDState.Caption := '已连接';
  13490. ShowNetWorkDiskSpaceInfo;
  13491. end
  13492. else
  13493. begin
  13494. lblNDState.Caption := '连接已断开';
  13495. lblNDSpaceSize.Caption := '';
  13496. try
  13497. if FLVNetWorkDisk <> nil then
  13498. begin
  13499. FLVNetWorkDisk.Items.Clear;
  13500. FLVNetWorkDisk.ReDrawAll;
  13501. end;
  13502. except
  13503. end;
  13504. try
  13505. spbNDCancelAllClick(spbNDCancelAll);
  13506. except
  13507. end;
  13508. end;
  13509. spbNDMoveUp.Enabled := RealICQNetWorkDiskClient.Connected;
  13510. spbNDRefresh.Enabled := spbNDMoveUp.Enabled;
  13511. spbNDNewDir.Enabled := spbNDMoveUp.Enabled;
  13512. spbNDDelete.Enabled := spbNDMoveUp.Enabled;
  13513. shpNDDirBorder.Enabled := spbNDMoveUp.Enabled;
  13514. edNDDir.Enabled := spbNDMoveUp.Enabled;
  13515. spbNDUpload.Enabled := spbNDMoveUp.Enabled;
  13516. spbNDDownload.Enabled := spbNDMoveUp.Enabled;
  13517. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13518. spbNDConnect.Enabled := (not RealICQNetWorkDiskClient.Connected) and (not RealICQNetWorkDiskClient.Connectting) and (RealICQClient.Connected);
  13519. spbNDDisconnect.Enabled := not spbNDConnect.Enabled and not RealICQNetWorkDiskClient.Connectting;
  13520. if not edNDDir.Enabled then
  13521. edNDDir.Text := '';
  13522. except
  13523. end;
  13524. end;
  13525. //------------------------------------------------------------------------------
  13526. procedure TMainForm.ItemShowHint(Sender: TObject; Item: TRealICQContacterListItem; var HintStr: string);
  13527. var
  13528. AFile: TRealICQNetWorkDiskFile;
  13529. ADirectory: TRealICQNetWorkDiskDirectory;
  13530. AUploadMission: TUploadMission;
  13531. ADownloadMission: TDownloadMission;
  13532. begin
  13533. if Item = nil then
  13534. Exit;
  13535. if Sender = FLVNetWorkDisk then
  13536. begin
  13537. if Copy(Item.LoginName, 1, 1) = 'D' then
  13538. begin
  13539. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  13540. HintStr := '目录名称: ' + Trim(ADirectory.Name) + #$D#$A;
  13541. HintStr := HintStr + '创建时间: ' + DateTimeToStr(ADirectory.CreateDate);
  13542. end
  13543. else if Copy(Item.LoginName, 1, 1) = 'F' then
  13544. begin
  13545. AFile := TRealICQNetWorkDiskFile(Item.Data);
  13546. HintStr := '文件名称: ' + Trim(AFile.Name) + #$D#$A;
  13547. HintStr := HintStr + '创建时间: ' + Trim(DateTimeToStr(AFile.CreateDate)) + #$D#$A;
  13548. HintStr := HintStr + '修改时间: ' + Trim(DateTimeToStr(AFile.ModifyDate)) + #$D#$A;
  13549. HintStr := HintStr + '大小: ' + Trim(Item.Watchword);
  13550. end;
  13551. end;
  13552. if Sender = FLVNetWorkDiskUploadingFiles then
  13553. begin
  13554. if AnsiSameText(HintStr, '取消') then
  13555. Exit;
  13556. AUploadMission := TUploadMission(Item.Data);
  13557. HintStr := AUploadMission.Name;
  13558. end;
  13559. if Sender = FLVNetWorkDiskDownloadingFiles then
  13560. begin
  13561. if AnsiSameText(HintStr, '取消') then
  13562. Exit;
  13563. ADownloadMission := TDownloadMission(Item.Data);
  13564. if ADownloadMission.FDownloadMissionType = mtDir then
  13565. HintStr := ADownloadMission.DirectoryName
  13566. else
  13567. HintStr := ADownloadMission.FileName;
  13568. end;
  13569. end;
  13570. procedure TMainForm.LblHintClick(Sender: TObject);
  13571. var
  13572. FAutoSaveMessage: Boolean;
  13573. begin
  13574. FAutoSaveMessage := AutoSaveMessage;
  13575. AutoSaveMessage := False;
  13576. try
  13577. RealICQClientReceivedSystemMessage(RealICQClient, FTopSystemMessage);
  13578. finally
  13579. btCloseTopMessageClick(nil);
  13580. AutoSaveMessage := FAutoSaveMessage;
  13581. end;
  13582. end;
  13583. //------------------------------------------------------------------------------
  13584. procedure TMainForm.NDSelectItemChanged(Item: TRealICQContacterListItem);
  13585. begin
  13586. if not pnlNDMissions.Visible then
  13587. begin
  13588. spbNDDelete.Enabled := (FLVNetWorkDisk <> nil) and (FLVNetWorkDisk.SelCount > 0);
  13589. spbNDDownload.Enabled := spbNDDelete.Enabled;
  13590. end;
  13591. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  13592. end;
  13593. //------------------------------------------------------------------------------
  13594. procedure TMainForm.NDItemMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  13595. begin
  13596. end;
  13597. //------------------------------------------------------------------------------
  13598. procedure TMainForm.NDMissionItemIconButtonClick(Sender: TObject; Item: TRealICQContacterListItem; IconButtonType: TRealICQContacterListItemIconButtonType);
  13599. var
  13600. UploadMission: TUploadMission;
  13601. DownloadMission: TDownloadMission;
  13602. AMissionID: string;
  13603. begin
  13604. if Sender = FLVNetWorkDiskUploadingFiles then
  13605. begin
  13606. try
  13607. if not Assigned(Item) then
  13608. Exit;
  13609. UploadMission := TUploadMission(Item.Data);
  13610. if not Assigned(UploadMission) then
  13611. Exit;
  13612. AMissionID := UploadMission.FID;
  13613. try
  13614. FLVNetWorkDiskUploadingFiles.Items.Delete(Item.ItemIndex);
  13615. FreeAndNil(UploadMission);
  13616. except
  13617. end;
  13618. RealICQNetWorkDiskClient.CancelUploadingFile(AMissionID);
  13619. finally
  13620. CheckUploadMissions
  13621. end;
  13622. end;
  13623. if Sender = FLVNetWorkDiskDownloadingFiles then
  13624. begin
  13625. try
  13626. if not Assigned(Item) then
  13627. Exit;
  13628. FLVNetWorkDiskDownloadingFiles.Items.Delete(Item.ItemIndex);
  13629. DownloadMission := TDownloadMission(Item.Data);
  13630. FreeAndNil(DownloadMission);
  13631. RealICQNetWorkDiskClient.StopDownloader;
  13632. finally
  13633. CheckDownloadMissions
  13634. end;
  13635. end;
  13636. end;
  13637. //------------------------------------------------------------------------------
  13638. procedure TMainForm.NDMissionDropFiles(Sender: TObject; var Message: TMessage);
  13639. var
  13640. i: Integer;
  13641. p: array[0..1023] of Char;
  13642. AName: string;
  13643. begin
  13644. try
  13645. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  13646. begin
  13647. MessageBox(Handle, '抱歉,系统正忙!', '提示', MB_ICONINFORMATION);
  13648. Exit;
  13649. end;
  13650. i := DragQueryFile(Message.wParam, $FFFFFFFF, nil, 0);
  13651. for i := 0 to i - 1 do
  13652. begin
  13653. DragQueryFile(Message.wParam, i, p, 1024);
  13654. AName := StrPas(p);
  13655. if FileExists(AName) then
  13656. begin
  13657. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13658. end
  13659. else if DirectoryExists(AName) then
  13660. begin
  13661. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, AName, False);
  13662. end;
  13663. end;
  13664. finally
  13665. CheckUploadMissions;
  13666. DragFinish(Message.wParam);
  13667. Message.Result := 1;
  13668. end;
  13669. end;
  13670. //------------------------------------------------------------------------------
  13671. procedure TMainForm.miNDCancelClick(Sender: TObject);
  13672. var
  13673. ListItem: TRealICQContacterListItem;
  13674. UploadMission: TUploadMission;
  13675. DownloadMission: TDownloadMission;
  13676. iLoop: Integer;
  13677. begin
  13678. if TabSetNDMissions.TabIndex = 0 then
  13679. begin
  13680. for iLoop := FLVNetWorkDiskUploadingFiles.Items.Count - 1 downto 0 do
  13681. begin
  13682. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13683. if ListItem.Selected then
  13684. begin
  13685. UploadMission := TUploadMission(ListItem.Data);
  13686. if ListItem.LoginState = stOnline then
  13687. begin
  13688. if UploadMission.FUploadMissionType = mtFile then
  13689. begin
  13690. RealICQNetWorkDiskClient.CancelUploadingFile(UploadMission.FID);
  13691. Continue;
  13692. end;
  13693. end;
  13694. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13695. FreeAndNil(UploadMission);
  13696. end;
  13697. end;
  13698. CheckUploadMissions;
  13699. end;
  13700. if TabSetNDMissions.TabIndex = 1 then
  13701. begin
  13702. for iLoop := FLVNetWorkDiskDownloadingFiles.Items.Count - 1 downto 0 do
  13703. begin
  13704. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13705. if ListItem.Selected then
  13706. begin
  13707. DownloadMission := TDownloadMission(ListItem.Data);
  13708. FLVNetWorkDiskUploadingFiles.Items.Delete(iLoop);
  13709. FreeAndNil(DownloadMission);
  13710. if ListItem.LoginState = stOnline then
  13711. begin
  13712. RealICQNetWorkDiskClient.StopDownloader;
  13713. end;
  13714. end;
  13715. end;
  13716. CheckDownloadMissions;
  13717. end;
  13718. end;
  13719. //------------------------------------------------------------------------------
  13720. procedure TMainForm.spbNDMoveUpClick(Sender: TObject);
  13721. begin
  13722. if RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil then
  13723. begin
  13724. lblNDState.Caption := '正在载入...';
  13725. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  13726. end;
  13727. end;
  13728. //------------------------------------------------------------------------------
  13729. procedure TMainForm.miNDRenameClick(Sender: TObject);
  13730. var
  13731. DirectoryName, FileName: string;
  13732. AFile: TRealICQNetWorkDiskFile;
  13733. ADirectory: TRealICQNetWorkDiskDirectory;
  13734. ListItem, ListItem1: TRealICQContacterListItem;
  13735. iLoop, jLoop: Integer;
  13736. begin
  13737. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13738. begin
  13739. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13740. if ListItem.Selected then
  13741. begin
  13742. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13743. begin
  13744. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  13745. DirectoryName := Trim(ShowMyInputBox('重命名目录', '请输入新的目录名称', ADirectory.Name, 200));
  13746. if AnsiSameStr(DirectoryName, ADirectory.Name) then
  13747. Exit;
  13748. if Length(DirectoryName) > 0 then
  13749. begin
  13750. 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
  13751. begin
  13752. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13753. Exit;
  13754. end;
  13755. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13756. begin
  13757. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13758. if ListItem1 = ListItem then
  13759. continue;
  13760. if Copy(ListItem1.LoginName, 1, 1) = 'D' then
  13761. begin
  13762. if AnsiSameText(DirectoryName, ListItem1.DisplayName) then
  13763. begin
  13764. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13765. Exit;
  13766. end;
  13767. end;
  13768. end;
  13769. RealICQNetWorkDiskClient.Rename(rtDir, ADirectory.ID, DirectoryName);
  13770. end;
  13771. end
  13772. else if Copy(ListItem.LoginName, 1, 1) = 'F' then
  13773. begin
  13774. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  13775. FileName := Trim(ShowMyInputBox('重命名文件', '请输入新的文件名称', AFile.Name, 200));
  13776. if AnsiSameStr(FileName, AFile.Name) then
  13777. Exit;
  13778. if Length(FileName) > 0 then
  13779. begin
  13780. 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
  13781. begin
  13782. MessageBox(Handle, '文件名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13783. Exit;
  13784. end;
  13785. for jLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  13786. begin
  13787. ListItem1 := FLVNetWorkDisk.Items.Objects[jLoop] as TRealICQContacterListItem;
  13788. if ListItem1 = ListItem then
  13789. continue;
  13790. if Copy(ListItem1.LoginName, 1, 1) = 'F' then
  13791. begin
  13792. if AnsiSameText(FileName, ListItem1.DisplayName) then
  13793. begin
  13794. MessageBox(Handle, '指定的文件已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13795. Exit;
  13796. end;
  13797. end;
  13798. end;
  13799. RealICQNetWorkDiskClient.Rename(rtFile, AFile.ID, FileName);
  13800. end;
  13801. end;
  13802. Exit;
  13803. end;
  13804. end;
  13805. end;
  13806. //------------------------------------------------------------------------------
  13807. procedure TMainForm.spbNDNewDirClick(Sender: TObject);
  13808. var
  13809. DirectoryName: string;
  13810. iLoop: Integer;
  13811. ListItem: TRealICQContacterListItem;
  13812. begin
  13813. DirectoryName := Trim(ShowMyInputBox('新建目录', '请输入目录名称', '', 200));
  13814. if Length(DirectoryName) > 0 then
  13815. begin
  13816. 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
  13817. begin
  13818. MessageBox(Handle, '目录名中不能出现下列任何字符之一'#$D#$A'\ / : * " < > |', '错误', MB_OK or MB_ICONINFORMATION);
  13819. Exit;
  13820. end;
  13821. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  13822. begin
  13823. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  13824. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  13825. begin
  13826. if AnsiSameText(DirectoryName, ListItem.DisplayName) then
  13827. begin
  13828. MessageBox(Handle, '指定的目录已存在!', '提示', MB_OK or MB_ICONINFORMATION);
  13829. Exit;
  13830. end;
  13831. end;
  13832. end;
  13833. RealICQNetWorkDiskClient.NewDirectory(DirectoryName);
  13834. end;
  13835. end;
  13836. //------------------------------------------------------------------------------
  13837. procedure TMainForm.spbNDRefreshClick(Sender: TObject);
  13838. begin
  13839. RealICQNetWorkDiskClient.Refresh;
  13840. end;
  13841. //------------------------------------------------------------------------------
  13842. procedure TMainForm.GoNextLevelUploadMissions(UploadMission: TUploadMission);
  13843. var
  13844. iLoop: Integer;
  13845. Missions: TStringList;
  13846. ListItem: TRealICQContacterListItem;
  13847. AUploadMission: TUploadMission;
  13848. DSearchRec: TSearchRec;
  13849. FindResult: Integer;
  13850. begin
  13851. if UploadMission.FUploadMissionType <> mtDir then
  13852. Exit;
  13853. Missions := TStringList.Create;
  13854. for iLoop := 0 to FLVNetWorkDiskUploadingFiles.Items.Count - 1 do
  13855. begin
  13856. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[iLoop] as TRealICQContacterListItem;
  13857. AUploadMission := TUploadMission(ListItem.Data);
  13858. Missions.AddObject(AUploadMission.FID, AUploadMission);
  13859. try
  13860. FUploadMissions.Delete(FUploadMissions.IndexOf(AUploadMission.ID));
  13861. except
  13862. end;
  13863. end;
  13864. FSavedUploadMissions.Add(Missions);
  13865. FLVNetWorkDiskUploadingFiles.Items.Clear;
  13866. FindResult := FindFirst(UploadMission.FName + '\*.*', faDirectory, DSearchRec);
  13867. while FindResult = 0 do
  13868. begin
  13869. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13870. begin
  13871. if DirectoryExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13872. begin
  13873. AddUploadMission(mtDir, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13874. end;
  13875. end;
  13876. FindResult := FindNext(DSearchRec);
  13877. end;
  13878. FindResult := FindFirst(UploadMission.FName + '\*.*', faAnyFile - faDirectory, DSearchRec);
  13879. while FindResult = 0 do
  13880. begin
  13881. if (DSearchRec.Name <> '.') and (DSearchRec.Name <> '..') then
  13882. begin
  13883. if FileExists(UploadMission.FName + '\' + DSearchRec.Name) then
  13884. begin
  13885. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadMission.FName + '\' + DSearchRec.Name, False);
  13886. end;
  13887. end;
  13888. FindResult := FindNext(DSearchRec);
  13889. end;
  13890. CheckUploadMissions;
  13891. end;
  13892. //------------------------------------------------------------------------------
  13893. procedure TMainForm.CheckUploadMissions;
  13894. var
  13895. ListItem: TRealICQContacterListItem;
  13896. UploadMission: TUploadMission;
  13897. Missions: TStringList;
  13898. iLoop: Integer;
  13899. ADirectory: TRealICQNetWorkDiskDirectory;
  13900. AFile: TRealICQNetWorkDiskFile;
  13901. Finded: Boolean;
  13902. MessageBoxResult: Integer;
  13903. ConfirmReplaceNDFileForm: TConfirmReplaceNDFileForm;
  13904. begin
  13905. if FLVNetWorkDiskUploadingFiles.OnlineNumeric = 0 then
  13906. begin
  13907. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  13908. begin
  13909. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  13910. UploadMission := TUploadMission(ListItem.Data);
  13911. if UploadMission.UploadMissionType = mtFile then
  13912. begin
  13913. with ListItem do
  13914. begin
  13915. LoginState := stOnline;
  13916. HasSMS := True;
  13917. Watchword := '';
  13918. SMSHint := '取消';
  13919. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13920. ReDrawItem;
  13921. end;
  13922. for iLoop := RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 downto 0 do
  13923. begin
  13924. AFile := RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop];
  13925. if AnsiSameText(ExtractFileName(AFile.Name), ExtractFileName(UploadMission.Name)) then
  13926. begin
  13927. if FConfirmReplaceResult <> mrYesToAll then
  13928. begin
  13929. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  13930. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(AFile.Name)]);
  13931. try
  13932. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  13933. finally
  13934. FreeAndNil(ConfirmReplaceNDFileForm);
  13935. end;
  13936. end;
  13937. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  13938. begin
  13939. //FreeAndNil(AFile);
  13940. RealICQNetWorkDiskClient.Delete('F' + IntToStr(AFile.ID));
  13941. Sleep(100);
  13942. Application.ProcessMessages;
  13943. Break;
  13944. end
  13945. else if FConfirmReplaceResult = mrNO then
  13946. begin
  13947. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  13948. FreeAndNil(UploadMission);
  13949. CheckUploadMissions;
  13950. Exit;
  13951. end
  13952. else if FConfirmReplaceResult = mrCancel then
  13953. begin
  13954. spbNDCancelAllClick(spbNDCancelAll);
  13955. Exit;
  13956. end;
  13957. end;
  13958. end;
  13959. while True do
  13960. begin
  13961. try
  13962. RealICQNetWorkDiskClient.UploadFile(UploadMission.Name, UploadMission.DirectoryID, UploadMission.ID);
  13963. Break;
  13964. except
  13965. on E: Exception do
  13966. begin
  13967. MessageBoxResult := MessageBox(Handle, PChar('上传文件时出错:'#$D#$A#$D#$A + E.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  13968. if MessageBoxResult = ID_ABORT then
  13969. begin
  13970. spbNDCancelAllClick(spbNDCancelAll);
  13971. Exit;
  13972. end
  13973. else if MessageBoxResult = ID_RETRY then
  13974. begin
  13975. Continue;
  13976. end
  13977. else if MessageBoxResult = ID_IGNORE then
  13978. begin
  13979. FLVNetWorkDiskUploadingFiles.Items.Delete(ListItem.ItemIndex);
  13980. FreeAndNil(UploadMission);
  13981. CheckUploadMissions;
  13982. Exit;
  13983. end;
  13984. end;
  13985. end; //try
  13986. end; //while
  13987. end
  13988. else
  13989. begin
  13990. with ListItem do
  13991. begin
  13992. LoginState := stOnline;
  13993. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + UpBMP);
  13994. ReDrawItem;
  13995. end;
  13996. Finded := False;
  13997. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  13998. begin
  13999. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop];
  14000. if Length(ExtractFileName(UploadMission.Name)) > 0 then
  14001. begin
  14002. if AnsiSameText(ADirectory.Name, ExtractFileName(UploadMission.Name)) then
  14003. begin
  14004. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14005. Finded := True;
  14006. end;
  14007. end
  14008. else
  14009. begin
  14010. if AnsiSameText(ADirectory.Name, '[' + Copy(UploadMission.Name, 1, 1) + ']') then
  14011. begin
  14012. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14013. Finded := True;
  14014. end;
  14015. end;
  14016. end;
  14017. if not Finded then
  14018. begin
  14019. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14020. RealICQNetWorkDiskClient.NewDirectory('[' + Copy(UploadMission.Name, 1, 1) + ']')
  14021. else
  14022. RealICQNetWorkDiskClient.NewDirectory(ExtractFileName(UploadMission.Name));
  14023. end;
  14024. end;
  14025. end;
  14026. end;
  14027. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  14028. if FLVNetWorkDiskUploadingFiles.Items.Count = 0 then
  14029. begin
  14030. if FSavedUploadMissions.Count > 0 then
  14031. begin
  14032. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  14033. begin
  14034. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  14035. begin
  14036. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  14037. Missions := TStringList(FSavedUploadMissions[FSavedUploadMissions.Count - 1]);
  14038. FSavedUploadMissions.Remove(Missions);
  14039. for iLoop := 0 to Missions.Count - 1 do
  14040. begin
  14041. UploadMission := Missions.Objects[iLoop] as TUploadMission;
  14042. AddUploadMission(UploadMission.UploadMissionType, UploadMission.DirectoryID, UploadMission.Name, False);
  14043. FreeAndNil(UploadMission);
  14044. end;
  14045. Missions.Clear;
  14046. FreeAndNil(Missions);
  14047. CheckUploadMissions;
  14048. Exit;
  14049. end;
  14050. end;
  14051. end
  14052. else
  14053. begin
  14054. RealICQNetWorkDiskClient.GetUsedSpaceSize;
  14055. end;
  14056. end;
  14057. CheckNDControlState;
  14058. end;
  14059. //------------------------------------------------------------------------------
  14060. procedure TMainForm.CheckNDControlState;
  14061. begin
  14062. if (FLVNetWorkDiskUploadingFiles <> nil) and (FLVNetWorkDiskUploadingFiles.Items.Count = 0) and (FLVNetWorkDiskDownloadingFiles.Items.Count = 0) and (FSavedUploadMissions.Count = 0) and (FSavedDownloadMissions.Count = 0) then
  14063. begin
  14064. pnlNDMissions.Visible := False;
  14065. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  14066. end;
  14067. spbNDMoveUp.Enabled := not pnlNDMissions.Visible;
  14068. spbNDNewDir.Enabled := not pnlNDMissions.Visible;
  14069. spbNDDelete.Enabled := not pnlNDMissions.Visible;
  14070. spbNDUpload.Enabled := not pnlNDMissions.Visible;
  14071. spbNDDownload.Enabled := not pnlNDMissions.Visible;
  14072. spbNDRefresh.Enabled := not pnlNDMissions.Visible;
  14073. spbNDCancelAll.Enabled := pnlNDMissions.Visible;
  14074. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory <> nil) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  14075. if not pnlNDMissions.Visible then
  14076. begin
  14077. FConfirmReplaceResult := -1;
  14078. FLastDownloadDirectory := '';
  14079. NDSelectItemChanged(nil);
  14080. end;
  14081. end;
  14082. //------------------------------------------------------------------------------
  14083. procedure TMainForm.AddUploadMission(AUploadMissionType: TNDMissionType; ADirectoryID: Integer; AName: string; CheckMission: Boolean = True);
  14084. var
  14085. UploadMission: TUploadMission;
  14086. ItemIndex: Integer;
  14087. ListItem: TRealICQContacterListItem;
  14088. begin
  14089. UploadMission := TUploadMission.Create(AUploadMissionType, ADirectoryID, AName);
  14090. if FUploadMissions.IndexOf(UploadMission.ID) >= 0 then
  14091. begin
  14092. MessageBox(Handle, PChar(AName + ' 已在任务队列中!'), '提示', MB_ICONINFORMATION);
  14093. Exit;
  14094. end;
  14095. FUploadMissions.AddObject(UploadMission.ID, UploadMission);
  14096. if not pnlNDMissions.Visible then
  14097. pnlNDMissions.Visible := True;
  14098. TabSetNDMissions.TabIndex := 0;
  14099. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  14100. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  14101. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(UploadMission.ID);
  14102. if ItemIndex >= 0 then
  14103. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14104. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.Add(UploadMission.ID);
  14105. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14106. with ListItem do
  14107. begin
  14108. LoginState := stOffline;
  14109. Data := UploadMission;
  14110. DisplayName := (UploadMission.Name);
  14111. Watchword := '队列中';
  14112. if UploadMission.UploadMissionType = mtFile then
  14113. begin
  14114. try
  14115. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(UploadMission.Name));
  14116. except
  14117. end;
  14118. end;
  14119. ReDrawItem;
  14120. end;
  14121. TabSetNDMissions.Tabs.Strings[0] := Format('上传(%d)', [FLVNetWorkDiskUploadingFiles.Items.Count]);
  14122. if CheckMission then
  14123. CheckUploadMissions;
  14124. end;
  14125. //------------------------------------------------------------------------------
  14126. procedure TMainForm.AddDownloadMission(ADownloadMissionType: TNDMissionType; ADirectoryName: string; AFileID: Integer = 0; AFileName: string = ''; CheckMission: Boolean = True);
  14127. var
  14128. DownloadMission: TDownloadMission;
  14129. ItemIndex: Integer;
  14130. ListItem: TRealICQContacterListItem;
  14131. begin
  14132. DownloadMission := TDownloadMission.Create(ADownloadMissionType, ADirectoryName, AFileID, AFileName);
  14133. if not pnlNDMissions.Visible then
  14134. pnlNDMissions.Visible := True;
  14135. TabSetNDMissions.TabIndex := 1;
  14136. SplitterNDMissions.Visible := pnlNDMissions.Visible;
  14137. SplitterNDMissions.Top := pnlNDMissions.Top - 10;
  14138. ItemIndex := FLVNetWorkDiskDownloadingFiles.Items.Add(DownloadMission.ID);
  14139. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14140. with ListItem do
  14141. begin
  14142. LoginState := stOffline;
  14143. Data := DownloadMission;
  14144. Watchword := '队列中';
  14145. if DownloadMission.DownloadMissionType = mtFile then
  14146. begin
  14147. DisplayName := (DownloadMission.FileName);
  14148. try
  14149. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(DownloadMission.FileName));
  14150. except
  14151. end;
  14152. end
  14153. else
  14154. begin
  14155. DisplayName := (DownloadMission.DirectoryName);
  14156. end;
  14157. ReDrawItem;
  14158. end;
  14159. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  14160. if CheckMission then
  14161. CheckDownloadMissions;
  14162. end;
  14163. //------------------------------------------------------------------------------
  14164. procedure TMainForm.CheckDownloadMissions;
  14165. var
  14166. iLoop, jLoop: Integer;
  14167. ListItem: TRealICQContacterListItem;
  14168. DownloadMission: TDownloadMission;
  14169. ADownloadMission: TDownloadMission;
  14170. ADirectory: TRealICQNetWorkDiskDirectory;
  14171. Missions: TStringList;
  14172. begin
  14173. if FLVNetWorkDiskDownloadingFiles.OnlineNumeric = 0 then
  14174. begin
  14175. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  14176. begin
  14177. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14178. DownloadMission := TDownloadMission(ListItem.Data);
  14179. if DownloadMission.DownloadMissionType = mtFile then
  14180. begin
  14181. with ListItem do
  14182. begin
  14183. LoginState := stOnline;
  14184. HasSMS := True;
  14185. Watchword := '';
  14186. SMSHint := '取消';
  14187. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14188. ReDrawItem;
  14189. end;
  14190. if FileExists(DownloadMission.FFileName) then
  14191. begin
  14192. if FConfirmReplaceResult <> mrYesToAll then
  14193. begin
  14194. ConfirmReplaceNDFileForm := TConfirmReplaceNDFileForm.Create(Self);
  14195. ConfirmReplaceNDFileForm.Label1.Caption := Format(ConfirmReplaceNDFileForm.Label1.Caption, [ExtractFileName(DownloadMission.FFileName)]);
  14196. try
  14197. FConfirmReplaceResult := ConfirmReplaceNDFileForm.ShowModal;
  14198. finally
  14199. FreeAndNil(ConfirmReplaceNDFileForm);
  14200. end;
  14201. end;
  14202. if (FConfirmReplaceResult = mrYES) or (FConfirmReplaceResult = mrYesToAll) then
  14203. begin
  14204. end
  14205. else if FConfirmReplaceResult = mrNO then
  14206. begin
  14207. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14208. FreeAndNil(DownloadMission);
  14209. CheckDownloadMissions;
  14210. Exit;
  14211. end
  14212. else if FConfirmReplaceResult = mrCancel then
  14213. begin
  14214. spbNDCancelAllClick(spbNDCancelAll);
  14215. Exit;
  14216. end;
  14217. end;
  14218. try
  14219. RealICQNetWorkDiskClient.DownloadFile(DownloadMission.FFileID, DownloadMission.FFileName);
  14220. except
  14221. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14222. FreeAndNil(DownloadMission);
  14223. CheckDownloadMissions;
  14224. Exit;
  14225. end;
  14226. end
  14227. else
  14228. begin
  14229. with ListItem do
  14230. begin
  14231. LoginState := stOnline;
  14232. HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + DownBMP);
  14233. ReDrawItem;
  14234. end;
  14235. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14236. begin
  14237. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14238. if AnsiSameText(ExtractFileName(ADirectory.Name), ExtractFileName(DownloadMission.DirectoryName)) then
  14239. begin
  14240. if not DirectoryExists(DownloadMission.DirectoryName) then
  14241. CreateDir(DownloadMission.DirectoryName);
  14242. FLastDownloadDirectory := DownloadMission.DirectoryName;
  14243. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  14244. FreeAndNil(DownloadMission);
  14245. Missions := TStringList.Create;
  14246. for jLoop := 0 to FLVNetWorkDiskDownloadingFiles.Items.Count - 1 do
  14247. begin
  14248. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[jLoop] as TRealICQContacterListItem;
  14249. ADownloadMission := TDownloadMission(ListItem.Data);
  14250. Missions.AddObject(ADownloadMission.FID, ADownloadMission);
  14251. end;
  14252. FSavedDownloadMissions.Add(Missions);
  14253. FLVNetWorkDiskDownloadingFiles.Items.Clear;
  14254. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14255. Exit;
  14256. end;
  14257. end;
  14258. end;
  14259. end;
  14260. end;
  14261. TabSetNDMissions.Tabs.Strings[1] := Format('下载(%d)', [FLVNetWorkDiskDownloadingFiles.Items.Count]);
  14262. if FLVNetWorkDiskDownloadingFiles.Items.Count = 0 then
  14263. begin
  14264. if FSavedDownloadMissions.Count > 0 then
  14265. begin
  14266. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) then
  14267. begin
  14268. if (RealICQNetWorkDiskClient.CurrentDirectory.Parent.FromServerVersion) then
  14269. begin
  14270. FLastDownloadDirectory := '';
  14271. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Parent);
  14272. Missions := TStringList(FSavedDownloadMissions[FSavedDownloadMissions.Count - 1]);
  14273. FSavedDownloadMissions.Remove(Missions);
  14274. for iLoop := 0 to Missions.Count - 1 do
  14275. begin
  14276. DownloadMission := Missions.Objects[iLoop] as TDownloadMission;
  14277. AddDownloadMission(DownloadMission.DownloadMissionType, DownloadMission.DirectoryName, DownloadMission.FileID, DownloadMission.FileName, False);
  14278. FreeAndNil(DownloadMission);
  14279. end;
  14280. Missions.Clear;
  14281. FreeAndNil(Missions);
  14282. CheckDownloadMissions;
  14283. Exit;
  14284. end;
  14285. end;
  14286. end;
  14287. end;
  14288. CheckNDControlState;
  14289. end;
  14290. //------------------------------------------------------------------------------
  14291. procedure TMainForm.spbNDUploadClick(Sender: TObject);
  14292. var
  14293. iLoop: Integer;
  14294. begin
  14295. MainForm.FormStyle := fsNormal;
  14296. try
  14297. if UploadFileOpenDialog.Execute then
  14298. begin
  14299. for iLoop := 0 to UploadFileOpenDialog.Files.Count - 1 do
  14300. begin
  14301. AddUploadMission(mtFile, RealICQNetWorkDiskClient.CurrentDirectory.ID, UploadFileOpenDialog.Files.Strings[iLoop], False);
  14302. end;
  14303. end;
  14304. finally
  14305. // if MainForm.AlwaysOnTop then
  14306. // MainForm.FormStyle := fsStayOnTop
  14307. // else
  14308. // MainForm.FormStyle := fsNormal;
  14309. CheckUploadMissions;
  14310. end;
  14311. end;
  14312. procedure TMainForm.spbNextClick(Sender: TObject);
  14313. var
  14314. TabSheet: TTabSheet;
  14315. WebBrowser: TWebBrowser;
  14316. begin
  14317. try
  14318. TabSheet := pgcMultiWeb.ActivePage;
  14319. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14320. if WebBrowser.Busy then
  14321. WebBrowser.Stop;
  14322. WebBrowser.GoForward;
  14323. except
  14324. end;
  14325. end;
  14326. //function TMainForm.GetDefaultBrowser: string;//获取默认浏览器
  14327. //var
  14328. // reg: TRegistry;
  14329. //begin
  14330. // reg := TRegistry.Create;
  14331. // try
  14332. // {reg.RootKey := HKEY_CLASSES_ROOT;
  14333. // reg.OpenKey('HTTP\shell\open\ddeexec\Application',false);
  14334. // result:=reg.ReadString('');
  14335. // reg.CloseKey; }
  14336. // reg.RootKey := HKEY_CLASSES_ROOT;
  14337. // reg.OpenKey('http\\shell\\open\\command', false);
  14338. // result := reg.ReadString('');
  14339. // result := Copy(result, Pos('"', result) + 1, Length(result) - 1);
  14340. // result := Copy(result, 1, Pos('"', result) - 1);
  14341. // reg.CloseKey;
  14342. // finally
  14343. // if (result = '') then
  14344. // result := 'IEXPLORE.EXE';
  14345. // reg.Free;
  14346. // end;
  14347. //end;
  14348. //---用户自助管理平台--------------------------------------
  14349. procedure TMainForm.spbPersonManageClick(Sender: TObject);
  14350. //var
  14351. // EncryptStr,
  14352. // Md5Pwd,
  14353. // Url,
  14354. // TmpStr:String;
  14355. begin
  14356. //Md5Pwd:=Md5En(RealICQClient.Password);
  14357. //TmpStr:='{'+RealICQClient.Me.LoginName+'}{'+Md5Pwd+'}';
  14358. //EncryptStr:=StrToBase64(Encrypt(TmpStr,'B77A5C561934E089'));
  14359. //Url:=RealICQClient.PersonManageUrl+'?'+ EncryptStr;
  14360. //ShellExecute(handle,'open', 'IEXPLORE.EXE', 'http://www.baidu.com', nil,SW_SHOWNORMAL);//
  14361. // ShellExecute(handle, 'open','http://220.191.210.103:8080/Default.aspx?url=', '','',SW_SHOWDEFAULT);
  14362. //MessageBox(Handle, PChar(RealICQClient.WebAppBaseURL), '提示', MB_ICONQUESTION);
  14363. //MessageBox(Handle, PChar(LoginURL), '提示', MB_ICONQUESTION);
  14364. //ShellExecute(handle, 'open', PChar(GetDefaultBrowser),PChar(Format(RealICQClient.WebAppBaseURL + LoginURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), ''])), '',SW_SHOWDEFAULT);
  14365. if FNewConsole then
  14366. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + NewBaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(LoginURL)])), '', SW_SHOWDEFAULT)
  14367. else
  14368. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(Format(RealICQClient.WebAppBaseURL + BaseURL, [StrToBase64(RealICQClient.LoginName), StrToBase64(MD5En(RealICQClient.Password)), StrToBase64(LoginURL)])), '', SW_SHOWDEFAULT);
  14369. end;
  14370. procedure TMainForm.spbPrevClick(Sender: TObject);
  14371. var
  14372. TabSheet: TTabSheet;
  14373. WebBrowser: TWebBrowser;
  14374. begin
  14375. try
  14376. TabSheet := pgcMultiWeb.ActivePage;
  14377. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14378. if WebBrowser.Busy then
  14379. WebBrowser.Stop;
  14380. WebBrowser.GoBack;
  14381. except
  14382. end;
  14383. end;
  14384. procedure TMainForm.spbPrintPrevClick(Sender: TObject);
  14385. var
  14386. TabSheet: TTabSheet;
  14387. WebBrowser: TWebBrowser;
  14388. begin
  14389. MainForm.FormStyle := fsNormal;
  14390. try
  14391. try
  14392. TabSheet := pgcMultiWeb.ActivePage;
  14393. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14394. if WebBrowser.QueryStatusWB(OLECMDID_PRINTPREVIEW) = 3 then
  14395. WebBrowser.ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT, EmptyParam, EmptyParam);
  14396. except
  14397. end;
  14398. finally
  14399. // if MainForm.AlwaysOnTop then
  14400. // MainForm.FormStyle := fsStayOnTop
  14401. // else
  14402. // MainForm.FormStyle := fsNormal;
  14403. end;
  14404. end;
  14405. procedure TMainForm.spbRefreshBranchUsersClick(Sender: TObject);
  14406. begin
  14407. //
  14408. {TimerForGetBranchOnlineStates.Enabled := False;
  14409. TimerForGetBranchOnlineStates.Enabled := True;}
  14410. miChangeServerClick(nil);
  14411. TimerForGetBranchUsersOnlineStates.Enabled := False;
  14412. TimerForGetBranchUsersOnlineStates.Enabled := True;
  14413. end;
  14414. procedure TMainForm.spbRefreshClick(Sender: TObject);
  14415. var
  14416. TabSheet: TTabSheet;
  14417. WebBrowser: TWebBrowser;
  14418. begin
  14419. try
  14420. TabSheet := pgcMultiWeb.ActivePage;
  14421. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  14422. if WebBrowser.Busy then
  14423. WebBrowser.Stop;
  14424. WebBrowser.Refresh;
  14425. except
  14426. end;
  14427. end;
  14428. //------------------------------------------------------------------------------
  14429. procedure TMainForm.RealICQNetWorkDiskClientNewDirResult(Sender: TObject; Directory: TRealICQNetWorkDiskDirectory);
  14430. var
  14431. ItemIndex: Integer;
  14432. ListItem: TRealICQContacterListItem;
  14433. UploadMission: TUploadMission;
  14434. NDDirName: string;
  14435. begin
  14436. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14437. begin
  14438. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14439. UploadMission := TUploadMission(ListItem.Data);
  14440. if UploadMission.UploadMissionType = mtDir then
  14441. begin
  14442. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14443. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14444. else
  14445. NDDirName := ExtractFileName(UploadMission.Name);
  14446. if AnsiSameText(NDDirName, Directory.Name) and (Directory.ParentID = UploadMission.DirectoryID) then
  14447. begin
  14448. RealICQNetWorkDiskClient.GetDirectory(Directory);
  14449. Exit;
  14450. end;
  14451. end;
  14452. end;
  14453. if Directory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14454. Exit;
  14455. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(Directory.ID));
  14456. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14457. with ListItem do
  14458. begin
  14459. LoginState := stOnline;
  14460. Data := Directory;
  14461. DisplayName := Directory.Name;
  14462. ReDrawItem;
  14463. end;
  14464. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14465. end;
  14466. //------------------------------------------------------------------------------
  14467. procedure TMainForm.RealICQNetWorkDiskClientNoSpace(Sender: TObject);
  14468. begin
  14469. ShowNetWorkDiskSpaceInfo;
  14470. spbNDCancelAllClick(spbNDCancelAll);
  14471. MessageBox(Handle, '抱歉!您的网络硬盘空间不足,任务已取消!', '提示', MB_ICONINFORMATION);
  14472. end;
  14473. //------------------------------------------------------------------------------
  14474. procedure TMainForm.RealICQNetWorkDiskClientRenamedDir(Sender: TObject; ADirectory: TRealICQNetWorkDiskDirectory);
  14475. var
  14476. ItemIndex: Integer;
  14477. ListItem: TRealICQContacterListItem;
  14478. begin
  14479. FLVNetWorkDisk.AdjustPosition := False;
  14480. try
  14481. if ADirectory.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14482. Exit;
  14483. ItemIndex := FLVNetWorkDisk.Items.IndexOf('D' + IntToStr(ADirectory.ID));
  14484. if ItemIndex < 0 then
  14485. Exit;
  14486. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14487. with ListItem do
  14488. begin
  14489. LoginState := stOnline;
  14490. Data := ADirectory;
  14491. DisplayName := ADirectory.Name;
  14492. ReDrawItem;
  14493. end;
  14494. finally
  14495. FLVNetWorkDisk.AdjustPosition := True;
  14496. end;
  14497. end;
  14498. //------------------------------------------------------------------------------
  14499. procedure TMainForm.RealICQNetWorkDiskClientRenamedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile);
  14500. var
  14501. ItemIndex: Integer;
  14502. ListItem: TRealICQContacterListItem;
  14503. begin
  14504. FLVNetWorkDisk.AdjustPosition := False;
  14505. try
  14506. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14507. Exit;
  14508. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14509. if ItemIndex < 0 then
  14510. Exit;
  14511. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14512. with ListItem do
  14513. begin
  14514. LoginState := stLeave;
  14515. Data := AFile;
  14516. DisplayName := AFile.Name;
  14517. try
  14518. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14519. except
  14520. end;
  14521. ReDrawItem;
  14522. end;
  14523. finally
  14524. FLVNetWorkDisk.AdjustPosition := True;
  14525. end;
  14526. end;
  14527. //------------------------------------------------------------------------------
  14528. procedure TMainForm.RealICQNetWorkDiskClientUploadedFile(Sender: TObject; AFile: TRealICQNetWorkDiskFile; AMissionID: string);
  14529. var
  14530. iLoop: Integer;
  14531. ItemIndex: Integer;
  14532. ListItem: TRealICQContacterListItem;
  14533. UploadMission: TUploadMission;
  14534. AFile1: TRealICQNetWorkDiskFile;
  14535. Finded: Boolean;
  14536. begin
  14537. try
  14538. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14539. if ItemIndex >= 0 then
  14540. begin
  14541. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14542. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14543. UploadMission := TUploadMission(ListItem.Data);
  14544. FreeAndNil(UploadMission);
  14545. end;
  14546. FLVNetWorkDisk.AdjustPosition := False;
  14547. try
  14548. if AFile.Parent <> RealICQNetWorkDiskClient.CurrentDirectory then
  14549. Exit;
  14550. Finded := False;
  14551. ListItem := nil;
  14552. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14553. begin
  14554. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14555. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14556. begin
  14557. AFile1 := TRealICQNetWorkDiskFile(ListItem.Data);
  14558. if AnsiSameText(AFile1.Name, AFile.Name) then
  14559. begin
  14560. Finded := True;
  14561. Break;
  14562. end;
  14563. end;
  14564. end;
  14565. if not Finded then
  14566. begin
  14567. ItemIndex := FLVNetWorkDisk.Items.IndexOf('F' + IntToStr(AFile.ID));
  14568. if ItemIndex >= 0 then
  14569. begin
  14570. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14571. Finded := True;
  14572. end;
  14573. end;
  14574. if not Finded then
  14575. begin
  14576. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14577. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14578. end;
  14579. with ListItem do
  14580. begin
  14581. LoginState := stLeave;
  14582. Data := AFile;
  14583. DisplayName := AFile.Name;
  14584. if AFile.Size >= 1024 * 1024 then
  14585. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14586. else if AFile.Size >= 1024 then
  14587. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14588. else
  14589. Watchword := IntToStr(AFile.Size) + 'B';
  14590. try
  14591. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14592. except
  14593. end;
  14594. ReDrawItem;
  14595. end;
  14596. finally
  14597. FLVNetWorkDisk.AdjustPosition := True;
  14598. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14599. ShowNetWorkDiskSpaceInfo;
  14600. end;
  14601. finally
  14602. CheckUploadMissions;
  14603. end;
  14604. end;
  14605. //------------------------------------------------------------------------------
  14606. procedure TMainForm.RealICQNetWorkDiskClientUploadFileAborted(Sender: TObject; AMissionID: string);
  14607. var
  14608. ItemIndex: Integer;
  14609. ListItem: TRealICQContacterListItem;
  14610. UploadMission: TUploadMission;
  14611. begin
  14612. try
  14613. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf(AMissionID);
  14614. if ItemIndex >= 0 then
  14615. begin
  14616. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14617. FLVNetWorkDiskUploadingFiles.Items.Delete(ItemIndex);
  14618. UploadMission := TUploadMission(ListItem.Data);
  14619. FreeAndNil(UploadMission);
  14620. end;
  14621. finally
  14622. CheckUploadMissions;
  14623. end;
  14624. end;
  14625. //------------------------------------------------------------------------------
  14626. procedure TMainForm.RealICQNetWorkDiskClientUploadingFile(Sender: TObject; ATransmitter: TResponsionStreamTransmitter; ATransmittedSize: Int64);
  14627. var
  14628. ItemIndex: Integer;
  14629. ListItem: TRealICQContacterListItem;
  14630. Completed: Integer;
  14631. ASpeed: Cardinal;
  14632. SpeedStr: string;
  14633. begin
  14634. ItemIndex := FLVNetWorkDiskUploadingFiles.Items.IndexOf((ATransmitter as TNetWorkFileTransmitter).MissionID);
  14635. if ItemIndex >= 0 then
  14636. begin
  14637. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14638. with ListItem do
  14639. begin
  14640. Completed := ATransmittedSize * 100 div ATransmitter.StreamLength;
  14641. try
  14642. ASpeed := Round(ATransmittedSize div ((GetTickCount - ATransmitter.StartTicket) div 1000) * 1.2);
  14643. except
  14644. Exit;
  14645. end;
  14646. if ASpeed > 1000 * 1000 then
  14647. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  14648. else if ASpeed > 1000 then
  14649. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  14650. else
  14651. SpeedStr := Format('%d字节/秒', [ASpeed]);
  14652. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  14653. DisplayName := DisplayName + ((ATransmitter as TNetWorkFileTransmitter).FileName);
  14654. ReDrawItem;
  14655. end;
  14656. end;
  14657. end;
  14658. function ServiceGetStatus(sMachine, sService: string): DWord;
  14659. var
  14660. //service control
  14661. //manager handle
  14662. schm,
  14663. //service handle
  14664. schs: SC_Handle;
  14665. //service status
  14666. ss: TServiceStatus;
  14667. //current service status
  14668. dwStat: DWord;
  14669. begin
  14670. dwStat := 0;
  14671. //connect to the service
  14672. //control manager
  14673. schm := OpenSCManager(pchar(sMachine), Nil, SC_MANAGER_CONNECT);
  14674. //if successful...
  14675. if (schm > 0) then
  14676. begin
  14677. //open a handle to
  14678. //the specified service
  14679. schs := OpenService(schm, PChar(sService), SERVICE_QUERY_STATUS);
  14680. //if successful...
  14681. if (schs > 0) then
  14682. begin
  14683. //retrieve the current status
  14684. //of the specified service
  14685. if (QueryServiceStatus(schs, ss)) then
  14686. begin
  14687. dwStat := ss.dwCurrentState;
  14688. end;
  14689. //close service handle
  14690. CloseServiceHandle(schs);
  14691. end;
  14692. // close service control
  14693. // manager handle
  14694. CloseServiceHandle(schm);
  14695. end;
  14696. Result := dwStat;
  14697. end;
  14698. function ServiceUninstalled(sMachine, sService: string): boolean;
  14699. begin
  14700. Result := 0 = ServiceGetStatus(sMachine, sService);
  14701. end;
  14702. //------------------------------------------------------------------------------
  14703. //调用360杀毒软件
  14704. //------------------------------------------------------------------------------
  14705. //procedure TMainForm.spb360SDClick(Sender: TObject);
  14706. //begin
  14707. // //
  14708. //
  14709. //
  14710. //
  14711. //end;
  14712. //------------------------------------------------------------------------------
  14713. //调用360安全卫士
  14714. //------------------------------------------------------------------------------
  14715. //
  14716. //procedure TMainForm.spb360SafeClick(Sender: TObject);
  14717. //var
  14718. // URL: string;
  14719. // TempReg: TRegistry;
  14720. // safePath: string;
  14721. //begin
  14722. //
  14723. // URL := 'http://' + self.RealICQClient.RemoteAddress + '/client/setup.exe';
  14724. //
  14725. // try
  14726. // TempReg := TRegistry.Create;
  14727. // try
  14728. // TempReg.RootKey := HKEY_LOCAL_MACHINE;
  14729. // if not TempReg.OpenKey('\Software\360Safe\menuext\LiveUpdate360', False) then
  14730. // //DownloadUpdate(URL)
  14731. //
  14732. //
  14733. // else
  14734. // begin
  14735. // safePath := ExtractFilePath(TempReg.ReadString('Application'));
  14736. // //WinExec(PChar(safePath+'\360Safe.exe'),SW_SHOW);
  14737. //
  14738. //
  14739. //
  14740. // end;
  14741. //
  14742. // finally
  14743. // TempReg.Free;
  14744. // end;
  14745. // except
  14746. // end;
  14747. //
  14748. //end;
  14749. //------------------------------------------------------------------------------
  14750. procedure TMainForm.spbNDDeleteClick(Sender: TObject);
  14751. var
  14752. ListItem: TRealICQContacterListItem;
  14753. iLoop: Integer;
  14754. AList: string;
  14755. begin
  14756. if FLVNetWorkDisk.SelCount <= 0 then
  14757. Exit;
  14758. if (GetKeyState(VK_Shift) and - 128) = 0 then
  14759. begin
  14760. if MessageBox(Handle, '确认要删除选中的文件吗?', '提示', MB_ICONQUESTION or MB_OKCANCEL) <> ID_OK then
  14761. Exit;
  14762. end;
  14763. AList := '';
  14764. for iLoop := FLVNetWorkDisk.Items.Count - 1 downto 0 do
  14765. begin
  14766. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14767. if ListItem.Selected then
  14768. begin
  14769. AList := AList + ListItem.LoginName + Chr(10);
  14770. end;
  14771. if Length(AList) >= 1024 then
  14772. begin
  14773. RealICQNetWorkDiskClient.Delete(AList);
  14774. AList := '';
  14775. Sleep(1000);
  14776. end;
  14777. end;
  14778. if Length(AList) > 0 then
  14779. RealICQNetWorkDiskClient.Delete(AList);
  14780. end;
  14781. //------------------------------------------------------------------------------
  14782. procedure TMainForm.spbNDDisconnectClick(Sender: TObject);
  14783. begin
  14784. RealICQNetWorkDiskClient.Logout;
  14785. end;
  14786. //------------------------------------------------------------------------------
  14787. procedure TMainForm.spbNDDownloadClick(Sender: TObject);
  14788. var
  14789. iLoop: Integer;
  14790. ListItem: TRealICQContacterListItem;
  14791. Dir: string;
  14792. AFile: TRealICQNetWorkDiskFile;
  14793. ADirectory: TRealICQNetWorkDiskDirectory;
  14794. begin
  14795. if FLVNetWorkDisk.SelCount = 0 then
  14796. Exit;
  14797. if FLVNetWorkDisk.SelCount = 1 then
  14798. begin
  14799. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14800. begin
  14801. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14802. if ListItem.Selected then
  14803. begin
  14804. if Copy(ListItem.LoginName, 1, 1) = 'F' then
  14805. begin
  14806. NDItemDoubleClick(ListItem);
  14807. Exit;
  14808. end;
  14809. end;
  14810. end;
  14811. end;
  14812. MainForm.FormStyle := fsNormal;
  14813. try
  14814. if SelectDirectory('请选择目录', '', Dir) then
  14815. begin
  14816. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14817. begin
  14818. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14819. if ListItem.Selected then
  14820. begin
  14821. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  14822. begin
  14823. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  14824. AddDownloadMission(mtDir, Dir + '\' + ADirectory.Name, 0, '', False);
  14825. end
  14826. else
  14827. begin
  14828. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  14829. AddDownloadMission(mtFile, ExtractFilePath(Dir), AFile.ID, Dir + '\' + AFile.Name, False);
  14830. end;
  14831. end;
  14832. end; //for
  14833. CheckDownloadMissions;
  14834. end;
  14835. finally
  14836. // if MainForm.AlwaysOnTop then
  14837. // MainForm.FormStyle := fsStayOnTop
  14838. // else
  14839. // MainForm.FormStyle := fsNormal;
  14840. end;
  14841. end;
  14842. //------------------------------------------------------------------------------
  14843. procedure TMainForm.NDItemDoubleClick(Item: TRealICQContacterListItem);
  14844. var
  14845. AFile: TRealICQNetWorkDiskFile;
  14846. ADirectory: TRealICQNetWorkDiskDirectory;
  14847. begin
  14848. if (FLVNetWorkDiskUploadingFiles.Items.Count > 0) or (FLVNetWorkDiskDownloadingFiles.Items.Count > 0) or (FSavedUploadMissions.Count > 0) then
  14849. begin
  14850. Exit;
  14851. end;
  14852. if Copy(Item.LoginName, 1, 1) = 'D' then
  14853. begin
  14854. ADirectory := TRealICQNetWorkDiskDirectory(Item.Data);
  14855. RealICQNetWorkDiskClient.GetDirectory(ADirectory);
  14856. end
  14857. else if Copy(Item.LoginName, 1, 1) = 'F' then
  14858. begin
  14859. AFile := TRealICQNetWorkDiskFile(Item.Data);
  14860. MainForm.FormStyle := fsNormal;
  14861. try
  14862. DownloadFileSaveDialog.FileName := AFile.Name;
  14863. if DownloadFileSaveDialog.Execute then
  14864. begin
  14865. AddDownloadMission(mtFile, ExtractFilePath(DownloadFileSaveDialog.FileName), AFile.ID, DownloadFileSaveDialog.FileName, True);
  14866. end;
  14867. finally
  14868. // if MainForm.AlwaysOnTop then
  14869. // MainForm.FormStyle := fsStayOnTop
  14870. // else
  14871. // MainForm.FormStyle := fsNormal;
  14872. end;
  14873. end;
  14874. end;
  14875. //------------------------------------------------------------------------------
  14876. procedure TMainForm.RealICQNetWorkDiskClientDeleteResult(Sender: TObject; AList: string);
  14877. var
  14878. AStringList: TStringList;
  14879. iLoop, iIndex: Integer;
  14880. begin
  14881. AStringList := SplitString(AList, Chr(10));
  14882. FLVNetWorkDisk.DisableAlign;
  14883. try
  14884. for iLoop := 0 to AStringList.Count - 1 do
  14885. begin
  14886. iIndex := FLVNetWorkDisk.Items.IndexOf(AStringList.Strings[iLoop]);
  14887. if iIndex >= 0 then
  14888. FLVNetWorkDisk.Items.Delete(iIndex);
  14889. end;
  14890. finally
  14891. FLVNetWorkDisk.EnableAlign;
  14892. FreeAndNil(AStringList);
  14893. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14894. ShowNetWorkDiskSpaceInfo;
  14895. NDSelectItemChanged(nil);
  14896. end;
  14897. end;
  14898. //------------------------------------------------------------------------------
  14899. procedure TMainForm.RealICQNetWorkDiskClientDirectoryListReady(Sender: TObject);
  14900. var
  14901. iLoop, ItemIndex: Integer;
  14902. AFile: TRealICQNetWorkDiskFile;
  14903. ADirectory: TRealICQNetWorkDiskDirectory;
  14904. ListItem: TRealICQContacterListItem;
  14905. Bitmap: TBitmap;
  14906. UploadMission: TUploadMission;
  14907. NDDirName: string;
  14908. begin
  14909. spbNDMoveUp.Enabled := (not pnlNDMissions.Visible) and (RealICQNetWorkDiskClient.CurrentDirectory.Parent <> nil) and (RealICQNetWorkDiskClient.Connected);
  14910. edNDDir.Text := '';
  14911. ADirectory := RealICQNetWorkDiskClient.CurrentDirectory;
  14912. while ADirectory <> nil do
  14913. begin
  14914. edNDDir.Text := ADirectory.Name + '\' + edNDDir.Text;
  14915. ADirectory := ADirectory.Parent;
  14916. end;
  14917. try
  14918. FLVNetWorkDisk.AdjustPosition := False;
  14919. FLVNetWorkDisk.DisableAlign;
  14920. FLVNetWorkDisk.Items.Clear;
  14921. NDSelectItemChanged(nil);
  14922. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count - 1 do
  14923. begin
  14924. ADirectory := TRealICQNetWorkDiskDirectory(RealICQNetWorkDiskClient.CurrentDirectory.Directories[iLoop]);
  14925. ItemIndex := FLVNetWorkDisk.Items.Add('D' + IntToStr(ADirectory.ID));
  14926. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14927. with ListItem do
  14928. begin
  14929. LoginState := stOnline;
  14930. Data := ADirectory;
  14931. DisplayName := ADirectory.Name;
  14932. end;
  14933. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, 0, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14934. lblNDState.Update;
  14935. end;
  14936. for iLoop := 0 to RealICQNetWorkDiskClient.CurrentDirectory.Files.Count - 1 do
  14937. begin
  14938. AFile := TRealICQNetWorkDiskFile(RealICQNetWorkDiskClient.CurrentDirectory.Files[iLoop]);
  14939. ItemIndex := FLVNetWorkDisk.Items.Add('F' + IntToStr(AFile.ID));
  14940. ListItem := FLVNetWorkDisk.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  14941. with ListItem do
  14942. begin
  14943. LoginState := stLeave;
  14944. Data := AFile;
  14945. DisplayName := AFile.Name;
  14946. if AFile.Size >= 1024 * 1024 then
  14947. Watchword := Format('%0.1fMB', [AFile.Size / (1024 * 1024)])
  14948. else if AFile.Size >= 1024 then
  14949. Watchword := IntToStr(AFile.Size div 1024) + 'KB'
  14950. else
  14951. Watchword := IntToStr(AFile.Size) + 'B';
  14952. try
  14953. HeadImagePicture.LoadFromFile(GetBitmapFromFileExt(AFile.Name));
  14954. except
  14955. end;
  14956. FreeAndNil(Bitmap);
  14957. end;
  14958. lblNDState.Caption := Format('载入... 目录: %d/%d 文件: %d/%d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, iLoop + 1, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14959. lblNDState.Update;
  14960. end;
  14961. finally
  14962. FLVNetWorkDisk.ReDrawAll;
  14963. FLVNetWorkDisk.EnableAlign;
  14964. FLVNetWorkDisk.AdjustPosition := True;
  14965. lblNDState.Caption := Format('目录: %d 文件: %d', [RealICQNetWorkDiskClient.CurrentDirectory.Directories.Count, RealICQNetWorkDiskClient.CurrentDirectory.Files.Count]);
  14966. end;
  14967. if FLVNetWorkDiskUploadingFiles.Items.Count > 0 then
  14968. begin
  14969. ListItem := FLVNetWorkDiskUploadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  14970. UploadMission := TUploadMission(ListItem.Data);
  14971. if UploadMission.UploadMissionType = mtDir then
  14972. begin
  14973. if Length(ExtractFileName(UploadMission.Name)) = 0 then
  14974. NDDirName := '[' + Copy(UploadMission.Name, 1, 1) + ']'
  14975. else
  14976. NDDirName := ExtractFileName(UploadMission.Name);
  14977. if AnsiSameText(NDDirName, RealICQNetWorkDiskClient.CurrentDirectory.Name) and (RealICQNetWorkDiskClient.CurrentDirectory.ParentID = UploadMission.DirectoryID) then
  14978. begin
  14979. try
  14980. FLVNetWorkDiskUploadingFiles.Items.Delete(0);
  14981. except
  14982. end;
  14983. try
  14984. GoNextLevelUploadMissions(UploadMission);
  14985. finally
  14986. FreeAndNil(UploadMission);
  14987. end;
  14988. Exit;
  14989. end;
  14990. end;
  14991. end;
  14992. if Length(Trim(FLastDownloadDirectory)) > 0 then
  14993. begin
  14994. if (DirectoryExists(FLastDownloadDirectory)) then
  14995. begin
  14996. for iLoop := 0 to FLVNetWorkDisk.Items.Count - 1 do
  14997. begin
  14998. ListItem := FLVNetWorkDisk.Items.Objects[iLoop] as TRealICQContacterListItem;
  14999. if Copy(ListItem.LoginName, 1, 1) = 'D' then
  15000. begin
  15001. ADirectory := TRealICQNetWorkDiskDirectory(ListItem.Data);
  15002. AddDownloadMission(mtDir, FLastDownloadDirectory + '\' + ADirectory.Name, 0, '', False);
  15003. end
  15004. else
  15005. begin
  15006. AFile := TRealICQNetWorkDiskFile(ListItem.Data);
  15007. AddDownloadMission(mtFile, ExtractFilePath(FLastDownloadDirectory), AFile.ID, FLastDownloadDirectory + '\' + AFile.Name, False);
  15008. end;
  15009. end; //for
  15010. CheckDownloadMissions;
  15011. end;
  15012. end;
  15013. end;
  15014. //------------------------------------------------------------------------------
  15015. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileAborted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  15016. begin
  15017. end;
  15018. //------------------------------------------------------------------------------
  15019. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileCompleted(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  15020. var
  15021. ListItem: TRealICQContacterListItem;
  15022. DownloadMission: TDownloadMission;
  15023. MessageBoxResult: Integer;
  15024. begin
  15025. if not RealICQNetWorkDiskClient.Connected then
  15026. Exit;
  15027. try
  15028. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  15029. begin
  15030. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  15031. DownloadMission := TDownloadMission(ListItem.Data);
  15032. if DownloadMission.FFileID = AFileDownloader.FileID then
  15033. begin
  15034. if not AFileDownloader.Completed then
  15035. begin
  15036. if AFileDownloader.Exp <> nil then
  15037. begin
  15038. MessageBoxResult := MessageBox(Handle, PChar('下载文件时出错:'#$D#$A#$D#$A + AFileDownloader.Exp.Message), '提示', MB_ICONERROR or MB_ABORTRETRYIGNORE);
  15039. if MessageBoxResult = ID_ABORT then
  15040. begin
  15041. spbNDCancelAllClick(spbNDCancelAll);
  15042. Exit;
  15043. end
  15044. else if MessageBoxResult = ID_RETRY then
  15045. begin
  15046. CheckDownloadMissions;
  15047. Exit;
  15048. end
  15049. else if MessageBoxResult = ID_IGNORE then
  15050. begin
  15051. end;
  15052. end;
  15053. end;
  15054. FLVNetWorkDiskDownloadingFiles.Items.Delete(0);
  15055. FreeAndNil(DownloadMission);
  15056. end;
  15057. end;
  15058. except
  15059. end;
  15060. CheckDownloadMissions;
  15061. end;
  15062. //------------------------------------------------------------------------------
  15063. procedure TMainForm.RealICQNetWorkDiskClientDownloadFileTransmitting(Sender: TObject; AFileDownloader: TRealICQNWDFileDownloader);
  15064. var
  15065. ListItem: TRealICQContacterListItem;
  15066. Completed: Integer;
  15067. ASpeed: Cardinal;
  15068. SpeedStr: string;
  15069. begin
  15070. if FLVNetWorkDiskDownloadingFiles.Items.Count > 0 then
  15071. begin
  15072. ListItem := FLVNetWorkDiskDownloadingFiles.Items.Objects[0] as TRealICQContacterListItem;
  15073. with ListItem do
  15074. begin
  15075. Completed := AFileDownloader.RecvedSize * 100 div AFileDownloader.FileSize;
  15076. try
  15077. ASpeed := Round(AFileDownloader.RecvedSize div ((GetTickCount - AFileDownloader.StartTicket) div 1000) * 1.2);
  15078. except
  15079. Exit;
  15080. end;
  15081. if ASpeed > 1000 * 1000 then
  15082. SpeedStr := Format('%0.1fMB/秒', [ASpeed / (1000 * 1000)])
  15083. else if ASpeed > 1000 then
  15084. SpeedStr := Format('%0.1fKB/秒', [ASpeed / 1000])
  15085. else
  15086. SpeedStr := Format('%d字节/秒', [ASpeed]);
  15087. DisplayName := '(' + IntToStr(Completed) + '%,' + SpeedStr + ')';
  15088. DisplayName := DisplayName + (AFileDownloader.LocalFileName);
  15089. ReDrawItem;
  15090. end;
  15091. end;
  15092. end;
  15093. //------------------------------------------------------------------------------
  15094. procedure TMainForm.RealICQNetWorkDiskClientGettedUsedSpaceSize(Sender: TObject);
  15095. begin
  15096. ShowNetWorkDiskSpaceInfo;
  15097. end;
  15098. //------------------------------------------------------------------------------
  15099. procedure TMainForm.RealICQNetWorkDiskClientLoginFailed(Sender: TObject; E: Exception);
  15100. begin
  15101. lblNDState.Caption := '连接失败(' + E.Message + ')';
  15102. end;
  15103. //------------------------------------------------------------------------------
  15104. procedure TMainForm.RealICQNetWorkDiskClientLoginResult(Sender: TObject; LoginResultType: Byte);
  15105. begin
  15106. if LoginResultType = 0 then
  15107. begin
  15108. RealICQNetWorkDiskClient.GetDirectory(RealICQNetWorkDiskClient.CurrentDirectory);
  15109. end
  15110. else if LoginResultType = 1 then
  15111. begin
  15112. lblNDState.Caption := '连接失败,服务器版本错误';
  15113. end
  15114. else if LoginResultType = 2 then
  15115. begin
  15116. lblNDState.Caption := '连接失败,用户验证错误';
  15117. end;
  15118. end;
  15119. //------------------------------------------------------------------------------
  15120. procedure TMainForm.RealICQClientBeDropped(Sender: TObject; Excuse: string);
  15121. begin
  15122. MessageBox(Handle, PChar(Excuse), '你已被强制下线', MB_ICONINFORMATION or MB_OK);
  15123. TTeamsAdapter.Stop;
  15124. end;
  15125. //------------------------------------------------------------------------------
  15126. procedure TMainForm.RealICQClientDownloadFile(Sender: TObject; AFileName: string);
  15127. var
  15128. iLoop: Integer;
  15129. WebPanel: TWebPanel;
  15130. TabSheet: TTabSheet;
  15131. Bitmap: TBitmap;
  15132. begin
  15133. for iLoop := 0 to FWebTabs.Count - 1 do
  15134. begin
  15135. TabSheet := FWebTabs[iLoop];
  15136. WebPanel := FWebPanels.Objects[iLoop] as TWebPanel;
  15137. if AnsiSameText(WebPanel.Image, AFileName) then
  15138. begin
  15139. Bitmap := TBitmap.Create;
  15140. try
  15141. try
  15142. Bitmap.LoadFromFile(AFileName);
  15143. Bitmap.SetSize(ImgLstPageControl.Width, ImgLstPageControl.Height);
  15144. ImgLstPageControl.Add(Bitmap, Bitmap);
  15145. TabSheet.ImageIndex := ImgLstPageControl.Count - 1;
  15146. except
  15147. end;
  15148. finally
  15149. FreeAndNil(Bitmap);
  15150. end;
  15151. end;
  15152. end;
  15153. end;
  15154. //------------------------------------------------------------------------------
  15155. procedure TMainForm.RealICQClientDownloadTeamFace(Sender: TObject; AFileName: string);
  15156. begin
  15157. ShowGettedFace(AFileName);
  15158. end;
  15159. //------------------------------------------------------------------------------
  15160. procedure TMainForm.RealICQClientLoginFailed(Sender: TObject; E: Exception);
  15161. begin
  15162. TimerForLogining.Enabled := False;
  15163. SetUIState;
  15164. MessageBox(Handle, PChar('抱歉,您现在无法登录至服务器: ' + E.Message), '登录失败', MB_ICONINFORMATION or MB_OK);
  15165. end;
  15166. //------------------------------------------------------------------------------
  15167. procedure TMainForm.actShowLoginNameExecute(Sender: TObject);
  15168. var
  15169. iLoop: Integer;
  15170. RealICQContacterListView: TRealICQContacterListView;
  15171. RealICQContacterTreeView: TRealICQContacterTreeView;
  15172. begin
  15173. for iLoop := 0 to FContacterListViews.Count - 1 do
  15174. begin
  15175. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15176. RealICQContacterListView.CaptionStyle := csLoginName;
  15177. end;
  15178. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15179. begin
  15180. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15181. RealICQContacterTreeView.CaptionStyle := csLoginName;
  15182. RealICQContacterTreeView.ReDrawAll;
  15183. end;
  15184. FLVCaptionStyle := csLoginName;
  15185. SaveStyleConfigs;
  15186. end;
  15187. //------------------------------------------------------------------------------
  15188. procedure TMainForm.actShowDisplayNameExecute(Sender: TObject);
  15189. var
  15190. iLoop: Integer;
  15191. RealICQContacterListView: TRealICQContacterListView;
  15192. RealICQContacterTreeView: TRealICQContacterTreeView;
  15193. begin
  15194. for iLoop := 0 to FContacterListViews.Count - 1 do
  15195. begin
  15196. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15197. RealICQContacterListView.CaptionStyle := csDisplayName;
  15198. end;
  15199. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15200. begin
  15201. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15202. RealICQContacterTreeView.CaptionStyle := csDisplayName;
  15203. RealICQContacterTreeView.ReDrawAll;
  15204. end;
  15205. FLVCaptionStyle := csDisplayName;
  15206. SaveStyleConfigs;
  15207. end;
  15208. //------------------------------------------------------------------------------
  15209. procedure TMainForm.actShowGIFInMailFormExecute(Sender: TObject);
  15210. begin
  15211. actShowGIFInMailForm.Checked := not actShowGIFInMailForm.Checked;
  15212. FShowGIFInMailForm := actShowGIFInMailForm.Checked;
  15213. SaveStyleConfigs;
  15214. if RealICQClient.Me = nil then
  15215. Exit;
  15216. if RealICQClient.Me.HeadImageFileType = htGIF then
  15217. begin
  15218. ShowMeInformation;
  15219. end;
  15220. end;
  15221. //------------------------------------------------------------------------------
  15222. procedure TMainForm.actShowGIFInTalkingFormExecute(Sender: TObject);
  15223. begin
  15224. actShowGIFInTalkingForm.Checked := not actShowGIFInTalkingForm.Checked;
  15225. FShowGIFInTalkingForm := actShowGIFInTalkingForm.Checked;
  15226. SaveStyleConfigs;
  15227. UpdateAllTakingFormGIFHeadImage;
  15228. end;
  15229. //------------------------------------------------------------------------------
  15230. procedure TMainForm.actShowGroupExecute(Sender: TObject);
  15231. begin
  15232. FShowGroup := not FShowGroup;
  15233. actShowGroup.Checked := FShowGroup;
  15234. SaveIfShowGroupConfig;
  15235. ShowGroupInterface;
  15236. end;
  15237. //------------------------------------------------------------------------------
  15238. function TMainForm.GetSelectedLoginName: string;
  15239. var
  15240. GroupIndex, iLoop: Integer;
  15241. GroupName: string;
  15242. ListView: TRealICQContacterListView;
  15243. ListItem: TRealICQContacterListItem;
  15244. ItemIndex: Integer;
  15245. RealICQFriendTreeView: TRealICQContacterTreeView;
  15246. RealICQContacterTreeView: TRealICQContacterTreeView;
  15247. Employee: TRealICQEmployee;
  15248. Friend: TRealICQEmployee;
  15249. begin
  15250. Result := '';
  15251. if FSearchListViewInVisible then
  15252. begin
  15253. for iLoop := 0 to FSearchListView.Items.Count - 1 do
  15254. begin
  15255. ListItem := FSearchListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15256. if ListItem.Selected then
  15257. begin
  15258. Result := ListItem.LoginName;
  15259. Exit;
  15260. end;
  15261. end;
  15262. end;
  15263. GroupName := GetActiveTabSheetName;
  15264. if GroupName = LVMyContacters then
  15265. begin
  15266. ItemIndex := FContacterTreeViews.IndexOf(LVMyContacters);
  15267. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15268. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15269. if Employee <> nil then
  15270. begin
  15271. Result := Employee.LoginName;
  15272. end;
  15273. Exit;
  15274. end;
  15275. if GroupName = LVMoreUsers then
  15276. begin
  15277. ItemIndex := FContacterTreeViews.IndexOf(LVMoreUsers);
  15278. RealICQContacterTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15279. Employee := RealICQContacterTreeView.GetSelectedEmployee;
  15280. if Employee <> nil then
  15281. begin
  15282. Result := Employee.LoginName;
  15283. end;
  15284. Exit;
  15285. end;
  15286. if GroupName = LVFriends then
  15287. begin
  15288. ItemIndex := FContacterTreeViews.IndexOf(LVFriends);
  15289. RealICQFriendTreeView := FContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  15290. Friend := RealICQFriendTreeView.GetSelectedEmployee;
  15291. if Friend <> nil then
  15292. begin
  15293. Result := Friend.LoginName;
  15294. end;
  15295. Exit;
  15296. end;
  15297. GroupIndex := FContacterListViews.IndexOf(GroupName);
  15298. ListView := FContacterListViews.Objects[GroupIndex] as TRealICQContacterListView;
  15299. for iLoop := 0 to ListView.Items.Count - 1 do
  15300. begin
  15301. ListItem := ListView.Items.Objects[iLoop] as TRealICQContacterListItem;
  15302. if ListItem.Selected then
  15303. begin
  15304. Result := ListItem.LoginName;
  15305. Break;
  15306. end;
  15307. end;
  15308. end;
  15309. //------------------------------------------------------------------------------
  15310. procedure TMainForm.actShowHistoryExecute(Sender: TObject);
  15311. var
  15312. LoginName: string;
  15313. begin
  15314. LoginName := GetSelectedLoginName;
  15315. if LoginName <> '' then
  15316. begin
  15317. OpenMessagesManagerForm;
  15318. Application.ProcessMessages;
  15319. MessagesManagerForm.ShowUsersMessages(LoginName);
  15320. end;
  15321. end;
  15322. //------------------------------------------------------------------------------
  15323. procedure TMainForm.actSeeInformationExecute(Sender: TObject);
  15324. var
  15325. LoginName: string;
  15326. begin
  15327. LoginName := GetSelectedLoginName;
  15328. if LoginName <> '' then
  15329. begin
  15330. SeeUserInformation(LoginName);
  15331. end;
  15332. end;
  15333. //------------------------------------------------------------------------------
  15334. procedure TMainForm.actChangeRemarkExecute(Sender: TObject);
  15335. var
  15336. LoginName: string;
  15337. Remark: string;
  15338. RealICQUser: TRealICQUser;
  15339. begin
  15340. LoginName := GetSelectedLoginName;
  15341. if LoginName <> '' then
  15342. begin
  15343. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(LoginName);
  15344. if RealICQUser = nil then
  15345. Exit;
  15346. if (RealICQUser.LoginName = RealICQClient.Me.LoginName) then
  15347. begin
  15348. ShowMessage('不允许修改自己的备注名称!');
  15349. Exit;
  15350. end;
  15351. Remark := RealICQUser.Remark;
  15352. Remark := Trim(ShowMyInputBox('修改备注名称', '新备注名称', RealICQUser.Remark, 50));
  15353. if not AnsiSameStr(Remark, RealICQUser.Remark) then
  15354. RealICQClient.ChangeRemark(LoginName, Remark);
  15355. end;
  15356. end;
  15357. //------------------------------------------------------------------------------
  15358. procedure TMainForm.actSendMessageExecute(Sender: TObject);
  15359. var
  15360. LoginName: string;
  15361. begin
  15362. LoginName := GetSelectedLoginName;
  15363. if LoginName <> '' then
  15364. begin
  15365. if AnsiSameText(LoginName, RealICQClient.LoginName) then
  15366. begin
  15367. MessageBox(Handle, '对不起,不可以和自己对话!', '提示', MB_ICONINFORMATION);
  15368. Exit;
  15369. end;
  15370. //----------------------------------------
  15371. {if GetActiveTabSheetName=MoreUser then
  15372. begin
  15373. RealICQClient.GetUserInformation(LoginName,True);
  15374. end;}
  15375. OpenTalkingForm(LoginName);
  15376. end;
  15377. end;
  15378. //------------------------------------------------------------------------------
  15379. procedure TMainForm.actSendTeamMessageExecute(Sender: TObject);
  15380. var
  15381. iLoop: Integer;
  15382. ListItem: TRealICQContacterListItem;
  15383. RealICQTeam: TRealICQTeam;
  15384. begin
  15385. if FLVTeams.SelCount = 1 then
  15386. begin
  15387. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15388. begin
  15389. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15390. if ListItem.Selected then
  15391. begin
  15392. RealICQTeam := ListItem.Data;
  15393. OpenTeamTalkingForm(RealICQTeam.TeamID);
  15394. Break;
  15395. end;
  15396. end;
  15397. end;
  15398. end;
  15399. //------------------------------------------------------------------------------
  15400. procedure TMainForm.actSeeTeamInformationExecute(Sender: TObject);
  15401. var
  15402. iLoop: Integer;
  15403. ListItem: TRealICQContacterListItem;
  15404. RealICQTeam: TRealICQTeam;
  15405. begin
  15406. if FLVTeams.SelCount = 1 then
  15407. begin
  15408. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15409. begin
  15410. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15411. if ListItem.Selected then
  15412. begin
  15413. RealICQTeam := ListItem.Data;
  15414. OpenTeamOptionsForm(RealICQTeam);
  15415. Break;
  15416. end;
  15417. end;
  15418. end;
  15419. end;
  15420. //------------------------------------------------------------------------------
  15421. procedure TMainForm.actQuitTeamExecute(Sender: TObject);
  15422. var
  15423. iLoop: Integer;
  15424. ListItem: TRealICQContacterListItem;
  15425. RealICQTeam: TRealICQTeam;
  15426. begin
  15427. if FLVTeams.SelCount = 1 then
  15428. begin
  15429. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15430. begin
  15431. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15432. if ListItem.Selected then
  15433. begin
  15434. RealICQTeam := ListItem.Data;
  15435. if MessageBox(Handle, '真的要退出该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15436. Exit;
  15437. TTeamsAdapter.QuitTeam(RealICQTeam.TeamID);
  15438. Break;
  15439. end;
  15440. end;
  15441. end;
  15442. end;
  15443. //------------------------------------------------------------------------------
  15444. procedure TMainForm.actDisbandTeamExecute(Sender: TObject);
  15445. var
  15446. iLoop: Integer;
  15447. ListItem: TRealICQContacterListItem;
  15448. RealICQTeam: TRealICQTeam;
  15449. begin
  15450. {if FLVTeams.SelCount = 1 then
  15451. begin
  15452. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15453. begin
  15454. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15455. if ListItem.Selected then
  15456. begin
  15457. RealICQTeam := ListItem.Data;
  15458. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then Exit;
  15459. RealICQClient.DisbandTeam(RealICQTeam.TeamID);
  15460. Break;
  15461. end;
  15462. end;
  15463. end; }
  15464. if FLVTeams.SelCount = 1 then
  15465. begin
  15466. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15467. begin
  15468. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15469. if ListItem.Selected then
  15470. begin
  15471. RealICQTeam := ListItem.Data;
  15472. if MessageBox(Handle, '真的要解散该群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15473. Exit;
  15474. TTeamsAdapter.DisbandTeam(RealICQTeam.TeamID);
  15475. Break;
  15476. end;
  15477. end;
  15478. end;
  15479. end;
  15480. //------------------------------------------------------------------------------
  15481. procedure TMainForm.actQuitOrDisbandTeamsExecute(Sender: TObject);
  15482. var
  15483. iLoop: Integer;
  15484. ListItem: TRealICQContacterListItem;
  15485. RealICQTeam: TRealICQTeam;
  15486. begin
  15487. if MessageBox(Handle, '真的要退出 / 解散选中的群组吗?', '提示', MB_ICONINFORMATION or MB_OKCANCEL) <> ID_OK then
  15488. Exit;
  15489. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15490. begin
  15491. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15492. if ListItem.Selected then
  15493. begin
  15494. RealICQTeam := ListItem.Data;
  15495. if AnsiSameText(RealICQTeam.TeamCreater, RealICQClient.LoginName) then
  15496. RealICQClient.DisbandTeam(RealICQTeam.TeamID)
  15497. else
  15498. RealICQClient.QuitTeam(RealICQTeam.TeamID);
  15499. end;
  15500. end;
  15501. end;
  15502. //------------------------------------------------------------------------------
  15503. procedure TMainForm.actShowAllNameExecute(Sender: TObject);
  15504. var
  15505. iLoop: Integer;
  15506. RealICQContacterListView: TRealICQContacterListView;
  15507. RealICQContacterTreeView: TRealICQContacterTreeView;
  15508. begin
  15509. for iLoop := 0 to FContacterListViews.Count - 1 do
  15510. begin
  15511. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15512. RealICQContacterListView.CaptionStyle := csDisplayNameAndLoginName;
  15513. end;
  15514. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15515. begin
  15516. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15517. RealICQContacterTreeView.CaptionStyle := csDisplayNameAndLoginName;
  15518. RealICQContacterTreeView.ReDrawAll;
  15519. end;
  15520. FLVCaptionStyle := csDisplayNameAndLoginName;
  15521. SaveStyleConfigs;
  15522. end;
  15523. //------------------------------------------------------------------------------
  15524. procedure TMainForm.actShowBigHeadImageExecute(Sender: TObject);
  15525. var
  15526. iLoop: Integer;
  15527. RealICQContacterListView: TRealICQContacterListView;
  15528. RealICQContacterTreeView: TRealICQContacterTreeView;
  15529. begin
  15530. for iLoop := 0 to FContacterListViews.Count - 1 do
  15531. begin
  15532. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15533. RealICQContacterListView.Style := lsBigHeadImage;
  15534. end;
  15535. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15536. begin
  15537. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15538. RealICQContacterTreeView.Style := lsBigHeadImage;
  15539. RealICQContacterTreeView.ReDrawAll;
  15540. end;
  15541. FLVStyle := lsBigHeadImage;
  15542. SaveStyleConfigs;
  15543. end;
  15544. procedure TMainForm.actShowMiddleHeadImageExecute(Sender: TObject);
  15545. var
  15546. iLoop: Integer;
  15547. RealICQContacterListView: TRealICQContacterListView;
  15548. RealICQContacterTreeView: TRealICQContacterTreeView;
  15549. begin
  15550. for iLoop := 0 to FContacterListViews.Count - 1 do
  15551. begin
  15552. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15553. RealICQContacterListView.Style := lsMiddleHeadImage;
  15554. end;
  15555. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15556. begin
  15557. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15558. RealICQContacterTreeView.Style := lsMiddleHeadImage;
  15559. RealICQContacterTreeView.ReDrawAll;
  15560. end;
  15561. FLVStyle := lsMiddleHeadImage;
  15562. SaveStyleConfigs;
  15563. end;
  15564. //------------------------------------------------------------------------------
  15565. procedure TMainForm.actShowSmallHeadImageExecute(Sender: TObject);
  15566. var
  15567. iLoop: Integer;
  15568. RealICQContacterListView: TRealICQContacterListView;
  15569. RealICQContacterTreeView: TRealICQContacterTreeView;
  15570. begin
  15571. for iLoop := 0 to FContacterListViews.Count - 1 do
  15572. begin
  15573. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15574. RealICQContacterListView.Style := lsSmallHeadImage;
  15575. end;
  15576. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15577. begin
  15578. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15579. RealICQContacterTreeView.Style := lsSmallHeadImage;
  15580. RealICQContacterTreeView.ReDrawAll;
  15581. end;
  15582. FLVStyle := lsSmallHeadImage;
  15583. SaveStyleConfigs;
  15584. end;
  15585. //------------------------------------------------------------------------------
  15586. procedure TMainForm.actShowStrangersExecute(Sender: TObject);
  15587. begin
  15588. // SaveStyleConfigs;
  15589. end;
  15590. //------------------------------------------------------------------------------
  15591. procedure TMainForm.actShowBlacklistsExecute(Sender: TObject);
  15592. begin
  15593. // SaveStyleConfigs;
  15594. end;
  15595. //------------------------------------------------------------------------------
  15596. procedure TMainForm.actShowTeamHistoryExecute(Sender: TObject);
  15597. var
  15598. iLoop: Integer;
  15599. ListItem: TRealICQContacterListItem;
  15600. RealICQTeam: TRealICQTeam;
  15601. begin
  15602. if FLVTeams.SelCount = 1 then
  15603. begin
  15604. for iLoop := 0 to FLVTeams.Items.Count - 1 do
  15605. begin
  15606. ListItem := FLVTeams.Items.Objects[iLoop] as TRealICQContacterListItem;
  15607. if ListItem.Selected then
  15608. begin
  15609. RealICQTeam := ListItem.Data;
  15610. OpenMessagesManagerForm;
  15611. Application.ProcessMessages;
  15612. MessagesManagerForm.ShowTeamsMessages(RealICQTeam.TeamID);
  15613. Break;
  15614. end;
  15615. end;
  15616. end;
  15617. end;
  15618. //------------------------------------------------------------------------------
  15619. procedure TMainForm.actShowTeamsExecute(Sender: TObject);
  15620. begin
  15621. // SaveStyleConfigs;
  15622. end;
  15623. //------------------------------------------------------------------------------
  15624. procedure TMainForm.actShowTreeExecute(Sender: TObject);
  15625. begin
  15626. FShowTree := not FShowTree;
  15627. actShowTree.Checked := FShowTree;
  15628. actShowBigHeadImage.Visible := not actShowTree.Checked;
  15629. actShowMiddleHeadImage.Visible := not actShowTree.Checked;
  15630. if FShowTree then
  15631. begin
  15632. if FLVStyle <> lsNoHeadImage then
  15633. begin
  15634. FLVStyle := lsSmallHeadImage;
  15635. actShowSmallHeadImage.Execute;
  15636. end;
  15637. end;
  15638. SaveStyleConfigs;
  15639. ShowGroupInterface;
  15640. end;
  15641. //------------------------------------------------------------------------------
  15642. //------------------------------------------------------------------------------
  15643. procedure TMainForm.actAboutExecute(Sender: TObject);
  15644. begin
  15645. AboutForm := TAboutForm.Create(Self);
  15646. try
  15647. AboutForm.ShowModal;
  15648. finally
  15649. FreeAndNil(AboutForm);
  15650. end;
  15651. end;
  15652. procedure TMainForm.actAlwaysOnTopExecute(Sender: TObject);
  15653. begin
  15654. if FAlwaysOnTop then
  15655. SetOnTop(Handle, True)
  15656. else
  15657. SetOnTop(Handle, False);
  15658. actAlwaysOnTop.Checked := FAlwaysOnTop;
  15659. SaveDefaultConfigs;
  15660. end;
  15661. procedure TMainForm.actShowNormalHeadImageExecute(Sender: TObject);
  15662. var
  15663. iLoop: Integer;
  15664. RealICQContacterListView: TRealICQContacterListView;
  15665. RealICQContacterTreeView: TRealICQContacterTreeView;
  15666. begin
  15667. for iLoop := 0 to FContacterListViews.Count - 1 do
  15668. begin
  15669. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15670. RealICQContacterListView.Style := lsNoHeadImage;
  15671. end;
  15672. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15673. begin
  15674. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15675. RealICQContacterTreeView.Style := lsNoHeadImage;
  15676. RealICQContacterTreeView.ReDrawAll;
  15677. end;
  15678. FLVStyle := lsNoHeadImage;
  15679. SaveStyleConfigs;
  15680. end;
  15681. //------------------------------------------------------------------------------
  15682. procedure TMainForm.actShowRemarkExecute(Sender: TObject);
  15683. var
  15684. iLoop, jLoop: Integer;
  15685. RealICQContacterListView: TRealICQContacterListView;
  15686. RealICQContacterTreeView: TRealICQContacterTreeView;
  15687. RealICQContacterListItem: TRealICQContacterListItem;
  15688. RealICQUser: TRealICQUser;
  15689. Employee: TRealICQEmployee;
  15690. begin
  15691. actShowRemark.Checked := not actShowRemark.Checked;
  15692. RealICQClient.ShowRemark := actShowRemark.Checked;
  15693. for iLoop := 0 to FContacterListViews.Count - 1 do
  15694. begin
  15695. RealICQContacterListView := FContacterListViews.Objects[iLoop] as TRealICQContacterListView;
  15696. for jLoop := 0 to RealICQContacterListView.Items.Count - 1 do
  15697. begin
  15698. RealICQContacterListItem := RealICQContacterListView.Items.Objects[jLoop] as TRealICQContacterListItem;
  15699. RealICQUser := RealICQContacterListItem.Data;
  15700. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  15701. TUsersService.GetUsersService.UpdateListItem(RealICQContacterListView, RealICQContacterListItem, RealICQUser);
  15702. end;
  15703. end;
  15704. for iLoop := 0 to FContacterTreeViews.Count - 1 do
  15705. begin
  15706. RealICQContacterTreeView := FContacterTreeViews.Objects[iLoop] as TRealICQContacterTreeView;
  15707. for jLoop := 0 to RealICQContacterTreeView.Count - 1 do
  15708. begin
  15709. Employee := RealICQContacterTreeView.EmployeeItems.Objects[jLoop] as TRealICQEmployee;
  15710. RealICQUser := Employee.Data;
  15711. //UpdateEmployeeNode(Employee, RealICQUser, False);
  15712. TUsersService.GetUsersService.UpdateTreeNode(RealICQContacterTreeView, Employee, RealICQUser, False);
  15713. end;
  15714. RealICQContacterTreeView.ReDrawAll;
  15715. end;
  15716. end;
  15717. //------------------------------------------------------------------------------
  15718. procedure TMainForm.actFindUsersExecute(Sender: TObject);
  15719. begin
  15720. //非办公助手企业用户无查找用户权限
  15721. if (FProductType <> ptBGZS) AND ((FUserType = utUnknown) OR (FUserType = utCompany)) then
  15722. begin
  15723. ShowMessage('您没有查找用户权限! ');
  15724. Exit;
  15725. end;
  15726. if SearchForm <> nil then
  15727. begin
  15728. SearchForm.BringToFront;
  15729. Exit;
  15730. end;
  15731. SearchForm := TSearchForm.Create(Application);
  15732. SearchForm.Show;
  15733. end;
  15734. procedure TMainForm.actGroupManagerExecute(Sender: TObject);
  15735. begin
  15736. if GroupManagerForm <> nil then
  15737. Exit;
  15738. GroupManagerForm := TGroupManagerForm.Create(Self);
  15739. try
  15740. GroupManagerForm.ShowModal;
  15741. finally
  15742. FreeAndNil(GroupManagerForm);
  15743. end;
  15744. end;
  15745. //------------------------------------------------------------------------------
  15746. procedure TMainForm.OpenMessagesManagerForm;
  15747. begin
  15748. actMsgManagerExecute(nil);
  15749. end;
  15750. //------------------------------------------------------------------------------
  15751. procedure TMainForm.pgcMainWorkAreaTabChanging(Sender: TObject; NewIndex: Integer; var AllowChanged: Boolean);
  15752. var
  15753. TabSheet: TTabSheet;
  15754. WebPanel: TWebPanel;
  15755. Point: TPoint;
  15756. begin
  15757. {if NewIndex = 1 then
  15758. begin
  15759. MainForm.RealICQClient.OnGettedAddrBookGroups:=GettedAddrBookGroups;
  15760. MainForm.RealICQClient.OnManageAddrBookResult:=GettedManageAddrBookResult;
  15761. RealICQClient.SendGetAddrBookGroup;
  15762. end;}
  15763. if NewIndex > 2 then
  15764. begin
  15765. AllowChanged := False;
  15766. //if not DisplayWebs then Exit;
  15767. TabSheet := pgcMainWorkArea.Pages[NewIndex];
  15768. WebPanel := FWebPanels.Objects[TabSheet.Tag] as TWebPanel;
  15769. //if WebPanel.FNavigateType = ntFill then AllowChanged := True;
  15770. if WebPanel.Acounts.Count > 1 then
  15771. begin
  15772. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  15773. begin
  15774. Point.X := Mouse.CursorPos.X;
  15775. Point.Y := Mouse.CursorPos.Y;
  15776. FreeAndNil(SelWebTabAcountsForm);
  15777. SelWebTabAcountsForm := TSelWebTabAcountsForm.Create(Self);
  15778. SelWebTabAcountsForm.WebPanel := WebPanel;
  15779. SelWebTabAcountsForm.TabSheet := TabSheet;
  15780. SelWebTabAcountsForm.Left := Point.X;
  15781. SelWebTabAcountsForm.Top := Point.Y - 20;
  15782. if Left <= SelWebTabAcountsForm.Width then
  15783. SelWebTabAcountsForm.Left := Left + Width
  15784. else
  15785. SelWebTabAcountsForm.Left := Left - SelWebTabAcountsForm.Width;
  15786. if WebPanel.Acounts.Count < 10 then
  15787. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := WebPanel.Acounts.Count * cntHeightOfBigHeadImage + 3
  15788. else
  15789. SelWebTabAcountsForm.pnlClient.Constraints.MinHeight := 10 * cntHeightOfBigHeadImage + 3;
  15790. SelWebTabAcountsForm.pnlClient.Constraints.MaxHeight := SelWebTabAcountsForm.pnlClient.Constraints.MinHeight;
  15791. SelWebTabAcountsForm.Show;
  15792. Exit;
  15793. end;
  15794. end;
  15795. WebTabShow(TabSheet);
  15796. end;
  15797. end;
  15798. procedure TMainForm.pgcMainWorkAreaWebPanelButtonClick(Sender: TObject);
  15799. begin
  15800. pgcMainWorkArea.OnWebPanelButtonClick := nil;
  15801. if OptionsForm = nil then
  15802. OptionsForm := TOptionsForm.Create(Self);
  15803. try
  15804. OptionsForm.PageIndex := 10;
  15805. OptionsForm.ShowModal;
  15806. finally
  15807. FreeAndNil(OptionsForm);
  15808. pgcMainWorkArea.OnWebPanelButtonClick := pgcMainWorkAreaWebPanelButtonClick;
  15809. end;
  15810. end;
  15811. //调整各标签位置
  15812. procedure TMainForm.pnlToolBarResize(Sender: TObject);
  15813. var
  15814. AvgWidth: Integer;
  15815. iLeft: Integer;
  15816. begin
  15817. //宁夏企业用户隐藏全市标签
  15818. //if (FProductType = ptNXSQ) AND ((FUserType = utUnknown) OR (FUserType = utCompany)) then
  15819. if (FProductType = ptNXSQ) AND ((FUserType = utUnknown) OR (FUserType = utCompany)) then
  15820. begin
  15821. SysMsg.Visible := False;
  15822. SysMsgIcon.Visible := False;
  15823. AvgWidth := (pnlToolBar.Width - 2) div 4;
  15824. iLeft := 1;
  15825. MyContacters.Left := iLeft;
  15826. MyContacters.Width := AvgWidth;
  15827. MyContactersIcon.Left := iLeft + (AvgWidth - MyContactersIcon.Width) div 2;
  15828. iLeft := iLeft + AvgWidth;
  15829. MyTeam.Left := iLeft;
  15830. MyTeam.Width := AvgWidth;
  15831. MyTeamIcon.Left := iLeft + (AvgWidth - MyTeamIcon.Width) div 2;
  15832. iLeft := iLeft + AvgWidth;
  15833. MyFriend.Left := iLeft;
  15834. MyFriend.Width := AvgWidth;
  15835. MyFriendIcon.Left := iLeft + (AvgWidth - MyFriendIcon.Width) div 2;
  15836. iLeft := iLeft + AvgWidth;
  15837. Latests.Left := iLeft;
  15838. Latests.Width := pnlToolBar.Width - (AvgWidth * 3);
  15839. LatestsIcon.Left := iLeft + (AvgWidth - LatestsIcon.Width) div 2;
  15840. iLeft := iLeft + AvgWidth;
  15841. end
  15842. else
  15843. begin
  15844. SysMsg.Visible := True;
  15845. SysMsgIcon.Visible := True;
  15846. AvgWidth := (pnlToolBar.Width - 2) div 5;
  15847. iLeft := 1;
  15848. MyContacters.Left := iLeft;
  15849. MyContacters.Width := AvgWidth;
  15850. MyContactersIcon.Left := iLeft + (AvgWidth - MyContactersIcon.Width) div 2;
  15851. iLeft := iLeft + AvgWidth;
  15852. SysMsg.Left := iLeft;
  15853. SysMsg.Width := AvgWidth;
  15854. SysMsgIcon.Left := iLeft + (AvgWidth - SysMsgIcon.Width) div 2;
  15855. iLeft := iLeft + AvgWidth;
  15856. MyTeam.Left := iLeft;
  15857. MyTeam.Width := AvgWidth;
  15858. MyTeamIcon.Left := iLeft + (AvgWidth - MyTeamIcon.Width) div 2;
  15859. iLeft := iLeft + AvgWidth;
  15860. MyFriend.Left := iLeft;
  15861. MyFriend.Width := AvgWidth;
  15862. MyFriendIcon.Left := iLeft + (AvgWidth - MyFriendIcon.Width) div 2;
  15863. iLeft := iLeft + AvgWidth;
  15864. Latests.Left := iLeft;
  15865. Latests.Width := pnlToolBar.Width - (AvgWidth * 4);
  15866. LatestsIcon.Left := iLeft + (AvgWidth - LatestsIcon.Width) div 2;
  15867. iLeft := iLeft + AvgWidth;
  15868. end;
  15869. end;
  15870. {设置WebBrowser的样式}
  15871. //------------------------------------------------------------------------------
  15872. procedure TMainForm.SetDOMStyle(Doc: IHTMLDocument2);
  15873. var
  15874. CurrentColor, CssColor: string;
  15875. begin
  15876. try
  15877. CurrentColor := IntToHex(ConvertColorToColor(FormColor, MainForm.UIMainColor), 6);
  15878. CssColor := '#' + Copy(CurrentColor, 5, 2) + Copy(CurrentColor, 3, 2) + Copy(CurrentColor, 1, 2);
  15879. Doc.body.style.cssText := 'word-break: break-all;';
  15880. Doc.body.style.border := '0px solid';
  15881. Doc.body.style.fontFamily := '宋体';
  15882. Doc.body.style.fontSize := '9pt';
  15883. Doc.body.style.margin := '0pt';
  15884. Doc.body.setAttribute('scroll', 'no', 0);
  15885. Doc.body.style.backgroundColor := CssColor;
  15886. except
  15887. end;
  15888. end;
  15889. //------------------------------------------------------------------------------
  15890. procedure TMainForm.WebBrowserRightStatusTextChange(ASender: TObject; const Text: WideString);
  15891. var
  15892. TabSheet: TTabSheet;
  15893. begin
  15894. try
  15895. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15896. if pgcMultiWeb.ActivePage = TabSheet then
  15897. lblIEStatus.Caption := Text
  15898. else
  15899. lblIEStatus.Caption := '';
  15900. except
  15901. lblIEStatus.Caption := Text
  15902. end;
  15903. end;
  15904. //------------------------------------------------------------------------------
  15905. procedure TMainForm.WebBrowserRightTitleChange(ASender: TObject; const Text: WideString);
  15906. var
  15907. IETitle: WideString;
  15908. TabSheet: TTabSheet;
  15909. begin
  15910. TabSheet := ((ASender as TWebBrowser).Owner as TPanel).Owner as TTabSheet;
  15911. IETitle := Text;
  15912. //字符串长度过长时,截短字符串并在后面显示“...”
  15913. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) > 138 do
  15914. begin
  15915. if Length(IETitle) > 3 then
  15916. begin
  15917. if Copy(IETitle, Length(IETitle) - 2, Length(IETitle)) = '...' then
  15918. IETitle := Copy(IETitle, 1, Length(IETitle) - 3);
  15919. IETitle := Copy(IETitle, 1, Length(IETitle) - 1) + '...';
  15920. end
  15921. else
  15922. begin
  15923. IETitle := '...';
  15924. end;
  15925. end;
  15926. while TabSetMuiltWeb.Canvas.TextWidth(IETitle) < 88 do
  15927. begin
  15928. IETitle := IETitle + ' ';
  15929. end;
  15930. TabSetMuiltWeb.Tabs.Strings[TabSheet.TabIndex] := IETitle + ' ';
  15931. end;
  15932. //------------------------------------------------------------------------------
  15933. procedure TMainForm.WebBrowserRightWindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
  15934. var
  15935. TabSheet: TTabSheet;
  15936. WebBrowser: TWebBrowser;
  15937. begin
  15938. CoInitialize(nil);
  15939. try
  15940. WebBrowser := ASender as TWebBrowser;
  15941. TabSheet := (WebBrowser.Owner as TPanel).Owner as TTabSheet;
  15942. if pgcMultiWeb.PageCount > 1 then
  15943. begin
  15944. try
  15945. if WebBrowser.Busy then
  15946. WebBrowser.Stop;
  15947. except
  15948. end;
  15949. TabSetMuiltWeb.Tabs.Delete(TabSheet.TabIndex);
  15950. TabSheet.PageControl := nil;
  15951. FreeAndNil(TabSheet);
  15952. end
  15953. else
  15954. begin
  15955. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  15956. WebBrowser.Navigate('about:blank');
  15957. end;
  15958. finally
  15959. CoUninitialize;
  15960. Cancel := True;
  15961. end;
  15962. end;
  15963. {procedure TMainForm.WebSocketBroadCastMesssage(var msg: TMessage);
  15964. var
  15965. pdata: PBroadCastMessage;
  15966. RealICQTeamMessage: TRealICQTeamMessage;
  15967. begin
  15968. showmessage(pdata.GroupID);
  15969. RealICQTeamMessage:= TRealICQTeamMessage.Create(pdata.GroupID,pdata.Sayer,{pdata.Style}//'"宋体",9,[],[clBlack]',pdata.Msg,False);
  15970. { RealICQTeamMessage.MessageID := gettickcount();
  15971. RealICQTeamMessage.SendDateTime := pdata.timestamp;
  15972. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  15973. end; }
  15974. { TODO -olqq -c : WebSocket群通讯功能 2014/12/12 9:02:40 }
  15975. procedure TMainForm.WebSocketJionTeamRequest(TeamID, ALoginName, ATag: string);
  15976. var
  15977. ATeam: TRealICQTeam;
  15978. ATeamCaption: string;
  15979. begin
  15980. ATeam := TTeamsAdapter.GetTeam(TeamID);
  15981. if ATeam <> nil then
  15982. ATeamCaption := ATeam.TeamCaption;
  15983. AddMessageHistory(smSimple, Format('%s 请求加入群组 %s<%s>。', [ALoginName, ATeamCaption, TeamID]), nil);
  15984. ShowJoinTeamRequestWindow(Self, TeamID, ATeamCaption, ALoginName, ATag);
  15985. end;
  15986. procedure TMainForm.WebSocketQuitTeam(aTeamID: string);
  15987. var
  15988. iIndex: Integer;
  15989. AlertMessage: string;
  15990. ARealICQTeam: TRealICQTeam;
  15991. AForm: TForm;
  15992. begin
  15993. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  15994. if iIndex >= 0 then
  15995. begin
  15996. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  15997. if ARealICQTeam = nil then
  15998. Exit;
  15999. FLVTeams.Items.Delete(iIndex);
  16000. if ARealICQTeam.IsTempTeam then
  16001. AlertMessage := '您 退出了 多人对话'
  16002. else
  16003. AlertMessage := '您 退出了群组: ' + ARealICQTeam.TeamCaption;
  16004. ShowNotifyAlertForm(AlertMessage);
  16005. AddMessageHistory(smSimple, AlertMessage, nil);
  16006. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  16007. AForm := GetTeamTalkingForm(aTeamID);
  16008. FreeAndNil(AForm);
  16009. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  16010. UpdateTeamTalkingForm(ARealICQTeam);
  16011. end;
  16012. end;
  16013. procedure TMainForm.WebSocketRecivedbroadcastmesssage(aID, aGroupID, aSayer, aStyle, aMsg: string; aTimesTamp: TDateTime);
  16014. var
  16015. RealICQTeamMessage: TRealICQTeamMessage;
  16016. aDateTime: TDateTime;
  16017. begin
  16018. RealICQTeamMessage := TRealICQTeamMessage.Create(aGroupID, aSayer, aStyle{'"宋体",9,[],[clBlack]'}, aMsg, False);
  16019. RealICQTeamMessage.MessageID := gettickcount();
  16020. RealICQTeamMessage.SendDateTime := aTimesTamp;
  16021. ShowRealICQTeamMessage(RealICQTeamMessage, False);
  16022. end;
  16023. procedure TMainForm.WebSocketRemoveTeamResponse(aTeamID: string);
  16024. var
  16025. iIndex: Integer;
  16026. AlertMessage: string;
  16027. RealICQUser: TRealICQUser;
  16028. ARealICQTeam: TRealICQTeam;
  16029. AForm: TForm;
  16030. begin
  16031. iIndex := FLVTeams.Items.IndexOf(aTeamID);
  16032. if iIndex >= 0 then
  16033. begin
  16034. FLVTeams.Items.Delete(iIndex);
  16035. FLVTeams.ReDrawAll;
  16036. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  16037. if ARealICQTeam = nil then
  16038. Exit;
  16039. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ARealICQTeam.TeamCreater);
  16040. if RealICQUser = RealICQClient.Me then
  16041. AlertMessage := '您'
  16042. else if RealICQUser.DisplayName = '' then
  16043. AlertMessage := RealICQUser.LoginName
  16044. else
  16045. AlertMessage := RealICQUser.DisplayName;
  16046. if ARealICQTeam.IsTempTeam then
  16047. AlertMessage := AlertMessage + ' 解散了 多人对话'
  16048. else
  16049. AlertMessage := AlertMessage + ' 解散了群组: ' + ARealICQTeam.TeamCaption;
  16050. ShowNotifyAlertForm(AlertMessage);
  16051. AddMessageHistory(smSimple, AlertMessage, nil);
  16052. CloseTeamOptionsForm(ARealICQTeam.TeamID);
  16053. CloseJoinTeamRequestWindow(ARealICQTeam.TeamID);
  16054. AForm := GetTeamTalkingForm(aTeamID);
  16055. FreeAndNil(AForm);
  16056. end;
  16057. end;
  16058. procedure TMainForm.WebSocketSendReadTeamInfo(aTeamID: string);
  16059. var
  16060. iLoop, iIndex: Integer;
  16061. ListItem: TRealICQContacterListItem;
  16062. MemberList: TStringList;
  16063. ARealICQTeam: TRealICQTeam;
  16064. begin
  16065. ARealICQTeam := TTeamsAdapter.GetTeam(aTeamID);
  16066. iIndex := FLVTeams.Items.IndexOf(ARealICQTeam.TeamID);
  16067. if iIndex = -1 then
  16068. iIndex := FLVTeams.Items.Add(ARealICQTeam.TeamID);
  16069. ListItem := FLVTeams.Items.Objects[iIndex] as TRealICQContacterListItem;
  16070. if ARealICQTeam.IsTempTeam then
  16071. ListItem.Watchword := ''
  16072. else
  16073. ListItem.Watchword := ARealICQTeam.TeamIntro;
  16074. ListItem.LoginState := stLeave;
  16075. MemberList := SplitString(ARealICQTeam.TeamMembers, Chr(10));
  16076. try
  16077. for iLoop := MemberList.Count - 1 downto 0 do
  16078. begin
  16079. if Length(Trim(MemberList[iLoop])) = 0 then
  16080. MemberList.Delete(iLoop);
  16081. end;
  16082. ListItem.LeaveMessage := IntToStr(MemberList.Count) + '个成员';
  16083. finally
  16084. MemberList.Free;
  16085. end;
  16086. {try
  16087. ListItem.HeadImagePicture.LoadFromFile(ExtractFilePath(Application.ExeName) + TeamPicture);
  16088. except
  16089. ListItem.HeadImagePicture.Graphic := nil;
  16090. end; }
  16091. if ARealICQTeam.IsTempTeam then
  16092. ListItem.DisplayName := '多人对话'
  16093. else
  16094. ListItem.DisplayName := ARealICQTeam.TeamCaption;
  16095. ListItem.Data := ARealICQTeam;
  16096. ListItem.ReDrawItem;
  16097. UpdateTeamOptionsForm(ARealICQTeam);
  16098. UpdateTeamTalkingForm(ARealICQTeam);
  16099. end;
  16100. { TODO -olqq -c : EndWebsocket 2014/12/12 9:05:23 }
  16101. //------------------------------------------------------------------------------
  16102. procedure TMainForm.WebBrowserRightNewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
  16103. var
  16104. WebBrowser1, WebBrowser: TWebBrowser;
  16105. begin
  16106. CoInitialize(nil);
  16107. try
  16108. try
  16109. WebBrowser1 := ASender as TWebBrowser;
  16110. if WebBrowser1.Busy then
  16111. begin
  16112. Cancel := True;
  16113. Exit;
  16114. end;
  16115. WebBrowser := AddWebBrowserToPageControl('about:blank', -3);
  16116. if WebBrowser = nil then
  16117. begin
  16118. Cancel := True;
  16119. Exit;
  16120. end;
  16121. try
  16122. if (WebBrowser.Busy) then
  16123. WebBrowser.Stop;
  16124. except
  16125. end;
  16126. ppDisp := WebBrowser.ControlInterface;
  16127. except
  16128. Cancel := True;
  16129. end;
  16130. finally
  16131. CoUninitialize;
  16132. end;
  16133. end;
  16134. //------------------------------------------------------------------------------
  16135. function TMainForm.AddWebBrowserToPageControl(AUrl: string; WebPanelTag: Integer = -1): TWebBrowser;
  16136. var
  16137. TabSheet: TTabSheet;
  16138. PanelForIE: TPanel;
  16139. WebBrowser: TWebBrowser;
  16140. begin
  16141. if (WebPanelTag = -1) or (WebPanelTag = -3) or (pgcMultiWeb.PageCount <= 0) then
  16142. begin
  16143. TabSheet := TTabSheet.Create(pgcMultiWeb);
  16144. try
  16145. TabSheet.Parent := pgcMultiWeb;
  16146. TabSheet.PageControl := pgcMultiWeb;
  16147. TabSheet.DoubleBuffered := True;
  16148. PanelForIE := TPanel.Create(TabSheet);
  16149. PanelForIE.Parent := TabSheet;
  16150. PanelForIE.DoubleBuffered := True;
  16151. PanelForIE.Color := clWhite;
  16152. PanelForIE.Align := alClient;
  16153. PanelForIE.BevelInner := bvNone;
  16154. PanelForIE.BevelOuter := bvNone;
  16155. PanelForIE.Visible := True;
  16156. PanelForIE.Padding.Left := 2;
  16157. PanelForIE.Padding.Top := 2;
  16158. PanelForIE.Padding.Right := 2;
  16159. PanelForIE.Padding.Bottom := 2;
  16160. WebBrowser := TWebBrowser.Create(PanelForIE);
  16161. WebBrowser.DoubleBuffered := True;
  16162. WebBrowser.ParentWindow := PanelForIE.Handle;
  16163. WebBrowser.Align := alClient;
  16164. WebBrowser.OnStatusTextChange := WebBrowserRightStatusTextChange;
  16165. WebBrowser.OnTitleChange := WebBrowserRightTitleChange;
  16166. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16167. WebBrowser.OnNewWindow2 := WebBrowserRightNewWindow2;
  16168. WebBrowser.OnWindowClosing := WebBrowserRightWindowClosing;
  16169. WebBrowser.Tag := WebPanelTag;
  16170. PanelForIE.InsertControl(WebBrowser);
  16171. except
  16172. TabSheet.PageControl := nil;
  16173. FreeAndNil(TabSheet);
  16174. Result := nil;
  16175. Exit;
  16176. end;
  16177. TabSetMuiltWeb.Tabs.Add(AUrl + ' ');
  16178. try
  16179. TabSetMuiltWeb.TabIndex := TabSetMuiltWeb.Tabs.Count - 1;
  16180. except
  16181. end;
  16182. pgcMultiWeb.ActivePageIndex := pgcMultiWeb.PageCount - 1;
  16183. end
  16184. else
  16185. begin
  16186. TabSheet := pgcMultiWeb.Pages[0];
  16187. WebBrowser := (TabSheet.Controls[0] as TPanel).Controls[0] as TWebBrowser;
  16188. WebBrowser.Tag := WebPanelTag;
  16189. TabSetMuiltWeb.Tabs.Strings[0] := (AUrl + ' ');
  16190. TabSetMuiltWeb.TabIndex := 0;
  16191. pgcMultiWeb.ActivePageIndex := 0;
  16192. end;
  16193. {
  16194. if not pnlMiddleRight.Visible then
  16195. begin
  16196. if RealICQClient.Logined and RealICQClient.Connected then
  16197. begin
  16198. ShowOrHideMuiltiWeb;
  16199. end;
  16200. end;
  16201. try
  16202. if (WebBrowser.Busy) then WebBrowser.Stop;
  16203. except
  16204. end;
  16205. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  16206. //if not ((WebPanelTag = -3) and AnsiSameText(AUrl, 'about:blank')) then
  16207. try
  16208. WebBrowser.Navigate(AUrl);
  16209. except
  16210. end;
  16211. Result := WebBrowser;
  16212. }
  16213. end;
  16214. //------------------------------------------------------------------------------
  16215. {
  16216. procedure TMainForm.WebTabShow(Sender: TObject);
  16217. var
  16218. iIndex: Integer;
  16219. TabSheet: TTabSheet;
  16220. WebPanel: TWebPanel;
  16221. WebURL: String;
  16222. begin
  16223. TabSheet := Sender as TTabSheet;
  16224. //TabSheet.OnShow := nil;
  16225. iIndex := FWebTabs.IndexOf(TabSheet);
  16226. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16227. while TabSheet.ControlCount > 0 do
  16228. begin
  16229. TabSheet.Controls[0].Free;
  16230. //TabSheet.RemoveControl(TabSheet.Controls[0]);
  16231. end;
  16232. if WebPanel.NavigateType = ntGET then
  16233. begin
  16234. WebURL := WebPanel.URL;
  16235. if WebPanel.UserIMLoginName then
  16236. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', RealICQClient.LoginName)
  16237. else
  16238. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebPanel.CustomLoginName);
  16239. if WebPanel.UserIMPassword then
  16240. WebURL := AnsiReplaceText(WebURL, '[%Password%]', RealICQClient.Password)
  16241. else
  16242. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebPanel.CustomPassword);
  16243. AddWebBrowserToPageControl(WebUrl, iIndex);
  16244. end
  16245. else
  16246. AddWebBrowserToPageControl('about:blank', iIndex);
  16247. end;
  16248. }
  16249. //------------------------------------------------------------------------------
  16250. //新Post方式
  16251. procedure TMainForm.WebBrowserRightDocumentCompleteForPost(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16252. var
  16253. WebBrowser: TWebBrowser;
  16254. WebPanel: TWebPanel;
  16255. WebTabAcount: TWebTabAcount;
  16256. FieldName, ALoginName, FieldValue: string;
  16257. PostFields, Field: TStringList;
  16258. iLoop, jLoop, kLoop: Integer;
  16259. WebItem: Olevariant;
  16260. WebItemChild: Olevariant;
  16261. WebItemForm: Olevariant;
  16262. AFindedForm: Boolean;
  16263. ASubmitID: string;
  16264. begin
  16265. WebBrowser := ASender as TWebBrowser;
  16266. WebBrowser.OnDocumentComplete := nil;
  16267. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16268. if WebPanel.Acounts.Count > 0 then
  16269. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16270. else
  16271. WebTabAcount := nil;
  16272. ASubmitID := '';
  16273. ;
  16274. AFindedForm := False;
  16275. PostFields := SplitString(WebPanel.PostFields, ',');
  16276. try
  16277. for kLoop := 0 to PostFields.Count - 1 do
  16278. begin
  16279. Field := SplitStringEx(PostFields.Strings[kLoop], '=');
  16280. try
  16281. try
  16282. FieldName := Field.Strings[0];
  16283. FieldValue := Field.Strings[1];
  16284. if FieldName = 'LXTALK_SUBMIT_BTN' then
  16285. ASubmitID := FieldValue;
  16286. if WebTabAcount <> nil then
  16287. begin
  16288. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16289. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16290. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16291. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16292. end;
  16293. WebBrowser.OleObject.Document.getElementByID(FieldName).value := FieldValue;
  16294. //找到Form
  16295. if not AFindedForm then
  16296. begin
  16297. WebItem := WebBrowser.Document;
  16298. for iLoop := 0 to WebItem.Forms.length - 1 do
  16299. begin
  16300. //ShowMessage(WebItem.Forms.Item(iLoop, 0).name);
  16301. WebItemChild := WebItem.Forms.Item(iLoop, 0);
  16302. for jLoop := 0 to WebItemChild.all.length - 1 do
  16303. begin
  16304. if AnsiSameText(WebItemChild.all.item(jLoop).tagName, 'INPUT') then
  16305. begin
  16306. if AnsiSameText(WebItemChild.all.item(jLoop).name, FieldName) then
  16307. begin
  16308. AFindedForm := True;
  16309. WebItemForm := WebItemChild;
  16310. Break;
  16311. end;
  16312. //ShowMessage(WebItemChild.all.item(jLoop).tagName);
  16313. //ShowMessage(WebItemChild.all.item(jLoop).type);
  16314. //ShowMessage(WebItemChild.all.item(jLoop).name);
  16315. end;
  16316. end; //for
  16317. end; //for
  16318. end; //if
  16319. except
  16320. end;
  16321. finally
  16322. Field.Free;
  16323. end;
  16324. end;
  16325. finally
  16326. PostFields.Free;
  16327. end;
  16328. //ShowMessage(WebItemForm.Action);
  16329. //Exit;
  16330. WebItemForm.target := '_blank';
  16331. //Exit;
  16332. if ASubmitID <> '' then
  16333. begin
  16334. for jLoop := 0 to WebItemForm.all.length - 1 do
  16335. begin
  16336. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16337. begin
  16338. if AnsiSameText(WebItemForm.all.item(jLoop).name, ASubmitID) then
  16339. begin
  16340. WebItemForm.all.item(jLoop).click;
  16341. end;
  16342. end;
  16343. end;
  16344. end
  16345. else
  16346. begin
  16347. for jLoop := 0 to WebItemForm.all.length - 1 do
  16348. begin
  16349. if AnsiSameText(WebItemForm.all.item(jLoop).tagName, 'INPUT') then
  16350. begin
  16351. if AnsiSameText(WebItemForm.all.item(jLoop).type, 'submit') then
  16352. begin
  16353. WebItemForm.all.item(jLoop).click;
  16354. end;
  16355. end;
  16356. end;
  16357. end;
  16358. Application.ProcessMessages;
  16359. Sleep(100);
  16360. Application.ProcessMessages;
  16361. //FreeAndNil(WebBrowser);
  16362. end;
  16363. //------------------------------------------------------------------------------
  16364. //Get方式加旧版本Post方式
  16365. procedure TMainForm.WebBrowserRightDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16366. var
  16367. PanelForIE: TPanel;
  16368. WebBrowser: TWebBrowser;
  16369. WebPanel: TWebPanel;
  16370. v: Variant;
  16371. parameters: string;
  16372. OldTag, iLoop: Integer;
  16373. PostFields, Field: TStringList;
  16374. WebURL, FieldName, ALoginName, FieldValue: string;
  16375. WebTabAcount: TWebTabAcount;
  16376. SetTagAsZero: Boolean;
  16377. begin
  16378. WebBrowser := ASender as TWebBrowser;
  16379. OldTag := WebBrowser.Tag;
  16380. SetTagAsZero := True;
  16381. PanelForIE := WebBrowser.Owner as TPanel;
  16382. try
  16383. if (not PanelForIE.Visible) and (not AnsiSameText(URL, 'about:blank')) then
  16384. begin
  16385. //PanelForIE.Visible := True;
  16386. WebBrowser.OnDocumentComplete := nil;
  16387. WebBrowser.Navigate('about:blank');
  16388. //ShellExecute(handle,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),PChar(String(URL)),'',SW_SHOWMAXIMIZED);
  16389. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(URL)), '', SW_SHOWMAXIMIZED);
  16390. Exit;
  16391. end;
  16392. {if not AnsiSameText(URL, 'about:blank') then
  16393. begin
  16394. WebBrowser.OnDocumentComplete := nil;
  16395. with cbxURLInputer.ItemsEx.Add do
  16396. begin
  16397. Caption := URL;
  16398. if (Copy(Caption, 1, 5) = 'file:') or (Copy(Caption, 2, 1) = ':') then
  16399. ImageIndex := 2
  16400. else if Copy(Caption, 1, 4) = 'ftp:' then
  16401. ImageIndex := 1
  16402. else
  16403. ImageIndex := 0;
  16404. end;
  16405. cbxURLInputer.ItemIndex := cbxURLInputer.ItemsEx.Count - 1;
  16406. if WebBrowser.Document <> nil then
  16407. begin
  16408. (WebBrowser.Application as IOleobject).DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser, 0, Handle, GetClientRect);
  16409. end;
  16410. end;}
  16411. if AnsiSameText(URL, 'about:blank') and (WebBrowser.Tag >= 0) and (TabAcountIndex >= 0) then
  16412. begin
  16413. WebPanel := FWebPanels.Objects[WebBrowser.Tag] as TWebPanel;
  16414. if WebPanel.Acounts.Count > 0 then
  16415. WebTabAcount := WebPanel.Acounts[TabAcountIndex]
  16416. else
  16417. WebTabAcount := nil;
  16418. WebBrowser.Tag := -1;
  16419. WebURL := WebPanel.URL;
  16420. if WebPanel.FName = '网络存储' then
  16421. begin
  16422. OpenNewWorkDisk(WebPanel.FURL);
  16423. Exit;
  16424. end;
  16425. if WebPanel.FNavigateType = ntGET then
  16426. begin
  16427. if Length(Trim(WebPanel.PostFields)) > 0 then
  16428. begin
  16429. if Pos('?', WebPanel.URL) > 0 then
  16430. WebURL := WebPanel.URL + '&' + ReplaceStr(WebPanel.PostFields, ',', '&')
  16431. else
  16432. WebURL := WebPanel.URL + '?' + ReplaceStr(WebPanel.PostFields, ',', '&');
  16433. end;
  16434. if WebTabAcount <> nil then
  16435. begin
  16436. WebURL := AnsiReplaceText(WebURL, '[%LoginName%]', WebTabAcount.LoginName);
  16437. WebURL := AnsiReplaceText(WebURL, '[%Password%]', WebTabAcount.Password);
  16438. WebURL := AnsiReplaceText(WebURL, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16439. WebURL := AnsiReplaceText(WebURL, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16440. WebURL := AnsiReplaceText(WebURL, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16441. WebURL := AnsiReplaceText(WebURL, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16442. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16443. WebURL := AnsiReplaceText(WebURL, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16444. end;
  16445. parameters := ALoginName + ' ' + RealICQClient.Password;
  16446. ShellExecute(handle, 'open', PChar(GetDefaultBrowser), PChar(string(Trim(WebURL))), PChar(parameters), SW_SHOWMAXIMIZED);
  16447. end
  16448. else
  16449. begin
  16450. v := VarArrayCreate([0, 0], varVariant);
  16451. v[0] := '<body>' + '<form method="post" action="' + WebURL + '" target="_blank">';
  16452. PostFields := SplitString(WebPanel.PostFields, ',');
  16453. for iLoop := 0 to PostFields.Count - 1 do
  16454. begin
  16455. Field := SplitStringEx(PostFields.Strings[iLoop], '=');
  16456. try
  16457. FieldName := Field.Strings[0];
  16458. FieldValue := Field.Strings[1];
  16459. if WebTabAcount <> nil then
  16460. begin
  16461. FieldValue := AnsiReplaceText(FieldValue, '[%LoginName%]', WebTabAcount.LoginName);
  16462. FieldValue := AnsiReplaceText(FieldValue, '[%Password%]', WebTabAcount.Password);
  16463. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_LoginName%]', StrToBase64(WebTabAcount.LoginName));
  16464. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_Password%]', StrToBase64(WebTabAcount.Password));
  16465. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_LoginName%]', MD5En(WebTabAcount.LoginName));
  16466. FieldValue := AnsiReplaceText(FieldValue, '[%MD5_Password%]', MD5En(WebTabAcount.Password));
  16467. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_LoginName%]', StrToBase64(MD5En(WebTabAcount.LoginName)));
  16468. FieldValue := AnsiReplaceText(FieldValue, '[%BASE64_MD5_Password%]', StrToBase64(MD5En(WebTabAcount.Password)));
  16469. end;
  16470. v[0] := v[0] + '<input type="hidden" ' + 'name="' + FieldName + '" ' + 'value="' + FieldValue + '">';
  16471. except
  16472. end;
  16473. Field.Free;
  16474. end;
  16475. PostFields.Free;
  16476. v[0] := v[0] + '</form>' + '</body>';
  16477. (WebBrowser.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16478. WebBrowser.oleobject.document.Forms.Item(0, 0).Submit;
  16479. end;
  16480. end;
  16481. finally
  16482. ClearMemory;
  16483. if SetTagAsZero then
  16484. WebBrowser.Tag := -1;
  16485. //pgcMainWorkArea.ActivePageIndex := 0;
  16486. end;
  16487. end;
  16488. procedure TMainForm.WebBrowserForPostWorkOrderDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
  16489. begin
  16490. //
  16491. { if URL='about:blank' then
  16492. begin
  16493. v := VarArrayCreate([0, 0], varVariant);
  16494. v[0] := '<body>' +
  16495. '<form method="post" action="' + WebURL + '" target="_blank">';
  16496. v[0] := v[0] +
  16497. '<input type="hidden" ' +
  16498. 'name="' + FieldName +'" ' +
  16499. 'value="'+ FieldValue + '">';
  16500. v[0] := v[0] +
  16501. '</form>' +
  16502. '</body>';
  16503. (WebBrowserForPostWorkOrder.Document as IHtmlDocument2).Write(PSafeArray(TVarData(v).VArray));
  16504. WebBrowserForPostWorkOrder.oleobject.document.Forms.Item(0, 0).Submit;
  16505. end; }
  16506. end;
  16507. procedure TMainForm.UploadWebTabAccounts;
  16508. var
  16509. iLoop, jLoop: Integer;
  16510. WebPanel: TWebPanel;
  16511. StrTemp: string;
  16512. WebTabAcount: TWebTabAcount;
  16513. begin
  16514. StrTemp := '';
  16515. for iLoop := 0 to WebPanels.Count - 1 do
  16516. begin
  16517. WebPanel := WebPanels.Objects[iLoop] as TWebPanel;
  16518. for jLoop := 0 to WebPanel.Acounts.Count - 1 do
  16519. begin
  16520. WebTabAcount := WebPanel.Acounts[jLoop];
  16521. 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);
  16522. end;
  16523. end;
  16524. MainForm.RealICQClient.CallServerDBProcedure('SetWebTabAcounts', StrTemp);
  16525. end;
  16526. //------------------------------------------------------------------------------
  16527. procedure TMainForm.WebTabShow(Sender: TObject);
  16528. var
  16529. iIndex: Integer;
  16530. TabSheet: TTabSheet;
  16531. WebPanel: TWebPanel;
  16532. WebTabAcount: TWebTabAcount;
  16533. iLoop: Integer;
  16534. begin
  16535. if not DisplayWebs then
  16536. Exit;
  16537. TabSheet := Sender as TTabSheet;
  16538. //TabSheet.OnShow := nil;
  16539. iIndex := FWebTabs.IndexOf(TabSheet);
  16540. iIndex := TabSheet.Tag;
  16541. WebPanel := FWebPanels.Objects[iIndex] as TWebPanel;
  16542. TabAcountIndex := 0;
  16543. if WebPanel.Acounts.Count = 0 then
  16544. begin
  16545. if not ((Pos('[%', WebPanel.URL) <= 0) and (Pos('%]', WebPanel.URL) <= 0) and (Pos('[%', WebPanel.PostFields) <= 0) and (Pos('%]', WebPanel.PostFields) <= 0)) then
  16546. begin
  16547. AddWebTabForm := TAddWebTabForm.Create(Self);
  16548. try
  16549. AddWebTabForm.NewWebPanel := True;
  16550. AddWebTabForm.Left := Mouse.CursorPos.X;
  16551. AddWebTabForm.Top := Mouse.CursorPos.Y - 20;
  16552. if Left <= AddWebTabForm.Width then
  16553. AddWebTabForm.Left := Left + Width - 10
  16554. else
  16555. AddWebTabForm.Left := Left - AddWebTabForm.Width + 10;
  16556. if (AddWebTabForm.Top + AddWebTabForm.Height) > Screen.Height then
  16557. AddWebTabForm.Top := Screen.Height - AddWebTabForm.Height;
  16558. if AddWebTabForm.ShowModal = mrOK then
  16559. begin
  16560. WebTabAcount := TWebTabAcount.Create;
  16561. WebTabAcount.WebTabID := StrToInt(WebPanel.ID);
  16562. WebTabAcount.Title := Trim(AddWebTabForm.edTitle.Text);
  16563. WebTabAcount.LoginName := AddWebTabForm.ALoginName;
  16564. WebTabAcount.Password := AddWebTabForm.APassword;
  16565. WebTabAcount.Explain := Trim(AddWebTabForm.edExplain.Text);
  16566. WebPanel.Acounts.Add(WebTabAcount);
  16567. UploadWebTabAccounts;
  16568. end
  16569. else
  16570. begin
  16571. TabAcountIndex := -1;
  16572. end;
  16573. finally
  16574. FreeAndNil(AddWebTabForm);
  16575. end;
  16576. end;
  16577. end;
  16578. OpenWebTab(TabSheet, WebPanel, TabAcountIndex);
  16579. end;
  16580. //------------------------------------------------------------------------------
  16581. procedure TMainForm.ShowOrHideMuiltiWeb;
  16582. var
  16583. OldWidth: Integer;
  16584. begin
  16585. LockWindowUpdate(GetDesktopWindow);
  16586. OldWidth := pnlMiddleClient.Width;
  16587. try
  16588. //if not pnlMiddleRight.Visible then pnlMiddleRight.Width := 680;
  16589. pnlMiddleRight.Visible := not pnlMiddleRight.Visible;
  16590. Spl.Visible := pnlMiddleRight.Visible;
  16591. if not pnlMiddleRight.Visible then
  16592. begin
  16593. Width := Width - pnlMiddleRight.Width - Spl.Width;
  16594. Spl.Align := alRight;
  16595. pnlMiddleClient.Align := alClient;
  16596. pnlMiddleRight.Align := alRight;
  16597. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth;
  16598. pnlAll.Constraints.MaxWidth := pnlMiddleClient.Constraints.MaxWidth;
  16599. end
  16600. else
  16601. begin
  16602. // Width := Width + pnlMiddleRight.Width + Spl.Width;
  16603. Top := Screen.Height div 2 - 290;
  16604. Left := Screen.Width div 2 - 440;
  16605. Width := 880;
  16606. Height := 580;
  16607. Spl.Align := alLeft;
  16608. pnlMiddleClient.Align := alLeft;
  16609. pnlMiddleRight.Align := alClient;
  16610. pnlAll.Constraints.MinWidth := pnlMiddleClient.Constraints.MinWidth + pnlMiddleRight.Constraints.MinWidth + Spl.Width;
  16611. pnlAll.Constraints.MaxWidth := 0;
  16612. pnlMiddleClient.Left := 0;
  16613. spl.Left := pnlMiddleClient.Left + pnlMiddleClient.Width + 1;
  16614. end;
  16615. finally
  16616. pnlMiddleClient.Width := OldWidth;
  16617. LockWindowUpdate(0);
  16618. end;
  16619. end;
  16620. //------------------------------------------------------------------------------
  16621. procedure TMainForm.actMsgManagerExecute(Sender: TObject);
  16622. begin
  16623. if MessagesManagerForm <> nil then
  16624. begin
  16625. MessagesManagerForm.BringToFront;
  16626. Exit;
  16627. end;
  16628. MessagesManagerForm := TMessagesManagerForm.Create(Application);
  16629. MessagesManagerForm.Width := Round(Screen.WorkAreaWidth * 0.70);
  16630. MessagesManagerForm.Height := Round(Screen.WorkAreaHeight * 0.70);
  16631. MessagesManagerForm.Show;
  16632. end;
  16633. //------------------------------------------------------------------------------
  16634. procedure TMainForm.RealICQClientAddedBlacklists(Sender: TObject; ALoginName: string);
  16635. var
  16636. ItemIndex: Integer;
  16637. RealICQUser: TRealICQUser;
  16638. RealICQContacterListView: TRealICQContacterListView;
  16639. RealICQContacterListItem: TRealICQContacterListItem;
  16640. begin
  16641. RealICQContacterListView := GetListViewByLoginName(ALoginName);
  16642. if RealICQContacterListView.Items.IndexOf(ALoginName) = -1 then
  16643. begin
  16644. ItemIndex := RealICQClient.Blacklists.IndexOf(ALoginName);
  16645. RealICQUser := RealICQClient.Blacklists.Objects[ItemIndex] as TRealICQUser;
  16646. RealICQContacterListView := GetListViewByLoginName(RealICQUser.LoginName);
  16647. ItemIndex := RealICQContacterListView.Items.IndexOf(RealICQUser.LoginName);
  16648. RealICQContacterListItem := RealICQContacterListView.Items.Objects[ItemIndex] as TRealICQContacterListItem;
  16649. //BindUserDataToItem(RealICQContacterListItem, RealICQUser);
  16650. TUsersService.GetUsersService.UpdateListItem(RealICQContacterListView, RealICQContacterListItem, RealICQUser);
  16651. end;
  16652. end;
  16653. procedure TMainForm.RealICQClientAddFriendRequest(Sender: TObject; ALoginName, ATag: string);
  16654. begin
  16655. AddMessageHistory(smSimple, ALoginName + ' 请求加您为好友', nil);
  16656. ShowAddFriendRequestWindow(Self, ALoginName, ATag);
  16657. end;
  16658. procedure TMainForm.RealICQClientAddFriendResponse(Sender: TObject; ALoginName, ATag: string; AAcceptted: Boolean);
  16659. var
  16660. RealICQUser: TRealICQUser;
  16661. itemIndex: Integer;
  16662. begin
  16663. if AAcceptted then
  16664. begin
  16665. RealICQUser := TUsersService.GetUsersService.GetOrRequestUser(ALoginName);
  16666. AddMessageHistory(smSimple, '您已将 ' + ALoginName + ' 添加至好友列表', nil);
  16667. FNotAddedEmployeeList.AddObject(RealICQUser.LoginName, RealICQUser);
  16668. //显示好友
  16669. // ShowGroupInterface;
  16670. ShowNotifyAlertForm('已将 ' + ALoginName + ' 添加至好友列表');
  16671. end
  16672. else
  16673. begin
  16674. if Length(ATag) = 0 then
  16675. ATag := '无';
  16676. AddMessageHistory(smSimple, ALoginName + ' 拒绝了您添加好友的请求', nil);
  16677. ShowNotifyAlertForm(ALoginName + ' 拒绝添加好友的请求' + #$D#$A + '附言:' + ATag);
  16678. end;
  16679. end;
  16680. //------------------------------------------------------------------------------
  16681. procedure TMainForm.actOpenMainFormExecute(Sender: TObject);
  16682. begin
  16683. if FHidden then
  16684. ZoomEffect(Self, zaMaximize);
  16685. Show;
  16686. ShowWindow(Handle, SW_SHOW);
  16687. ForceForeGroundWindow(Handle);
  16688. FHidden := False;
  16689. if FMainFormHidden then
  16690. begin
  16691. //FDblClickedTrayIcon := True;
  16692. //TimerForShowMainForm.Enabled := False;
  16693. //TimerForShowMainForm.Enabled := True;
  16694. SetForegroundWindow(TrueHiddenMainForm.Handle);
  16695. ShowMainForm;
  16696. end
  16697. else
  16698. HideMainForm;
  16699. end;
  16700. //------------------------------------------------------------------------------
  16701. procedure TMainForm.actOpenRecvFileDirExecute(Sender: TObject);
  16702. begin
  16703. ShellExecute(handle, 'open', PChar('"' + RecvFileDir + '"'), '', '', SW_SHOWNORMAL);
  16704. end;
  16705. //------------------------------------------------------------------------------
  16706. procedure TMainForm.actOptionsExecute(Sender: TObject);
  16707. begin
  16708. if OptionsForm <> nil then
  16709. Exit;
  16710. OptionsForm := TOptionsForm.Create(Self);
  16711. try
  16712. OptionsForm.ShowModal;
  16713. finally
  16714. FreeAndNil(OptionsForm);
  16715. end;
  16716. end;
  16717. //------------------------------------------------------------------------------
  16718. procedure TMainForm.actPersonalSetExecute(Sender: TObject);
  16719. var
  16720. AForm: IUIForm;
  16721. begin
  16722. if OptionsForm <> nil then
  16723. Exit;
  16724. OptionsForm := TOptionsForm.Create(Self);
  16725. try
  16726. OptionsForm.PageIndex := 0;
  16727. OptionsForm.ShowModal;
  16728. finally
  16729. FreeAndNil(OptionsForm);
  16730. end;
  16731. end;
  16732. procedure TMainForm.actQuitExecute(Sender: TObject);
  16733. var
  16734. iWaitTimes: Integer;
  16735. begin
  16736. if RealICQClient.Connected then
  16737. begin
  16738. if GetTalkingFormCount > 0 then
  16739. begin
  16740. if MessageBox(Handle, '确实要退出吗,此操作将会关闭所有的对话窗口!', '提示', MB_ICONINFORMATION or MB_OKCANCEL) = ID_CANCEL then
  16741. Exit;
  16742. if Showing then
  16743. Close;
  16744. CloseAllTalkingForm;
  16745. iWaitTimes := 0;
  16746. while GetTalkingFormCount > 0 do
  16747. begin
  16748. Sleep(100);
  16749. Inc(iWaitTimes);
  16750. if iWaitTimes > 100 then
  16751. Break;
  16752. Application.ProcessMessages;
  16753. end;
  16754. end;
  16755. RealICQClient.Logout;
  16756. TTeamsAdapter.Stop;
  16757. end;
  16758. if Showing then
  16759. Close;
  16760. MainForm.OnClose := nil;
  16761. MainForm.Close;
  16762. TrueHiddenMainForm.Close;
  16763. end;
  16764. //------------------------------------------------------------------------------
  16765. procedure TMainForm.actConnectSetExecute(Sender: TObject);
  16766. begin
  16767. if OptionsForm <> nil then
  16768. Exit;
  16769. OptionsForm := TOptionsForm.Create(Self);
  16770. try
  16771. OptionsForm.LVOptions.Enabled := False;
  16772. OptionsForm.PageIndex := 6;
  16773. OptionsForm.ShowModal;
  16774. //OptionsForm.Show;
  16775. finally
  16776. FreeAndNil(OptionsForm);
  16777. end;
  16778. end;
  16779. //------------------------------------------------------------------------------
  16780. procedure TMainForm.actCreateTeamExecute(Sender: TObject);
  16781. //var
  16782. // iLoop: Integer;
  16783. // Team: TRealICQTeam;
  16784. begin
  16785. // for iLoop := 0 to RealICQClient.Teams.Count - 1 do
  16786. // begin
  16787. // Team := RealICQClient.Teams.Objects[iLoop] as TRealICQTeam;
  16788. // if (not Team.IsTempTeam) and AnsiSameText(Team.TeamCreater, RealICQClient.LoginName) then
  16789. // begin
  16790. // MessageBox(Handle, '抱歉,您已经创建了一个群组了!', '提示', MB_ICONINFORMATION);
  16791. // Exit;
  16792. // end;
  16793. // end;
  16794. //if CreateTeamForm = nil then CreateTeamForm := TCreateTeamForm.Create(Self);
  16795. //CreateTeamForm.Show;
  16796. try
  16797. //非办公助手企业用户无新建群组权限
  16798. if (FProductType <> ptBGZS) AND ((FUserType = utUnknown) OR (FUserType = utCompany)) then
  16799. begin
  16800. ShowMessage('您没有创建群组权限! ');
  16801. Exit;
  16802. end;
  16803. CreateTeamForm := TCreateTeamForm.Create(Self);
  16804. try
  16805. CreateTeamForm.ShowModal;
  16806. finally
  16807. FreeAndNil(CreateTeamForm);
  16808. end;
  16809. except
  16810. end;
  16811. end;
  16812. //------------------------------------------------------------------------------
  16813. procedure TMainForm.actCustomFacesManagerExecute(Sender: TObject);
  16814. begin
  16815. if CustomFacesManagerForm = nil then
  16816. CustomFacesManagerForm := TCustomFacesManagerForm.Create(Application);
  16817. CustomFacesManagerForm.Show;
  16818. end;
  16819. //------------------------------------------------------------------------------
  16820. procedure TMainForm.actAVSetExecute(Sender: TObject);
  16821. begin
  16822. WinExec(PChar('"' + ExtractFilePath(Application.ExeName) + AVSetExeFile + '" "' + ExtractFilePath(Application.ExeName) + 'Languages\' + MainForm.Language + '.ini' + '"'), SW_SHOWNORMAL);
  16823. end;
  16824. //------------------------------------------------------------------------------
  16825. procedure TMainForm.actChangePassExecute(Sender: TObject);
  16826. begin
  16827. if ChangePassForm <> nil then
  16828. Exit;
  16829. ChangePassForm := TChangePassForm.Create(Self);
  16830. try
  16831. ChangePassForm.ShowModal;
  16832. finally
  16833. FreeAndNil(ChangePassForm);
  16834. end;
  16835. end;
  16836. //------------------------------------------------------------------------------
  16837. procedure TMainForm.actCloseExecute(Sender: TObject);
  16838. begin
  16839. Close;
  16840. end;
  16841. //--------------------------------------------------------------
  16842. procedure ClearFileMissions;
  16843. var
  16844. iLoop, jLoop: Integer;
  16845. UploadMission: TUploadMission;
  16846. DownloadMission: TDownloadMission;
  16847. Missions: TStringList;
  16848. begin
  16849. for iLoop := FUploadMissions.Count - 1 downto 0 do
  16850. begin
  16851. UploadMission := FUploadMissions.Objects[iLoop] as TUploadMission;
  16852. try
  16853. FreeAndNil(UploadMission);
  16854. except
  16855. end;
  16856. end;
  16857. FUploadMissions.Clear;
  16858. for iLoop := FSavedUploadMissions.Count - 1 downto 0 do
  16859. begin
  16860. Missions := TStringList(FSavedUploadMissions[iLoop]);
  16861. for jLoop := Missions.Count - 1 downto 0 do
  16862. begin
  16863. UploadMission := Missions.Objects[jLoop] as TUploadMission;
  16864. try
  16865. FreeAndNil(UploadMission);
  16866. except
  16867. end;
  16868. end;
  16869. Missions.Clear;
  16870. FreeAndNil(Missions);
  16871. end;
  16872. FSavedUploadMissions.Clear;
  16873. for iLoop := FSavedDownloadMissions.Count - 1 downto 0 do
  16874. begin
  16875. Missions := TStringList(FSavedDownloadMissions[iLoop]);
  16876. for jLoop := Missions.Count - 1 downto 0 do
  16877. begin
  16878. DownloadMission := Missions.Objects[jLoop] as TDownloadMission;
  16879. try
  16880. FreeAndNil(DownloadMission);
  16881. except
  16882. end;
  16883. end;
  16884. Missions.Clear;
  16885. FreeAndNil(Missions);
  16886. end;
  16887. FSavedDownloadMissions.Clear;
  16888. for iLoop := FDownloadMissions.Count - 1 downto 0 do
  16889. begin
  16890. DownloadMission := FDownloadMissions.Objects[iLoop] as TDownloadMission;
  16891. try
  16892. FreeAndNil(DownloadMission);
  16893. except
  16894. end;
  16895. end;
  16896. FDownloadMissions.Clear;
  16897. end;
  16898. //---退出主程序-----------------------------------------------------
  16899. procedure TMainForm.QuitWindows;
  16900. var
  16901. iWaitTimes: Integer;
  16902. begin
  16903. RealICQClient.OnLoginFailed := nil;
  16904. if RealICQClient.Connected then
  16905. begin
  16906. if GetTalkingFormCount > 0 then
  16907. begin
  16908. if Showing then
  16909. Close;
  16910. CloseAllTalkingForm;
  16911. iWaitTimes := 0;
  16912. while GetTalkingFormCount > 0 do
  16913. begin
  16914. Sleep(100);
  16915. Inc(iWaitTimes);
  16916. if iWaitTimes > 100 then
  16917. Break;
  16918. Application.ProcessMessages;
  16919. end;
  16920. end;
  16921. RealICQClient.Logout;
  16922. end;
  16923. if Showing then
  16924. Close;
  16925. MainForm.OnClose := nil;
  16926. MainForm.Close;
  16927. TrueHiddenMainForm.Close;
  16928. end;
  16929. //-----获的天气信息--------------------------------------------------------
  16930. procedure TMainForm.GetWeather(City, Weatheren, Weather: string);
  16931. var
  16932. Data: CopyDataStruct;
  16933. Args: PChar;
  16934. weatherImgPath: string;
  16935. WeatherList: TStringList;
  16936. WeatherPanelWidth: Integer;
  16937. begin
  16938. lblWeatherCity.Caption := City;
  16939. lblWeatheren.Caption := Weatheren;
  16940. lblWeather.Caption := Weather;
  16941. weatherImgPath := ExtractFilePath(paramstr(0)) + 'Images\Weather\' + GetWeatherImgName(lblWeather.Caption);
  16942. if fileexists(weatherImgPath) then
  16943. imgWeather.Picture.LoadFromFile(weatherImgPath);
  16944. WeatherPanelWidth := lblWeatherCity.Left + lblWeatherCity.Width + 5 + imgWeather.Width + 5 + lblWeather.Width + 5 + lblWeatheren.Width;
  16945. if pnlWebSearch.Width - spbAddFriend.Left >= WeatherPanelWidth then
  16946. lblWeatherCity.Left := spbAddFriend.Left
  16947. else
  16948. lblWeatherCity.Left := btMainMenu.Left + btMainMenu.Width + 5;
  16949. imgWeather.Left := lblWeatherCity.Left + lblWeatherCity.Width + 5;
  16950. lblWeather.Left := imgWeather.Left + imgWeather.Width + 5;
  16951. lblWeatheren.Left := lblWeather.Left + lblWeather.Width + 5;
  16952. end;
  16953. procedure TMainForm.SetGetMoreUserEvent;
  16954. begin
  16955. RealICQClient.OnGettedMoreBranchList := RealICQClientGettedMoreBranchList;
  16956. RealICQClient.OnGettedMoreUserList := RealICQClientGettedMoreUserList;
  16957. if (MessageBoxForm <> nil) then
  16958. begin
  16959. FreeAndNil(MessageBoxForm);
  16960. MessageBoxForm := nil;
  16961. end;
  16962. end;
  16963. //------------------------------------------------------------------------------
  16964. procedure TMainForm.OpenWebTab(TabSheet: TTabSheet; WebPanel: TWebPanel; AcountIndex: Integer);
  16965. var
  16966. Panel, PanelForIE: TPanel;
  16967. WebBrowser: TWebBrowser;
  16968. begin
  16969. TabAcountIndex := AcountIndex;
  16970. Panel := TPanel.Create(TabSheet);
  16971. Panel.Parent := TabSheet;
  16972. Panel.DoubleBuffered := True;
  16973. Panel.Font.Color := spbDisplayName.Font.Color;
  16974. Panel.Caption := '页面加载中...';
  16975. Panel.Color := clWhite;
  16976. Panel.Align := alClient;
  16977. Panel.BevelInner := bvNone;
  16978. Panel.BevelOuter := bvNone;
  16979. Panel.Visible := True;
  16980. Application.ProcessMessages;
  16981. PanelForIE := TPanel.Create(Panel);
  16982. PanelForIE.Parent := Panel;
  16983. PanelForIE.Tag := TabSheet.Tag;
  16984. PanelForIE.DoubleBuffered := True;
  16985. PanelForIE.Color := clWhite;
  16986. PanelForIE.Align := alClient;
  16987. PanelForIE.BevelInner := bvNone;
  16988. PanelForIE.BevelOuter := bvNone;
  16989. PanelForIE.Visible := True;
  16990. Application.ProcessMessages;
  16991. WebBrowser := TWebBrowser.Create(PanelForIE);
  16992. WebBrowser.DoubleBuffered := True;
  16993. WebBrowser.ParentWindow := PanelForIE.Handle;
  16994. WebBrowser.Align := alClient;
  16995. WebBrowser.Visible := True;
  16996. WebBrowser.Tag := TabSheet.Tag;
  16997. WebBrowser.RegisterAsBrowser := True;
  16998. WebBrowser.RegisterAsDropTarget := True;
  16999. //WebBrowser.OnBeforeNavigate2 := WebBrowserRightBeforeNavigate2;
  17000. if WebPanel.FNavigateType = ntFill then
  17001. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentCompleteForPost
  17002. else
  17003. WebBrowser.OnDocumentComplete := WebBrowserRightDocumentComplete;
  17004. PanelForIE.InsertControl(WebBrowser);
  17005. Application.ProcessMessages;
  17006. if DisplayWebs then
  17007. begin
  17008. if WebPanel.FNavigateType = ntFill then
  17009. WebBrowser.Navigate(WebPanel.FURL)
  17010. else
  17011. WebBrowser.Navigate('about:blank');
  17012. end;
  17013. end;
  17014. //-------------------------------------------------------
  17015. procedure TMainForm.LoadMainTabImage;
  17016. begin
  17017. MyContactersIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '1.bmp');
  17018. SysMsgIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '2.bmp');
  17019. MyFriendIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '3.bmp');
  17020. MyTeamIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '4.bmp');
  17021. LatestsIcon.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName) + MainTabImageDir + '5.bmp');
  17022. end;
  17023. //------------------------------------------------------------------------------
  17024. //下载升级配置文件
  17025. //------------------------------------------------------------------------------
  17026. procedure TMainForm.DownLoadUpdateConfig;
  17027. var
  17028. TempDir: string;
  17029. begin
  17030. TempDir := GetMyDocument + '\Update';
  17031. if not DirectoryExists(TempDir) then
  17032. ForceDirectories(TempDir);
  17033. if FileExists(GetMyDocument + '\Update\Update.dat') then
  17034. begin
  17035. SetFileAttributes(pchar(GetMyDocument + '\Update\Update.dat'), file_attribute_normal);
  17036. DeleteFile(GetMyDocument + '\Update\Update.dat');
  17037. end;
  17038. //FDownFile.ThreadDownFile('http://' + MainForm.RealICQClient.RemoteAddress + '/Update/Update.dat', TempDir + '\Update.dat');
  17039. end;
  17040. //------------------------------------------------------------------------------
  17041. //文件下载完成事件处理函数
  17042. //-----------------------------------------------------------------------------=
  17043. procedure TMainForm.DownFaceFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  17044. begin
  17045. ShowGettedFace(Dest_file);
  17046. end;
  17047. procedure TMainForm.DownFileComplete(Source_file, Dest_file: string; blStatus: boolean; ErrMessage: string);
  17048. var
  17049. OldVersion, Version: string;
  17050. F: Textfile;
  17051. City, Weatheren, Weather: string;
  17052. function GetVersionFromIniFile(FileName: string): string;
  17053. var
  17054. IniFile: TIniFile;
  17055. begin
  17056. IniFile := TIniFile.Create(ExtractFilePath(paramstr(0)) + 'Update.dat');
  17057. try
  17058. OldVersion := IniFile.ReadString('Version', 'Version', '1.0.0.0');
  17059. finally
  17060. IniFile.Free;
  17061. end;
  17062. end;
  17063. begin
  17064. if FileExists(Dest_file) then
  17065. begin
  17066. if UpperCase(ExtractFileExt(Dest_file)) = '.DAT' then
  17067. begin
  17068. OldVersion := '1.0.0.0';
  17069. if FileExists(ExtractFilePath(paramstr(0)) + 'Update.dat') then
  17070. OldVersion := GetVersionFromIniFile(ExtractFilePath(paramstr(0)) + 'Update.dat');
  17071. if FileExists(GetMyDocument + '\Update\Update.dat') then
  17072. Version := GetVersionFromIniFile(GetMyDocument + '\Update\Update.dat');
  17073. if trim(OldVersion) <> trim(Version) then
  17074. WinExec('Update.exe', SW_SHOW);
  17075. end
  17076. else
  17077. begin
  17078. AssignFile(F, Dest_file);
  17079. try
  17080. Reset(F);
  17081. Readln(F, City);
  17082. Readln(F, Weatheren);
  17083. Readln(F, Weather);
  17084. GetWeather(City, Weatheren, Weather);
  17085. finally
  17086. Closefile(F); {关闭文件 F}
  17087. end;
  17088. end;
  17089. end;
  17090. end;
  17091. //------------------------------------------------------------------------------
  17092. //
  17093. //------------------------------------------------------------------------------
  17094. procedure TMainForm.RealICQClientGettedSysMsgInterfaces(Sender: TObject);
  17095. begin
  17096. //
  17097. end;
  17098. //------------------------------------------------------------------------------
  17099. function TMainForm.GetBranchName(LoginName: string): string;
  17100. var
  17101. ItemIndex: Integer;
  17102. Branch: TRealICQBranch;
  17103. Employee: TRealICQEmployee;
  17104. Node: TTreeNode;
  17105. RealICQContacterTreeView: TRealICQContacterTreeView;
  17106. begin
  17107. Result := '';
  17108. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  17109. begin
  17110. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMoreUsers);
  17111. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  17112. end
  17113. else
  17114. begin
  17115. ItemIndex := MainForm.ContacterTreeViews.IndexOf(LVMyContacters);
  17116. RealICQContacterTreeView := MainForm.ContacterTreeViews.Objects[ItemIndex] as TRealICQContacterTreeView;
  17117. end;
  17118. Employee := RealICQContacterTreeView.GetEmployee(LoginName);
  17119. if (Employee = nil) then
  17120. Exit;
  17121. Node := Employee.Node.Parent;
  17122. Result := Node.Text;
  17123. while Node.Parent <> nil do
  17124. begin
  17125. Node := Node.Parent;
  17126. if Node = nil then
  17127. Break;
  17128. if Node.Parent <> nil then
  17129. Result := Node.Text + '/' + Result;
  17130. end;
  17131. end;
  17132. //------------------------------------------------------------------------------
  17133. function TMainForm.GetCompany: string;
  17134. var
  17135. iIndex: Integer;
  17136. ServerInfo: TServerInfo;
  17137. begin
  17138. Result := '';
  17139. if (FServerInfoList.IndexOf(MainForm.CurrentServerID) < 0) or (FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID) < 0) then
  17140. Exit;
  17141. if MainForm.GetActiveTabSheetName = LVMoreUsers then
  17142. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.CurrentServerID)] as (TServerInfo)
  17143. else
  17144. ServerInfo := FServerInfoList.Objects[FServerInfoList.IndexOf(MainForm.RealICQClient.ServerID)] as (TServerInfo);
  17145. if Assigned(ServerInfo) then
  17146. Result := ServerInfo.ServerName;
  17147. end;
  17148. //------------------------------------------------------------------------------
  17149. //用post方式提交XML文件到服务器
  17150. //------------------------------------------------------------------------------
  17151. {
  17152. procedure TMainForm.PostUpdateLog;
  17153. function ReadUpdateLog: string;
  17154. var
  17155. XMLFile: string;
  17156. ConfigNode: IXMLNode;
  17157. XMLDocument: TXMLDocument;
  17158. begin
  17159. Result := '';
  17160. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  17161. XMLDocument := TXMLDocument.Create(Self);
  17162. try
  17163. try
  17164. if FileExists(XMLFile) then
  17165. begin
  17166. XMLDocument.Active := True;
  17167. XMLDocument.LoadFromFile(XMLFile);
  17168. ConfigNode := XMLDocument.DocumentElement;
  17169. if ConfigNode.ChildNodes.FindNode('product').Attributes['status'] then
  17170. begin
  17171. Result := XMLDocument.XML.Text;
  17172. end;
  17173. end;
  17174. except
  17175. on E: EXception do
  17176. end;
  17177. finally
  17178. XMLDocument.Free;
  17179. end;
  17180. end;
  17181. var
  17182. XMLStr, Url: string;
  17183. begin
  17184. Url := GetUpdateLogPostUrl(ExtractFilePath(paramstr(0)) + 'Online.ini');
  17185. if Url = '' then
  17186. Url := DefaultUpdateLogPostUrl;
  17187. Url := Url + '?LoginName=' + RealICQClient.LoginName + '&DisplayName=' + HttpEncode(AnsiToUtf8(RealICQClient.Me.DisplayName)) + '&ServerName=' + HttpEncode(AnsiToUtf8(edServerList.Text));
  17188. XMLStr := ReadUpdateLog;
  17189. if XMLStr <> '' then
  17190. begin
  17191. TThreadPost.Create(Url, XMLStr);
  17192. end;
  17193. end;
  17194. }
  17195. //------------------------------------------------------------------------------
  17196. procedure TMainForm.UpdatePostLogState(Status: Boolean);
  17197. var
  17198. XMLFile: string;
  17199. ConfigNode: IXMLNode;
  17200. XMLDocument: TXMLDocument;
  17201. begin
  17202. XMLFile := ExtractFilePath(paramstr(0)) + ConfigXMLFilePath + UpdateLogXMLFile;
  17203. XMLDocument := TXMLDocument.Create(Self);
  17204. try
  17205. try
  17206. if FileExists(XMLFile) then
  17207. begin
  17208. XMLDocument.Active := True;
  17209. XMLDocument.LoadFromFile(XMLFile);
  17210. ConfigNode := XMLDocument.DocumentElement;
  17211. ConfigNode.ChildNodes.FindNode('product').Attributes['status'] := Status;
  17212. XMLDocument.SaveToFile(XMLFile);
  17213. end;
  17214. except
  17215. end;
  17216. finally
  17217. XMLDocument.Free;
  17218. end;
  17219. end;
  17220. constructor TThreadPost.Create(URL, Content: string);
  17221. begin
  17222. inherited Create(True);
  17223. FURL := URL;
  17224. FContent := Content;
  17225. FreeOnTerminate := True;
  17226. Resume;
  17227. end;
  17228. procedure TThreadPost.Execute;
  17229. var
  17230. IdHttp: TIdHTTP;
  17231. Sends: TStrings;
  17232. begin
  17233. IdHttp := TIdHTTP.Create(nil);
  17234. Sends := TStringList.Create;
  17235. try
  17236. IdHttp.Request.ContentType := 'application/x-www-form-urlencoded';
  17237. Sends.Add('XmlStr=' + StrToBase64(FContent));
  17238. IdHttp.Post(FUrl, Sends);
  17239. MainForm.UpdatePostLogState(False);
  17240. finally
  17241. FreeAndNil(IdHttp);
  17242. Sends.Free;
  17243. end;
  17244. end;
  17245. //---------------检测指定的进程是否运行-----------------------------------------
  17246. constructor TCheckRunProcessThread.Create(AProgramName, AProcessPath: string);
  17247. begin
  17248. inherited Create(True);
  17249. ProgramName := AProgramName;
  17250. ProcessPath := AProcessPath;
  17251. FreeOnTerminate := True;
  17252. Resume;
  17253. end;
  17254. //------------得到进程的执行路径------------------------------------------------
  17255. function TCheckRunProcessThread.GetProcessPath(ProcessID: DWORD): string;
  17256. var
  17257. Hand: THandle;
  17258. ModName: array[0..Max_Path - 1] of Char;
  17259. hMod: HModule;
  17260. n: DWORD;
  17261. begin
  17262. Result := '';
  17263. Hand := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, ProcessID);
  17264. if Hand > 0 then
  17265. try
  17266. ENumProcessModules(Hand, @hMod, Sizeof(hMod), n);
  17267. if GetModuleFileNameEx(Hand, hMod, ModName, Sizeof(ModName)) > 0 then
  17268. Result := ModName; //得到路径和文见名
  17269. except
  17270. end;
  17271. end;
  17272. //根据可执行文件名称查找进程列表,以判断程序是否正在运行。
  17273. function TCheckRunProcessThread.FindProcess(AFileName: string): boolean;
  17274. var
  17275. hSnapshot: THandle; //用于获得进程列表
  17276. lppe: TProcessEntry32; //用于查找进程
  17277. Found: Boolean; //用于判断进程遍历是否完成
  17278. ProcessPath: string;
  17279. begin
  17280. Result := False;
  17281. hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); //获得系统进程列表
  17282. lppe.dwSize := SizeOf(TProcessEntry32); //在调用Process32First API之前,需要初始化lppe记录的大小
  17283. Found := Process32First(hSnapshot, lppe); //将进程列表的第一个进程信息读入ppe记录中
  17284. while Found do
  17285. begin
  17286. ProcessPath := GetProcessPath(lppe.th32ProcessID);
  17287. if UpperCase(ProcessPath) = UpperCase(AFileName) then
  17288. begin
  17289. Result := True;
  17290. end;
  17291. Found := Process32Next(hSnapshot, lppe); //将进程列表的下一个进程信息读入lppe记录中
  17292. end;
  17293. end;
  17294. //------------------------------------------------------------------------------
  17295. procedure TCheckRunProcessThread.Execute;
  17296. begin
  17297. while FindProcess(ProcessPath) do
  17298. begin
  17299. Sleep(1000);
  17300. end;
  17301. //MainForm.PostUpdateLog;
  17302. end;
  17303. procedure TMainForm.btOAClick(Sender: TObject);
  17304. begin
  17305. MessageBox(Handle, '协同办公系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17306. end;
  17307. procedure TMainForm.btSwapClick(Sender: TObject);
  17308. begin
  17309. MessageBox(Handle, '公文交换系统暂未接入! ', '提示', MB_ICONINFORMATION);
  17310. end;
  17311. initialization
  17312. HookID := 0;
  17313. FUploadMissions := TStringList.Create;
  17314. FSavedUploadMissions := TList.Create;
  17315. FDownloadMissions := TStringList.Create;
  17316. FSavedDownloadMissions := TList.Create;
  17317. CoInitialize(nil);
  17318. OleInitialize(nil);
  17319. finalization
  17320. try
  17321. ClearFileMissions;
  17322. FreeAndNil(FSavedDownloadMissions);
  17323. FreeAndNil(FSavedUploadMissions);
  17324. FreeAndNil(FUploadMissions);
  17325. FreeAndNil(FDownloadMissions);
  17326. OleUninitialize;
  17327. CoUninitialize;
  17328. except
  17329. end;
  17330. end.