In a large pan, saute onion in a little oil until translucent. Add garlic and ginger, and saute until fragrant. Add the peeled and diced mangoes, sugar and enough water to cover. Stir to dissolve sugar, then add whole spices. Bring to a boil and turn to low, simmering with the lid on until the fruit is soft (will depend on how ripe the fruit was), about 20 to 30 minutes. Keep an eye on it, and add more water if necessary to prevent burning. This should be a thick, spoonable sauce. If there is too much liquid, remove lid and reduce. When fruit is soft but not mushy, add raisins or cranberries, chili powder and lime juice, then simmer for five minutes more. Ladle into clean, dry jars and process in a water bath for five minutes.