/* $VER: AmiIPWatcher 2.1 (1999-09-17) */ options results libs="rexxtricks.library rxsocket.library rexxkuang11.library rmh.library locale.library" DO UNTIL libs='';PARSE VAR libs lib libs IF EXISTS('libs:'lib)|EXISTS('Libs/'lib)|EXISTS(lib) THEN DO IF ~show('L',lib) THEN call addlib(lib,0,-30,0);END;ELSE DO Say 'Library Error. Unable to open 'lib address AmiIPWatcher;quit END;END if show(l,'locale.library') then catalog=opencatalog('AmiIPWatcher.catalog','english',0) call tags SELECT WHEN arg(1)="REFRESH" then call gethostip WHEN arg(1)="IPCOPY" then call copyip WHEN arg(1)="HOSTCOPY" then call copyhost WHEN arg(1)="CHECKVERSION" then call download('info') WHEN arg(1)="DOWNLOAD" then call download('AIPW') WHEN arg(1)="GOTOURL" then openurl('http://snorslex.amiga.tm') WHEN arg(1)="VIEWLOG" then call vlog WHEN arg(1)="SAVELOG" then call slog WHEN arg(1)="CLOSELOG" then call clog WHEN arg(1)="CLEARLOG" then call cllog WHEN arg(1)="CLEARLOGY" then call cllogy WHEN arg(1)="CHECKVERSIONGUI" then call checkversiongui WHEN arg(1)="ABOUT" then call about WHEN arg(1)="STICQ1" then call sticq(1) WHEN arg(1)="STICQ2" then call sticq(2) WHEN arg(1)="STA1" then call sta(1) WHEN arg(1)="STA2" then call sta(2) WHEN arg(1)="STPREFS" then call stprefs WHEN arg(1)="STPREFSS" then call stprefss OTHERWISE call init end exit init: address AmiIPWatcher window ID AIPW TITLE '"AmiIPWatcher v2.1"' COMMAND '"quit"' PORT AmiIPWatcher ATTRS MUIA_Window_ScreenTitle '"AmiIPWatcher 2.1 ©1998-1999 Lorens Johansson Freely Distributable Emailware"' menu LABEL "AmiIPWatcher" item COMMAND '"AmiIPWatcher.rexx CHECKVERSIONGUI"' ATTRS MUIA_Menuitem_Shortcut 'V' LABEL locale(8,"Check version") item COMMAND '"AmiIPWatcher.rexx GOTOURL"' ATTRS MUIA_Menuitem_Shortcut 'P' LABEL locale(9,"Visit Homepage") item COMMAND '"AmiIPWatcher.rexx VIEWLOG"' ATTRS MUIA_Menuitem_Shortcut 'L' LABEL locale(10,"View Logfile") item ATTRS MUIA_Menuitem_Title '-1' item COMMAND '"AmiIPWatcher.rexx STA1"' LABEL locale(49,"Send IP to AmIRC") item COMMAND '"AmiIPWatcher.rexx STA2"' LABEL locale(50,"Send HostName to AmIRC") item COMMAND '"AmiIPWatcher.rexx STICQ1"' LABEL locale(51,"Send IP to STRICQ") item COMMAND '"AmiIPWatcher.rexx STICQ2"' LABEL locale(52,"Send HostName to STRICQ") item COMMAND '"AmiIPWatcher.rexx IPCOPY"' ATTRS MUIA_Menuitem_Shortcut 'I' LABEL locale(2,"Copy IP to clipboard") item COMMAND '"AmiIPWatcher.rexx HOSTCOPY"' ATTRS MUIA_Menuitem_Shortcut 'H' LABEL locale(6,"Copy HostName to clipboard") item COMMAND '"AmiIPWatcher.rexx REFRESH"' ATTRS MUIA_Menuitem_Shortcut 'R' LABEL locale(3,"Refresh") item ATTRS MUIA_Menuitem_Title '-1' item COMMAND '"AmiIPWatcher.rexx ABOUT"' ATTRS MUIA_Menuitem_Shortcut 'A' LABEL locale(11,"About") item COMMAND '"method 'MUIM_Application_AboutMUI' 0"' PORT AmiIPWatcher ATTRS MUIA_Menuitem_Shortcut 'M' LABEL locale(12,"About MUI") item ATTRS MUIA_Menuitem_Title '-1' item COMMAND '"quit"' PORT AmiIPWatcher ATTRS MUIA_Menuitem_Shortcut 'Q' LABEL locale(13,"Quit") endmenu menu LABEL locale(48,"Settings") item COMMAND '"AmiIPWatcher.rexx STPREFS"' ATTRS MUIA_Menuitem_Shortcut 'C' LABEL locale(53,"Send To Programs Prefs") item COMMAND '"method 'MUIM_Application_OpenConfigWindow'"' PORT AmiIPWatcher LABEL locale(14,"MUI Prefs...") endmenu text help '"AmiIPWatcher v2.1 by\nLorens Johansson (http://snorslex.amiga.tm)\nand sOCIETY^rSE (http://resistance.ourfamily.com)\nIf you use this program, you are required to\nEmail the author (SnorsleX@Home.se). Otherwise,\nhow is he supposed to know to keep supporting\nAmiIPWatcher ?!?\n\033rLorens Johansson & sOCIETY^rSE"', label "\033c\033bAmiIPWatcher v2.1\033n\n\033cLorens Johansson & sOCIETY^rSE\n\033cFreely Distributable Emailware" group node "HowTo_Main" group label locale(1,"IP") menu LABEL locale(1,"IP") item COMMAND '"AmiIPWatcher.rexx IPCOPY"' LABEL locale(2,"Copy IP to clipboard") item COMMAND '"AmiIPWatcher.rexx STA1"' LABEL locale(49,"Send IP to AmIRC") item COMMAND '"AmiIPWatcher.rexx STICQ1"' LABEL locale(51,"Send IP to STRICQ") item COMMAND '"AmiIPWatcher.rexx REFRESH"' LABEL locale(3,"Refresh") endmenu string ID IP ATTRS MUIA_CycleChain 1 MUIA_String_Format MUIV_String_Format_Center help '"'locale(4,"Shows your IP!")'"' endgroup group label locale(5,"HostName") menu LABEL locale(5,"HostName") item COMMAND '"AmiIPWatcher.rexx HOSTCOPY"' LABEL locale(6,"Copy HostName to clipboard") item COMMAND '"AmiIPWatcher.rexx STA2"' LABEL locale(50,"Send HostName to AmIRC") item COMMAND '"AmiIPWatcher.rexx STICQ2"' LABEL locale(52,"Send HostName to STRICQ") item COMMAND '"AmiIPWatcher.rexx REFRESH"' LABEL locale(3,"Refresh") endmenu string ID HOS ATTRS MUIA_CycleChain 1 MUIA_String_Format MUIV_String_Format_Center help '"'locale(7,"Shows your HostName!")'"' endgroup endgroup endwindow call gethostip return vlog: if exists("AmiIPWatcher.config") then do call open(prefs,"AmiIPWatcher.config","r") loglocal=readln(prefs) call close(prefs) end address AmiIPWatcher window ID LOG Title '"IP/HostName Log"' COMMAND '"AmiIPWatcher.rexx CLOSELOG"' group node "HowTo_Log" text label locale(22,"\033cView the AmiIPWatcher.log") list ID LOGVI NODUP TITLE '"\0333'locale(23,"Date")',\0333'locale(24,"Time")',\0333'locale(25,"IP")',\0333'locale(24,"HostName")'"' ATTRS MUIA_List_Format """MIW=15 BAR,MIW=10 BAR,MIW=20 BAR,MIW=30""" help '"'locale(27,"This list shows you the logfile.")'"' group ATTRS MUIA_Group_Columns 6 button ID LOGCL COMMAND '"AmiIPWatcher.rexx CLEARLOG"' ATTRS MUIA_CycleChain 1 MUIA_Weight 10 help '"'locale(28,"Deletes all entries in the log file.")'"' label locale(29,"Clear Log") button ID LOGDE COMMAND '"list ID LOGVI REMOVE POS -1"' PORT AmiIPWatcher ATTRS MUIA_CycleChain 1 MUIA_Weight 10 help '"'locale(30,"Deletes the marked entry in the list.\nIt does not delete the entry from\nthe logfile, you must save the log.")'"' label locale(47,"Delete Entry") button ID LOGSA COMMAND '"AmiIPWatcher.rexx SAVELOG"' ATTRS MUIA_CycleChain 1 MUIA_Weight 10 help '"'locale(31,"Saves the log to AmiIPWatcher.log.")'"' label locale(32,"Save Log") space HORIZ label locale(33,"Log LocalHost:") check ID LOGLO ATTRS MUIA_Selected loglocal help '"'locale(34,"Check this if you want to\nsave localhost in the log file.")'"' endgroup endgroup endwindow if OPEN("loadlog","AmiIPWatcher.log","r") then do do UNTIL EOF("loadlog") LINE=READLN("loadlog") if length(LINE)>10 then do date=SUBWORD(LINE,1,3) time=SUBWORD(LINE,4,1) ip=SUBWORD(LINE,6,1) hostname=SUBWORD(LINE,8,1) STR=date","time","ip","hostname list ID LOGVI INSERT STRING STR end end call CLOSE("loadlog") end return slog: call OPEN("log","AmiIPWatcher.log","W") address AmiIPWatcher list ID LOGVI MUIA_List_Entries entries=result do UNTIL entries=0 entries=entries-1 list ID LOGVI POS entries RES=result parse var RES DATE","TIME","IP","HOST LINE=DATE" "TIME" IP: "IP" HostName: "HOST call WRITELN("log",LINE) end call CLOSE("log") return clog: address AmiIPWatcher check ID LOGLO save=result call OPEN("prefs","AmiIPWatcher.config","W") call WRITELN("prefs",save) call CLOSE("prefs") window ID LOG close return cllog: address AmiIPWatcher window ID CLYN ATTRS MUIA_Window_DragBar 0 MUIA_Window_DepthGadget 0 MUIA_Window_SizeGadget 0 text label locale(35,"\033cAre you sure that you\nwant to clear the log file?") group MUIA_Group_Columns 3 button ID CLYES COMMAND '"AmiIPWatcher.rexx CLEARLOGY"' ATTRS MUIA_CycleChain 1 label locale(36,"Yes") space HORIZ button ID CLNO COMMAND '"window ID CLYN close"' PORT AmiIPWatcher ATTRS MUIA_CycleChain 1 label locale(37,"No") endgroup endwindow return cllogy: call OPEN("logfile","AmiIPWatcher.log","w") call WRITELN("logfile","") call CLOSE("logfile") address AmiIPWatcher list ID LOGVI ATTRS MUIA_List_Entries number=result do number list ID LOGVI REMOVE POS 0 end window ID CLYN close return checkversiongui: address AmiIPWatcher window ID CHVER Title '"Check Version"' COMMAND '"window ID CHVER close"' PORT AmiIPWatcher group node "HowTo_Version" text label locale(38,"\033cCheck for a new Version of AmiIPWatcher.") group HORIZ group ATTRS MUIA_Group_Columns 2 label locale(39,"This version:") string ID OLDV help '"'locale(40,"Shows what version you are using.")'"' content VERSION label locale(41,"Available version:") string ID NEWV help '"'locale(42,"Shows what version that\nis available on my homepage.")'"' endgroup group button ID CHCHE COMMAND '"AmiIPWatcher.rexx CHECKVERSION"' ATTRS MUIA_CycleChain 1 help '"'locale(43,"Connects via http to a file and\nchecks whats the newest version is.")'"' label locale(44,"Check Version") button ID CHDOW COMMAND '"AmiIPWatcher.rexx DOWNLOAD"' ATTRS MUIA_CycleChain 1 MUIA_Disabled 1 help '"'locale(45,"Connects via http and downloads\nthe AmiIPWatcher archive.")'"' label locale(46,"Download AmiIPWatcher") endgroup endgroup endgroup endwindow string ID THISV content VERSION return about: address AmiIPWatcher window ID ABOUT Title '"About AmiIPWatcher 2.1"' COMMAND '"window ID ABOUT close"' PORT AmiIPWatcher text label "\033c\033bAmiIPWatcher v2.1\033n\n\033cFreely Distributable Emailware" button ID ABO COMMAND '"text ID STATUS LABEL ResistanceLogo"' PORT AmiIPWatcher ICON "Data/AmiIPWatcherLogo" label "\033cLast Update: 1999-09-17" text label "\033cThe idea is from a friends IPWatcher for PC.\nThanks LowSpirit (http://lowdimension.net)\n\n\033cPlease visit our homepages:\nhttp://snorslex.amiga.tm\nhttp://resistance.ourfamily.com\n\nPlease E-Mail us if you like/hate the program!\nSnorsleX@Home.se\nSociety@AmigaScne.org\n\n\033b©Copyright 1998-1999 Lorens Johansson & sOCIETY^rSE\n\n\033c"||locale(15,"Using built-in English translation.\nWhy not write one in your language?") group HORIZ button ID ABGOU COMMAND '"AmiIPWatcher.rexx GOTOURL"' ATTRS MUIA_CycleChain 1 label locale(16,"Visit Homepage") space HORIZ button ID CAB COMMAND '"window ID ABOUT close"' PORT AmiIPWatcher ATTRS MUIA_CycleChain 1 label locale(17,"Ok") endgroup endwindow return copyip: address AmiIPWatcher string ID IP IP=result IF ~WRITECLIPBOARD(0,IP) THEN say locale(18,"Could not copy ")||IP||locale(19," to the clipboard!") return copyhost: address AmiIPWatcher string ID HOS HOST=result IF ~WRITECLIPBOARD(0,HOST) THEN say locale(18,"Could not copy ")||HOST||locale(19," to the clipboard!") return download: if ~IsLibOn("SOCKET") then do call nosock return end if arg(1)="info" then do IF ~FWRITEURL('T:information.txt','HTTP://members.xoom.com/snorslex/information.txt') THEN exit call OPEN("info",'T:information.txt',"r") RAD=READLN("info") call CLOSE("info") RAD=DELSTR(RAD,1,14) address AmiIPWatcher string ID NEWV content RAD if VERSION~=RAD then button ID CHDOW ATTRS MUIA_Disabled 0 end if arg(1) = "AIPW" then do address AmiIPWatcher IF ~FWRITEURL('RAM:AmiIPWatcher.LHA','HTTP://members.xoom.com/snorslex/files/amiipwatcher.lha') THEN exit end return gethostip: if ~IsLibOn("SOCKET") then do call nosock return end if OPEN("prefs","AmiIPWatcher.config","r") then do loglocal=READLN("prefs") call CLOSE("prefs") end got_ip=GetHostID() Address AmiIPWatcher string ID IP old_ip=result string ID IP content got_ip host=GetHostName(got_host) string ID HOS old_host=result string ID HOS content got_host YES=0 if old_ip~=got_ip then YES=1 if old_host~=got_host then YES=1 if loglocal=0 then if got_host="localhost" then YES=0 if YES=1 then do if ~exists("AmiIPWatcher.log") then call OPEN("iplog","AmiIPWatcher.log","w") if exists("AmiIPWatcher.log") then call OPEN("iplog","AmiIPWatcher.log","a") LINE=date()" "time()" IP: "got_ip" HostName: "got_host call WRITELN("iplog",LINE) call CLOSE("iplog") end return locale: parse arg msgno,msgstring if catalog~=0 then msgstring=getcatalogstr(catalog,msgno,msgstring) do i=3 to arg() parse var msgstring before '%s' after msgstring=before||arg(i)||after end return(msgstring) nosock: address AmiIPWatcher window ID NOSOC ATTRS MUIA_Window_DragBar 0 MUIA_Window_DepthGadget 0 MUIA_Window_SizeGadget 0 text label locale(20,"\033cCouldn't find bsdsocket.library!\nMake sure you have started a\nTCP/IP stack, like Miami.") button ID NOSCL COMMAND '"window ID NOSOC close"' PORT AmiIPWatcher ATTRS MUIA_CycleChain 1 label locale(21,"OK") endwindow return stprefs: address AmiIPWatcher window ID STPRE Title locale(54,"Setup") COMMAND '"window ID STPRE close"' PORT AmiIPWatcher group node "HowTo_SendAmIRC" text label "\033c"||locale(53,"Send To Programs Prefs") group frame ATTRS MUIA_Group_Columns 3 label "AmIRC" label locale(55,"Message:") string ID ST_AM ATTRS MUIA_CycleChain 1 help '"'locale(56,"Enter here the text which should\nbe prompt in your activated AmIRC Channel")'"' group FRAME POP ATTRS MUIA_CycleChain 1 label "\033l%c = "||locale(57,"Where the colour should be, followed by a number!")||"\n%i = "||locale(58,"Where the IP (or HostName) should be!") endgroup endgroup group frame ATTRS MUIA_Group_Columns 3 label "STRICQ" label locale(55,"Message:") string ID ST_IC ATTRS MUIA_CycleChain 1 help '"'locale(59,"Enter here the text which should\nbe sent to the selected user in STRICQ.")'"' group FRAME POP ATTRS MUIA_CycleChain 1 label "\033l%i = "||locale(58,"Where the IP (or HostName) should be!") endgroup endgroup group ATTRS MUIA_Group_Columns 3 button ATTRS MUIA_CycleChain 1 COMMAND '"AmiIPWatcher.rexx STPREFSS"' label locale(60,"Save") space HORIZ button ATTRS MUIA_CycleChain 1 COMMAND '"window ID STPRE close"' PORT AmiIPWatcher label locale(61,"Cancel") endgroup endgroup endwindow if OPEN("lp","AmiIPWatcher.Send","R") then do string ID ST_AM content READLN("lp") string ID ST_IC content READLN("lp") call CLOSE("lp") end return stprefss: Address AmiIPWatcher call OPEN("lp","AmiIPWatcher.Send","W") string ID ST_AM call WRITELN("lp",result) string ID ST_IC call WRITELN("lp",result) call CLOSE("lp") window ID STPRE close return sta: if OPEN("lp","AmiIPWatcher.Send","R") then do mess=READLN("lp") call CLOSE("lp") end else do say locale(64,"Could not find the prefsfile, please set the prefs first!") return end address AmiIPWatcher if arg(1)=1 then do string ID IP SENDING=result end if arg(1)=2 then do string ID HOS SENDING=result end mess2="" len=LENGTH(mess) do x=1 to len tecken=SUBSTR(mess,x,1) if tecken="%" then do x=x+1 tecken=SUBSTR(mess,x,1) SELECT WHEN tecken="c" then mess2=mess2||"" WHEN tecken="i" then mess2=mess2||SENDING OTHERWISE mess2=mess2"%"tecken end end else mess2=mess2||tecken end if SHOW('P','AMIRC.1')=0 then do window ID NOAIP ATTRS MUIA_Window_DragBar 0 MUIA_Window_DepthGadget 0 MUIA_Window_SizeGadget 0 text label locale(62,"\033cCould not not find AMIRC.1\nMake sure you have started \nAmIRC 2.x or higher.") button COMMAND '"window ID NOAIP close"' PORT AmiIPWatcher ATTRS MUIA_CycleChain 1 label locale(21,"OK") endwindow exit end ADDRESS AMIRC.1 "SAY "mess2 return sticq: if OPEN("lp","AmiIPWatcher.Send","R") then do do 2 mess=READLN("lp") end call CLOSE("lp") end else do say locale(64,"Could not find the prefsfile, please set the prefs first!") return end Address AmiIPWatcher if arg(1)=1 then do string ID IP SENDING=result end if arg(1)=2 then do string ID HOS SENDING=result end mess2="" len=LENGTH(mess) do x=1 to len tecken=SUBSTR(mess,x,1) if tecken="%" then do x=x+1 tecken=SUBSTR(mess,x,1) SELECT WHEN tecken="i" then mess2=mess2||SENDING OTHERWISE mess2=mess2"%"tecken end end else mess2=mess2||tecken end if SHOW('P','STRICQ.1')=0 then do window ID NOSIP ATTRS MUIA_Window_DragBar 0 MUIA_Window_DepthGadget 0 MUIA_Window_SizeGadget 0 text label locale(63,"\033cCould not not find STRICQ.1\nMake sure you have started STRICQ.") button COMMAND '"window ID NOSIP close"' PORT AmiIPWatcher ATTRS MUIA_CycleChain 1 label locale(21,"OK") endwindow exit end ADDRESS STRICQ.1 GETCONTACT SELECTED SENDMESSAGE 'UIN='ICQRC.UIN 'MSG="'mess2'"' return tags: MUIA_Application_Sleep=0x80425711 MUIA_AppMessage=0x80421955 MUIA_CycleChain=0x80421ce7 MUIA_Disabled=0x80423661 MUIA_Group_Columns=0x8042f416 MUIA_List_Entries=0x80421654 MUIA_List_Format=0x80423c0a MUIA_Menuitem_Shortcut=0x80422030 MUIA_Menuitem_Title=0x804218be MUIA_Selected=0x8042654b MUIA_String_Format=0x80427484 MUIA_Weight=0x80421d1f MUIA_Window_DepthGadget=0x80421923 MUIA_Window_DragBar=0x8042045d MUIA_Window_ScreenTitle=0x804234b0 MUIA_Window_SizeGadget=0x8042e33d MUIM_Application_AboutMUI=0x8042d21d MUIM_Application_OpenConfigWindow=0x804299ba MUIV_String_Format_Center=1 R='0A'X VERSION=2.1 return