This has no error checking. It simply assumes that the existing data have legitimate values and that the people don’t already have the additions and changes you want to effect. Check that it does what you want before using it in earnest!
-- Edit these two variables as required.
set oldDomain to "oldcompany.com"
set newDomain to "newcompany.com"
set lowerChrs to "abcdefghijklmnopqrstuvwxyz"
tell application "Address Book"
-- Get all the email address and people IDs en masse to save looping through every person in Address Book itself.
set {emailAddresses, peopleIDs} to {value of emails, id} of people
repeat with i from 1 to (count peopleIDs)
set thisPersonsEmailAddresses to item i of emailAddresses
repeat with thisEmailAddress in thisPersonsEmailAddresses
-- Only react to email addresses ending in the old or new company domains.
if (thisEmailAddress ends with oldDomain) or (thisEmailAddress ends with newDomain) then
tell person id (item i of peopleIDs)
-- Construct the pre-"@" part of this person's e-mail/Jabber address.
set {first name:name1, last name:name2} to it
set emailName to character (offset of (character 1 of name1) in lowerChrs) of lowerChrs & character (offset of (character 1 of name2) in lowerChrs) of lowerChrs
if ((count name2) > 1) then set emailName to emailName & text 2 thru -1 of name2
-- Add a Jabber handle for them.
make new Jabber handle at end of Jabber handles with properties {label:"work", value:emailName & "@chat." & newDomain}
-- If the person's from the old domain .
if (thisEmailAddress ends with oldDomain) then
-- . add a new e-mail address for them .
make new email at end of emails with properties {label:"work", value:emailName & "@" & newDomain}
-- . and doctor their extension number(s).
set thesePhones to (phones whose label is "extension")
repeat with thisPhone in thesePhones
set extn to value of thisPhone
if ((count extn) is 3) and (extn begins with "1") then set thisPhone's value to "2" & extn
end repeat
end if
end tell
exit repeat -- We only need one hit per person.
end if
end repeat
end repeat
save -- Save the changes.
end tell