Complex sentence: Ottoman War (1876--78) which the Ottomans lost and accepted "de jure" the independence of Montenegro which received certain territorial gains.
Split into simpler sentences: Ottoman War (1876--78), which the Ottomans had lost. The Ottoman Empire had accepted "de jure" the independence of Montenegro, which received certain territorial gains.