Could be both. If it is telling you to service your battery you will need to swap the battery eventually... I nursed my MacBook Pro 15 along with a "Service Battery" warning for several months (because the local fix-it shop was back-ordered). My experience of MagSafes is that they fail catastrophically when they fail. The intermittency & outlet hopping makes me think that the computer is drawing too much current (probably because of the needy battery) & tripping the internal breaker which requires time to reset.
You can see how bad your battery is & how much juice your magsafe is putting out by looking at the "Power" section of System Profiler (Apple Menu > About This Mac > More Info...)
Another good periodic maintenance is to reset the Power Management Unit (not sure what they call it these days... used to be PMU). Easy to do:
Shut down computer. Disconnect Power Supply. Hold down Command, Control, Option & Power Button (upper right hand side that you turn the machine on). Hold them down until power light on right side of front edge begins flashing & then allow to start up normally.
Doesn't hurt to Zap the PRAM while you're at it.