the answer is yes. and no. after an episode of influenza you are immune to that particular influenza virus. the catch is that there is no single "influenza virus. " rather the influenza virus is an assembly of several modules that vary from virus to virus and from year to year. these modules are called epitopes but you can think of them as viral "spare parts. " two forms of the influenza virus might share many epitopes or just a few. you are not immune to any form of influenza made of epitopes your immune system hasn't yet seen. the bottom line: catching seasonal flu does not give immunity to h1n1 flu and vice versa. and catching seasonal flu this year won't likely provide immunity against flu infection next year because that virus will have reinvented itself with new epitopes.
does having the flu give you immunity against getting it again?