I'd sat the answer is 'all of the above'. Because 'history of the relationship' is important - you won't greet a person you've just met the same way you'd great your best friend. "Context' is also important, because you won't speak the same way at a gala, or at a casual meeting with your friends. "Type of the conversation desired" is also relevant, because the way you greet someone will lead the course of your conversation.
When adding a suffix that begins with a vowel to a root word that ends with a consonant, double the consonant before adding the suffix. When adding a suffix to the end of a word, always double the last letter of the root word before adding the suffix.