[please help]add some functions to a certain user

Dear all:

I’m a freshman of the Openfire, and I faced a question that I wanna to create a special user in Openfire. Once the user gets the message from other users, he will do some special functions, such as insert a new record to a table in DB and so on. At the moment, the detail of the functions are not the point, but the question is how I can start with work. Should I create a new plugin or just change some codes in Openfile?

Could everybody give me some advice please?